[Top][All Lists]

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

05/104: guix: python-build-system: Add option "#:use-setuptools?" (defau

From: Hartmut Goebel
Subject: 05/104: guix: python-build-system: Add option "#:use-setuptools?" (default true).
Date: Tue, 15 Nov 2016 21:36:58 +0000 (UTC)

htgoebel pushed a commit to branch python-build-system
in repository guix.

commit 5f7565d190cf380b7bae2ce12dba38aff98c4eb9
Author: Hartmut Goebel <address@hidden>
Date:   Sun Oct 2 14:03:32 2016 +0200

    guix: python-build-system: Add option "#:use-setuptools?" (default true).
    * guix/build-system/python.scm (python-build): New keyword argument
      "#:use-setuptools?", defaulting to #t.
    * guix/build/python-build-system.scm (call-setup-py): New positional
      parameter "use-setuptools?". If false, do not use the shim-wrapper
      for addin setuptools. (build, check): accept keyword-
      parameter, and pass to call-setuppy. (install): same; if
      "use-setuptools?" is false, do not use options "--root" and
      "--single-version-externally-managed" for
    * doc/guix.texi (Build Systems): Document it.
 doc/guix.texi                      |    5 +++++
 guix/build-system/python.scm       |    2 ++
 guix/build/python-build-system.scm |   28 +++++++++++++++++-----------
 3 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 2691e24..5f28076 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3137,6 +3137,11 @@ the @code{#:python} parameter.  This is a useful way to 
force a package
 to be built for a specific version of the Python interpreter, which
 might be necessary if the package is only compatible with a single
 interpreter version.
+By default guix calls @code{} under control of
address@hidden, much like @command{pip} does.  Some packages are not
+compatible with setuptools (and pip), thus you can disable this by
+setting the @code{#:use-setuptools} parameter to @code{#f}.
 @end defvr
 @defvr {Scheme Variable} perl-build-system
diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
index adeceb4..d4d3d28 100644
--- a/guix/build-system/python.scm
+++ b/guix/build-system/python.scm
@@ -177,6 +177,7 @@ pre-defined variants."
                        (tests? #t)
                        (test-target "test")
+                       (use-setuptools? #t)
                        (configure-flags ''())
                        (phases '(@ (guix build python-build-system)
@@ -204,6 +205,7 @@ provides a '' file as its build system."
                      #:system ,system
                      #:test-target ,test-target
                      #:tests? ,tests?
+                     #:use-setuptools? ,use-setuptools?
                      #:phases ,phases
                      #:outputs %outputs
                      #:search-paths ',(map search-path-specification->sexp
diff --git a/guix/build/python-build-system.scm 
index 6086df3..7ccc938 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -49,22 +49,25 @@
    "exec(compile(code, __file__, 'exec'))"))
-(define (call-setuppy command params)
+(define (call-setuppy command params use-setuptools?)
   (if (file-exists? "")
          (format #t "running \"python\" with command ~s and 
parameters ~s~%"
                 command params)
-         (zero? (apply system* "python" "-c" setuptools-shim command params)))
+         (if use-setuptools?
+             (zero? (apply system* "python" "-c" setuptools-shim
+                           command params))
+             (zero? (apply system* "python" "./" command params))))
       (error "no found")))
-(define* (build #:rest empty)
+(define* (build #:key use-setuptools? #:allow-other-keys)
   "Build a given Python package."
-  (call-setuppy "build" '()))
+  (call-setuppy "build" '() use-setuptools?))
-(define* (check #:key tests? test-target #:allow-other-keys)
+(define* (check #:key tests? test-target use-setuptools? #:allow-other-keys)
   "Run the test suite of a given Python package."
   (if tests?
-    (call-setuppy test-target '())
+    (call-setuppy test-target '() use-setuptools?)
 (define (get-python-version python)
@@ -73,15 +76,18 @@
          (major+minor (take components 2)))
     (string-join major+minor ".")))
-(define* (install #:key outputs (configure-flags '())
+(define* (install #:key outputs (configure-flags '()) use-setuptools?
   "Install a given Python package."
   (let* ((out (assoc-ref outputs "out"))
-         (params (append (list (string-append "--prefix=" out)
-                               "--single-version-externally-managed"
-                               "--root=/")
+         (params (append (list (string-append "--prefix=" out))
+                         (if use-setuptools?
+                             ;; distutils does not accept these flags
+                             (list "--single-version-externally-managed"
+                                    "--root=/")
+                             '())
-    (call-setuppy "install" params)))
+    (call-setuppy "install" params use-setuptools?)))
 (define* (wrap #:key inputs outputs #:allow-other-keys)
   (define (list-of-files dir)

reply via email to

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