all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex Sassmannshausen <alex.sassmannshausen@gmail.com>
To: guix-devel@gnu.org
Cc: Alex Sassmannshausen <alex@pompo.co>
Subject: [PATCH 3/3] build/python-build-system: Refactor `wrap`.
Date: Wed, 16 Nov 2016 14:27:34 +0100	[thread overview]
Message-ID: <20161116132734.5943-4-alex@pompo.co> (raw)
In-Reply-To: <20161116132734.5943-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 9109fb4..8e3ea41 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -80,34 +80,14 @@
                                add-path))
         (call-setuppy "install" params)))
 
-(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 `wrap-language-program' to return an executable wrapper for python.
+(define wrap
+  (wrap-language-programs
+   (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.10.2

  parent reply	other threads:[~2016-11-16 13:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-16 13:27 [PATCH 0/3] Add a generalized `wrap-language-programs` Alex Sassmannshausen
2016-11-16 13:27 ` [PATCH 1/3] build/utils: Add `wrap-language-programs` Alex Sassmannshausen
2016-11-18 23:07   ` Ludovic Courtès
2016-11-16 13:27 ` [PATCH 2/3] build/perl-build-system: Add `wrap` phase Alex Sassmannshausen
2016-11-16 13:27 ` Alex Sassmannshausen [this message]
     [not found] ` <582C6035.1070202@crazy-compilers.com>
2016-11-17 15:58   ` [PATCH 0/3] Add a generalized `wrap-language-programs` Alex Sassmannshausen
2016-11-17 17:09     ` Alex Sassmannshausen
2016-11-17 17:16       ` Hartmut Goebel
2016-11-17 21:15     ` Leo Famulari
2016-11-18  8:02       ` Alex Sassmannshausen
2016-11-18  8:34         ` Leo Famulari
2016-11-18  9:07           ` Alex Sassmannshausen
2016-11-18  8:41       ` Hartmut Goebel
2016-11-18  9:10     ` Ludovic Courtès
2016-11-18 15:16       ` Alex Sassmannshausen
2016-11-18 22:52 ` 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

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

  git send-email \
    --in-reply-to=20161116132734.5943-4-alex@pompo.co \
    --to=alex.sassmannshausen@gmail.com \
    --cc=alex@pompo.co \
    --cc=guix-devel@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.