guix-commits
[Top][All Lists]
Advanced

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

100/163: gnu: patchwork: Wrap with the new Guix PYTHONPATH.


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

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

commit b36dcea1aa7092c13178a854c6095e064a2b5c77
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Sat Jan 23 23:40:21 2021 -0500

    gnu: patchwork: Wrap with the new Guix PYTHONPATH.
    
    * gnu/packages/patchutils.scm (patchwork)[phases]: Remove trailing #t.
    {replace-wsgi.py}: Wrap with the new Guix PYTHONPATH.
---
 gnu/packages/patchutils.scm | 38 ++++++++++++++++----------------------
 1 file changed, 16 insertions(+), 22 deletions(-)

diff --git a/gnu/packages/patchutils.scm b/gnu/packages/patchutils.scm
index 1354c86..778ac03 100644
--- a/gnu/packages/patchutils.scm
+++ b/gnu/packages/patchutils.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2015, 2018 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Christopher Baines <mail@cbaines.net>
+;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -341,21 +342,18 @@ you to figure out what is going on in that merge you keep 
avoiding.")
          (delete 'build)
          (add-after 'unpack 'replace-wsgi.py
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (delete-file "patchwork/wsgi.py")
-             (call-with-output-file "patchwork/wsgi.py"
-               (lambda (port)
-                 ;; Embed the PYTHONPATH containing the dependencies, as well
-                 ;; as the python modules in this package in the wsgi.py file,
-                 ;; as this will ensure they are available at runtime.
-                 (define pythonpath
-                   (string-append (getenv "PYTHONPATH")
-                                  ":"
-                                  (site-packages inputs outputs)))
-                 (display
-                  (string-append "
+             ;; Embed the PYTHONPATH containing the dependencies, as well
+             ;; as the python modules in this package in the wsgi.py file,
+             ;; as this will ensure they are available at runtime.
+             (let ((pythonpath (guix-pythonpath inputs)))
+               (delete-file "patchwork/wsgi.py")
+               (call-with-output-file "patchwork/wsgi.py"
+                 (lambda (port)
+                   (display
+                    (string-append "
 import os, sys
 
-sys.path.extend('" pythonpath "'.split(':'))
+sys.path.extend('" (getenv pythonpath) "'.split(':'))
 
 from django.core.wsgi import get_wsgi_application
 
@@ -369,13 +367,12 @@ os.environ['DJANGO_SETTINGS_MODULE'] = os.getenv(
   'guix.patchwork.settings' # default
 )
 
-application = get_wsgi_application()\n") port)))))
+application = get_wsgi_application()\n") port))))))
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?
                (setenv "DJANGO_SETTINGS_MODULE" "patchwork.settings.dev")
-               (invoke "python" "-Wonce" "./manage.py" "test" "--noinput"))
-             #t))
+               (invoke "python" "-Wonce" "./manage.py" "test" "--noinput"))))
          (replace 'install
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out"))
@@ -422,8 +419,7 @@ application = get_wsgi_application()\n") port)))))
                ;; may be useful when deploying patchwork.
                (copy-recursively "lib"
                                  (string-append
-                                  out "/share/doc/" ,name "-" ,version)))
-             #t))
+                                  out "/share/doc/" ,name "-" ,version)))))
          ;; The hasher script is used from the post-receive.hook
          (add-after 'install 'install-hasher
            (lambda* (#:key inputs outputs #:allow-other-keys)
@@ -432,8 +428,7 @@ application = get_wsgi_application()\n") port)))))
                     (out-hasher.py (string-append out-site-packages
                                                   "/patchwork/hasher.py")))
                (chmod out-hasher.py #o555)
-               (symlink out-hasher.py (string-append out "/bin/hasher")))
-             #t))
+               (symlink out-hasher.py (string-append out "/bin/hasher")))))
          ;; Create a patchwork specific version of Django's command line admin
          ;; utility.
          (add-after 'install 'install-patchwork-admin
@@ -449,8 +444,7 @@ if __name__ == \"__main__\":
     from django.core.management import execute_from_command_line
 
     execute_from_command_line(sys.argv)" (which "python"))))
-               (chmod (string-append out "/bin/patchwork-admin") #o555))
-             #t)))))
+               (chmod (string-append out "/bin/patchwork-admin") #o555)))))))
     (inputs
      `(("python-wrapper" ,python-wrapper)))
     (propagated-inputs



reply via email to

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