~ruther/guix-local

d6323ba597c5740818c3190f19a801c94836fc14 — Nicolas Graves 9 months ago df99ec9
gnu: python-slurm-magic: Switch to pyproject.

* gnu/packages/parallel.scm (python-slurm-magic):
[build-system]: Switch to pyproject-build-system.
[arguments]: Improve style, modernize with gexps and
seaerch-input-file.
<#:tests?>: Disable them.
[native-inputs]: Add python-setuptools.

Change-Id: Ic5243c647f645de49eeb54262eabeea6df73743e
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
1 files changed, 28 insertions(+), 26 deletions(-)

M gnu/packages/parallel.scm
M gnu/packages/parallel.scm => gnu/packages/parallel.scm +28 -26
@@ 552,33 552,35 @@ supercomputer (via, e.g., MPI or JobLib).")
      (name "python-slurm-magic")
      (version (git-version "0.0" revision commit))
      (home-page "https://github.com/NERSC/slurm-magic")
      (source (origin
                (method git-fetch)
                (uri (git-reference (url home-page)
                                    (commit commit)))
                (sha256
                 (base32
                  "19pp2vs0wm8mx0arz9n6lw9wgyv70w9wyi4y6b91qc5j3bz5igfs"))
                (file-name (git-file-name name version))))
      (build-system python-build-system)
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
               (url home-page)
               (commit commit)))
         (sha256
          (base32 "19pp2vs0wm8mx0arz9n6lw9wgyv70w9wyi4y6b91qc5j3bz5igfs"))
         (file-name (git-file-name name version))))
      (build-system pyproject-build-system)
      (arguments
       '(#:phases (modify-phases %standard-phases
                    (add-before 'build 'set-slurm-path
                      (lambda* (#:key inputs #:allow-other-keys)
                        ;; The '_execute' method tries to exec 'salloc'
                        ;; etc. from $PATH.  Record the absolute file name
                        ;; instead.
                        (let ((slurm (assoc-ref inputs "slurm")))
                          (substitute* "slurm_magic.py"
                            (("name = (.*)$" _ value)
                             (string-append "name = \""
                                            slurm "/bin/\" + "
                                            value "\n")))
                          #t))))))
      (inputs
       (list slurm))
      (propagated-inputs
       (list python-ipython python-pandas))
       (list
        #:tests? #f                     ; No tests.
        #:phases
        #~(modify-phases %standard-phases
            (add-before 'build 'set-slurm-path
              (lambda* (#:key inputs #:allow-other-keys)
                ;; The '_execute' method tries to exec 'salloc'
                ;; etc. from $PATH.  Record the absolute file name
                ;; instead.
                (let ((slurm-bin (dirname
                                  (search-input-file inputs "/bin/sinfo"))))
                  (substitute* "slurm_magic.py"
                    (("name = (.*)$" _ value)
                     (string-append "name = \"" slurm-bin "/\" + "
                                    value "\n")))))))))
      (native-inputs (list python-setuptools))
      (inputs (list slurm))
      (propagated-inputs (list python-ipython python-pandas))
      (synopsis "Control the SLURM batch scheduler from Jupyter Notebook")
      (description
       "This package implements Jupyter/IPython