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.
This commit is contained in:
parent
49b90a7539
commit
b191f88ee3
|
@ -35,26 +35,32 @@
|
|||
;;
|
||||
;; Code:
|
||||
|
||||
|
||||
(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?
|
||||
(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")))
|
||||
(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)
|
||||
"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"))
|
||||
#t))
|
||||
(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)
|
||||
|
@ -91,11 +97,12 @@
|
|||
(alist-cons-after
|
||||
'install 'wrap
|
||||
wrap
|
||||
(alist-replace
|
||||
'build build
|
||||
(alist-replace
|
||||
'check check
|
||||
(alist-replace 'install install
|
||||
(alist-delete 'configure
|
||||
(alist-delete 'build
|
||||
gnu:%standard-phases))))))
|
||||
|
||||
(define* (python-build #:key inputs (phases %standard-phases)
|
||||
|
|
Loading…
Reference in New Issue