summary refs log tree commit diff
path: root/guix/build-system/python.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/build-system/python.scm')
-rw-r--r--guix/build-system/python.scm89
1 files changed, 44 insertions, 45 deletions
diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
index d4d3d28f2a..17173f121e 100644
--- a/guix/build-system/python.scm
+++ b/guix/build-system/python.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
 ;;;
@@ -21,7 +21,7 @@
 (define-module (guix build-system python)
   #:use-module (guix store)
   #:use-module (guix utils)
-  #:use-module (guix combinators)
+  #:use-module (guix memoization)
   #:use-module (guix packages)
   #:use-module (guix derivations)
   #:use-module (guix search-paths)
@@ -87,49 +87,48 @@ pre-defined variants."
     ;; Memoize the transformations.  Failing to do that, we would build a huge
     ;; object graph with lots of duplicates, which in turns prevents us from
     ;; benefiting from memoization in 'package-derivation'.
-    (memoize                                      ;FIXME: use 'eq?'
-     (lambda (p)
-       (let* ((rewrite-if-package
-               (lambda (content)
-                 ;; CONTENT may be a file name, in which case it is returned,
-                 ;; or a package, which is rewritten with the new PYTHON and
-                 ;; NEW-PREFIX.
-                 (if (package? content)
-                     (transform content)
-                     content)))
-              (rewrite
-               (match-lambda
-                 ((name content . rest)
-                  (append (list name (rewrite-if-package content)) rest)))))
-
-         (cond
-          ;; If VARIANT-PROPERTY is present, use that.
-          ((and variant-property
-                (assoc-ref (package-properties p) variant-property))
-           => force)
-
-          ;; Otherwise build the new package object graph.
-          ((eq? (package-build-system p) python-build-system)
-           (package
-             (inherit p)
-             (location (package-location p))
-             (name (let ((name (package-name p)))
-                     (string-append new-prefix
-                                    (if (string-prefix? old-prefix name)
-                                        (substring name
-                                                   (string-length old-prefix))
-                                        name))))
-             (arguments
-              (let ((python (if (promise? python)
-                                (force python)
-                                python)))
-                (ensure-keyword-arguments (package-arguments p)
-                                          `(#:python ,python))))
-             (inputs (map rewrite (package-inputs p)))
-             (propagated-inputs (map rewrite (package-propagated-inputs p)))
-             (native-inputs (map rewrite (package-native-inputs p)))))
-          (else
-           p))))))
+    (mlambdaq (p)
+      (let* ((rewrite-if-package
+              (lambda (content)
+                ;; CONTENT may be a file name, in which case it is returned,
+                ;; or a package, which is rewritten with the new PYTHON and
+                ;; NEW-PREFIX.
+                (if (package? content)
+                    (transform content)
+                    content)))
+             (rewrite
+              (match-lambda
+                ((name content . rest)
+                 (append (list name (rewrite-if-package content)) rest)))))
+
+        (cond
+         ;; If VARIANT-PROPERTY is present, use that.
+         ((and variant-property
+               (assoc-ref (package-properties p) variant-property))
+          => force)
+
+         ;; Otherwise build the new package object graph.
+         ((eq? (package-build-system p) python-build-system)
+          (package
+            (inherit p)
+            (location (package-location p))
+            (name (let ((name (package-name p)))
+                    (string-append new-prefix
+                                   (if (string-prefix? old-prefix name)
+                                       (substring name
+                                                  (string-length old-prefix))
+                                       name))))
+            (arguments
+             (let ((python (if (promise? python)
+                               (force python)
+                               python)))
+               (ensure-keyword-arguments (package-arguments p)
+                                         `(#:python ,python))))
+            (inputs (map rewrite (package-inputs p)))
+            (propagated-inputs (map rewrite (package-propagated-inputs p)))
+            (native-inputs (map rewrite (package-native-inputs p)))))
+         (else
+          p)))))
 
   transform)