From 5f7565d190cf380b7bae2ce12dba38aff98c4eb9 Mon Sep 17 00:00:00 2001 From: Hartmut Goebel Date: Sun, 2 Oct 2016 14:03:32 +0200 Subject: 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. --- guix/build/python-build-system.scm | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'guix/build') diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm index 6086df3e82..7ccc9386cf 100644 --- a/guix/build/python-build-system.scm +++ b/guix/build/python-build-system.scm @@ -49,22 +49,25 @@ "f.close();" "exec(compile(code, __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) @@ -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? #: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) -- cgit v1.2.3