[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/97: guix: python-build-system: Add option "#:use-setuptools?" (defaul
From: |
Hartmut Goebel |
Subject: |
05/97: guix: python-build-system: Add option "#:use-setuptools?" (default true). |
Date: |
Tue, 18 Oct 2016 20:13:15 +0000 (UTC) |
htgoebel pushed a commit to branch wip-python-build-system
in repository guix.
commit 3c7a2c1e0c47ba649c2a61b767d44f6a9997aa38
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 setup.py.
* 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 ca4b1b0..a856e57 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3093,6 +3093,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{setup.py} 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."
#:key
(tests? #t)
(test-target "test")
+ (use-setuptools? #t)
(configure-flags ''())
(phases '(@ (guix build python-build-system)
%standard-phases))
@@ -204,6 +205,7 @@ provides a 'setup.py' 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
b/guix/build/python-build-system.scm
index 50a094d..038fa97 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -47,22 +47,25 @@
"exec(compile(getattr(tokenize, 'open', open)(__file__).read()"
".replace('\\r\\n', '\\n'), __file__, 'exec'))"))
-(define (call-setuppy command params)
+(define (call-setuppy command params use-setuptools?)
(if (file-exists? "setup.py")
(begin
(format #t "running \"python setup.py\" 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" "./setup.py" command params))))
(error "no setup.py 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?)
#t))
(define (get-python-version python)
@@ -71,15 +74,18 @@
(major+minor (take components 2)))
(string-join major+minor ".")))
-(define* (install #:key outputs inputs (configure-flags '())
+(define* (install #:key outputs inputs (configure-flags '()) use-setuptools?
#:allow-other-keys)
"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=/")
+ '())
configure-flags)))
- (call-setuppy "install" params)))
+ (call-setuppy "install" params use-setuptools?)))
(define* (wrap #:key inputs outputs #:allow-other-keys)
(define (list-of-files dir)
- branch wip-python-build-system created (now 411c893), Hartmut Goebel, 2016/10/18
- 03/97: guix: build all Python packages with --single-version-externally-managed., Hartmut Goebel, 2016/10/18
- 01/97: guix: python-build-system: Fix an outdated comment., Hartmut Goebel, 2016/10/18
- 07/97: guix: python-build-system: Delete .egg-info file created in phase check., Hartmut Goebel, 2016/10/18
- 04/97: guix: python-build-system: Import setuptools before calling `setup.py'., Hartmut Goebel, 2016/10/18
- 02/97: gnu: ensure pip and setuptools are installed even for Python 2., Hartmut Goebel, 2016/10/18
- 05/97: guix: python-build-system: Add option "#:use-setuptools?" (default true).,
Hartmut Goebel <=
- 06/97: guix: python-build-system: Add helpers for getting and setting PYTHONPATH., Hartmut Goebel, 2016/10/18
- 10/97: lint: more packages to probably be a native input., Hartmut Goebel, 2016/10/18
- 17/97: gnu: Remove needless inputs python-pip and python2-pip., Hartmut Goebel, 2016/10/18
- 20/97: gnu: python-pytest: Propagate input "python-py"., Hartmut Goebel, 2016/10/18
- 19/97: gnu: scons: Do not use setuptools for building., Hartmut Goebel, 2016/10/18
- 08/97: gnu: python-2.7: Add all guix prefixes in PYTHONPATH to site-prefixes., Hartmut Goebel, 2016/10/18
- 09/97: guix: Add lint-checker for packages which should be no inputs at all., Hartmut Goebel, 2016/10/18
- 21/97: gnu: python-pytest-cov: Use upstream options for testing., Hartmut Goebel, 2016/10/18
- 25/97: inputs -> propagated-inputs: special, Hartmut Goebel, 2016/10/18
- 14/97: gnu: Remove python-setuptools and python2-setuptools from inputs (part 3), Hartmut Goebel, 2016/10/18