guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

70/163: gnu: solfege: Wrap with the new Guix PYTHONPATH.


From: guix-commits
Subject: 70/163: gnu: solfege: Wrap with the new Guix PYTHONPATH.
Date: Mon, 25 Jan 2021 02:01:34 -0500 (EST)

apteryx pushed a commit to branch cu/farewell-to-pythonpath
in repository guix.

commit 4abecb487312d9cce2c18d1bf51fa73bb024cb53
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Sat Jan 23 01:06:51 2021 -0500

    gnu: solfege: Wrap with the new Guix PYTHONPATH.
    
    * gnu/packages/music.scm (solfege): Delete trailing #t.
    [phases]{add-sitedirs}: Indent Python snippet.
    {wrap-program}: Wrap with the new Guix PYTHONPATH.
---
 gnu/packages/music.scm | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index b3c25a7..af16d4f 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -33,6 +33,7 @@
 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
 ;;; Copyright © 2019 Riku Viitanen <riku.viitanen0@gmail.com>
 ;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
+;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1670,7 +1671,12 @@ Key features include:
                 "1w25rxdbj907nsx285k9nm480pvy12w3yknfh4n1dfv17cwy072i"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:tests? #f ; xmllint attempts to download DTD
+     `(#:imported-modules ,(cons '(guix build python-build-system)
+                                 %gnu-build-system-modules)
+       #:modules ((guix build gnu-build-system)
+                  ((guix build python-build-system) #:select (guix-pythonpath))
+                  (guix build utils))
+       #:tests? #f ; xmllint attempts to download DTD
        #:test-target "test"
        #:phases
        (modify-phases %standard-phases
@@ -1680,16 +1686,14 @@ Key features include:
                (("/usr/bin/aplay") "aplay")
                (("/usr/bin/timidity") "timidity")
                (("/usr/bin/mpg123") "mpg123")
-               (("/usr/bin/ogg123") "ogg123"))
-             #t))
+               (("/usr/bin/ogg123") "ogg123"))))
          (add-before 'build 'patch-python-shebangs
            (lambda _
              ;; Two python scripts begin with a Unicode BOM, so patch-shebang
              ;; has no effect.
              (substitute* '("solfege/parsetree.py"
                             "solfege/presetup.py")
-               (("#!/usr/bin/python") (string-append "#!" (which "python"))))
-             #t))
+               (("#!/usr/bin/python") (string-append "#!" (which "python"))))))
          (add-before 'build 'add-sitedirs
            ;; .pth files are not automatically interpreted unless the
            ;; directories containing them are added as "sites".  The 
directories
@@ -1699,22 +1703,20 @@ Key features include:
              (substitute* "run-solfege.py"
                (("import os")
                 "import os, site
-for path in [path for path in sys.path if 'site-packages' in path]: 
site.addsitedir(path)"))
-             #t))
+for path in [path for path in sys.path if 'site-packages' in path]:
+    site.addsitedir(path)"))))
          (add-before 'build 'adjust-config-file-prefix
            (lambda* (#:key outputs #:allow-other-keys)
              (substitute* "run-solfege.py"
                (("prefix = os.path.*$")
-                (string-append "prefix = " (assoc-ref outputs "out"))))
-             #t))
+                (string-append "prefix = " (assoc-ref outputs "out"))))))
          (add-after 'install 'wrap-program
            (lambda* (#:key inputs outputs #:allow-other-keys)
              ;; Make sure 'solfege' runs with the correct PYTHONPATH.
              (let* ((out (assoc-ref outputs "out"))
-                    (path (getenv "PYTHONPATH")))
+                    (pythonpath (guix-pythonpath inputs)))
                (wrap-program (string-append out "/bin/solfege")
-                 `("PYTHONPATH" ":" prefix (,path))))
-             #t)))))
+                 `(,pythonpath ":" prefix (,(getenv pythonpath))))))))))
     (inputs
      `(("python" ,python-2)
        ("pygtk" ,python2-pygtk)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]