aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Enge <andreas@enge.fr>2013-09-05 20:25:08 +0200
committerAndreas Enge <andreas@enge.fr>2013-09-05 20:25:08 +0200
commitb191f88ee34576a6908b9b5e94cb7664e88c7e79 (patch)
treee55807355133f559ea3b1e9bfe1c5e45bc31106e
parent49b90a7539f69c2ac6a86697f3b9c631a3ceca15 (diff)
downloadguix-b191f88ee34576a6908b9b5e94cb7664e88c7e79.tar
guix-b191f88ee34576a6908b9b5e94cb7664e88c7e79.tar.gz
guix: python: Add build phase and factor out calls to setup.py.
* guix/build/python-build-system.scm (call-setuppy): New procedure. * guix/build/python-build-system.scm (build): New procedure. * guix/build/python-build-system.scm (check, install): Use call-setuppy. * guix/build/python-build-system.scm (%standard-phases): Add call to build.
-rw-r--r--guix/build/python-build-system.scm49
1 files changed, 28 insertions, 21 deletions
diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
index 27818526fa..f213a97f01 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -35,27 +35,33 @@
;;
;; Code:
-(define* (install #:key outputs (configure-flags '())
- #:allow-other-keys)
- "Install a given Python package."
- (let ((out (assoc-ref outputs "out")))
- (if (file-exists? "setup.py")
- (let ((args `("setup.py" "install" ,(string-append "--prefix=" out)
- ,@configure-flags)))
- (format #t "running 'python' with arguments ~s~%" args)
- (zero? (apply system* "python" args)))
- (error "no setup.py found"))))
-(define* (check #:key outputs tests? test-target #:allow-other-keys)
+(define (call-setuppy command params)
+ (if (file-exists? "setup.py")
+ (begin
+ (format #t "running \"python setup.py\" with command ~s and parameters ~s~%"
+ command params)
+ (zero? (apply system* "python" "setup.py" command params)))
+ (error "no setup.py found")))
+
+(define* (build #:rest empty)
+ "Build a given Python package."
+ (call-setuppy "build" '()))
+
+(define* (check #:key tests? test-target #:allow-other-keys)
"Run the test suite of a given Python package."
(if tests?
- (if (file-exists? "setup.py")
- (let ((args `("setup.py" ,test-target)))
- (format #t "running 'python' with arguments ~s~%" args)
- (zero? (apply system* "python" args)))
- (error "no setup.py found"))
+ (call-setuppy test-target '())
#t))
+(define* (install #:key outputs (configure-flags '())
+ #:allow-other-keys)
+ "Install a given Python package."
+ (let* ((out (assoc-ref outputs "out"))
+ (params (append (list (string-append "--prefix=" out))
+ configure-flags)))
+ (call-setuppy "install" params)))
+
(define* (wrap #:key inputs outputs #:allow-other-keys)
(define (list-of-files dir)
(map (cut string-append dir "/" <>)
@@ -92,11 +98,12 @@
'install 'wrap
wrap
(alist-replace
- 'check check
- (alist-replace 'install install
- (alist-delete 'configure
- (alist-delete 'build
- gnu:%standard-phases))))))
+ 'build build
+ (alist-replace
+ 'check check
+ (alist-replace 'install install
+ (alist-delete 'configure
+ gnu:%standard-phases))))))
(define* (python-build #:key inputs (phases %standard-phases)
#:allow-other-keys #:rest args)