[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[WIP 4/8] guix: python-build-system: Add option "#:use-setuptools?" (def
From: |
Hartmut Goebel |
Subject: |
[WIP 4/8] guix: python-build-system: Add option "#:use-setuptools?" (default true). |
Date: |
Mon, 10 Oct 2016 16:57:15 +0200 |
TODO: Documentation, test-case.
* 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 02f7486..92a827a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3092,6 +3092,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)
--
2.7.4
- [WIP 0/9] python-build-system set 1: please review, Hartmut Goebel, 2016/10/10
- [WIP 3/8] guix: python-build-system: Import setuptools before calling `setup.py'., Hartmut Goebel, 2016/10/10
- [WIP 1/8] gnu: ensure pip and setuptools are installed even for Python 2., Hartmut Goebel, 2016/10/10
- [WIP 2/8] guix: build all Python packages with --single-version-externally-managed., Hartmut Goebel, 2016/10/10
- [WIP 5/8] guix: python-build-system: Add helpers for getting and setting PYTHONPATH., Hartmut Goebel, 2016/10/10
- [WIP 4/8] guix: python-build-system: Add option "#:use-setuptools?" (default true).,
Hartmut Goebel <=
- [WIP 6/8] guix: python-build-system: Delete .egg-info file created in phase check., Hartmut Goebel, 2016/10/10
- [WIP 7/8] guix: Add lint-checker for packages which should be no inputs at all., Hartmut Goebel, 2016/10/10
- [WIP 8/8] lint: more packages to probably be a native input., Hartmut Goebel, 2016/10/10
- Re: [WIP 0/9] python-build-system set 1: please review, Hartmut Goebel, 2016/10/11
- Re: [WIP 0/9] python-build-system set 1: please review, Hartmut Goebel, 2016/10/11