unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex Sassmannshausen <alex.sassmannshausen@gmail.com>
To: 27003@debbugs.gnu.org
Subject: bug#27003: [PATCH 3/3] build/python-build-system: Refactor 'wrap'.
Date: Sat, 20 May 2017 11:40:30 +0200	[thread overview]
Message-ID: <20170520094030.2471-3-alex@pompo.co> (raw)
In-Reply-To: <20170520094030.2471-1-alex@pompo.co>

* guix/build/python-build-system.scm (wrap): Use
  'wrap-language-program'.
---
 guix/build/python-build-system.scm | 36 ++++++++----------------------------
 1 file changed, 8 insertions(+), 28 deletions(-)

diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
index dd07986b9..30d01f8cb 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -184,34 +184,14 @@ when running checks after installing the package."
                          configure-flags)))
     (call-setuppy "install" params use-setuptools?)))
 
-(define* (wrap #:key inputs outputs #:allow-other-keys)
-  (define (list-of-files dir)
-    (map (cut string-append dir "/" <>)
-         (or (scandir dir (lambda (f)
-                            (let ((s (stat (string-append dir "/" f))))
-                              (eq? 'regular (stat:type s)))))
-             '())))
-
-  (define bindirs
-    (append-map (match-lambda
-                 ((_ . dir)
-                  (list (string-append dir "/bin")
-                        (string-append dir "/sbin"))))
-                outputs))
-
-  (let* ((out  (assoc-ref outputs "out"))
-         (python (assoc-ref inputs "python"))
-         (var `("PYTHONPATH" prefix
-                ,(cons (string-append out "/lib/python"
-                                      (get-python-version python)
-                                      "/site-packages")
-                       (search-path-as-string->list
-                        (or (getenv "PYTHONPATH") ""))))))
-    (for-each (lambda (dir)
-                (let ((files (list-of-files dir)))
-                  (for-each (cut wrap-program <> var)
-                            files)))
-              bindirs)))
+;; Use 'program-wrapper' to return an executable wrapper for python.
+(define wrap
+  (program-wrapper
+   (lambda (inputs outputs)
+     (string-append (assoc-ref outputs "out") "/lib/python"
+                    (get-python-version (assoc-ref inputs "python"))
+                    "/site-packages"))
+   "PYTHONPATH"))
 
 (define* (rename-pth-file #:key name inputs outputs #:allow-other-keys)
   "Rename easy-install.pth to NAME.pth to avoid conflicts between packages
-- 
2.12.2

  parent reply	other threads:[~2017-05-20  9:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-20  9:37 bug#27003: [PATCH 0/3] Generalized wrap phase for perl, python Alex Sassmannshausen
2017-05-20  9:40 ` bug#27003: [PATCH 1/3] build/utils: Add 'program-wrapper' Alex Sassmannshausen
2017-05-20  9:40   ` bug#27003: [PATCH 2/3] build/perl-build-system: Add 'wrap' phase Alex Sassmannshausen
2017-05-20  9:40   ` Alex Sassmannshausen [this message]
2017-05-20 20:23 ` bug#27003: [PATCH 0/3] Generalized wrap phase for perl, python Marius Bakke
2017-05-27 19:04   ` Arun Isaac
2017-05-28 19:08   ` Arun Isaac
2017-05-29 13:45     ` Alex Sassmannshausen
2017-05-30 13:45       ` Arun Isaac
     [not found]       ` <ef869600.AEMAK2iO_jkAAAAAAAAAAAPFd4cAAAACwQwAAAAAAAW9WABZLXea@mailjet.com>
2017-05-30 15:17         ` Marius Bakke
2020-03-21 14:23 ` Brice Waegeneire
2020-03-21 16:32   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170520094030.2471-3-alex@pompo.co \
    --to=alex.sassmannshausen@gmail.com \
    --cc=27003@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).