From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Sassmannshausen Subject: [PATCH 3/3] build/python-build-system: Refactor `wrap`. Date: Wed, 16 Nov 2016 14:27:34 +0100 Message-ID: <20161116132734.5943-4-alex@pompo.co> References: <20161116132734.5943-1-alex@pompo.co> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c70Fp-0004ZH-EB for guix-devel@gnu.org; Wed, 16 Nov 2016 08:27:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c70Fk-0002AO-FX for guix-devel@gnu.org; Wed, 16 Nov 2016 08:27:57 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:36136) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c70Fk-0002A6-98 for guix-devel@gnu.org; Wed, 16 Nov 2016 08:27:52 -0500 Received: by mail-wm0-x243.google.com with SMTP id m203so11091747wma.3 for ; Wed, 16 Nov 2016 05:27:52 -0800 (PST) In-Reply-To: <20161116132734.5943-1-alex@pompo.co> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org Cc: Alex Sassmannshausen * 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