guix: python: Create module installation path and add it to PYTHONPATH during
the installation phase. * guix/build/python-build-system.scm (get-python-version): New procedure. * guix/build/python-build-system.scm (install): Create and add path. * gnu/packages/python.scm (python-setuptools): Drop path creation code.
This commit is contained in:
parent
73adf22037
commit
824af8cadc
|
@ -262,25 +262,11 @@ etc. ")
|
||||||
"0hl9sa5xr9bi2ifq51wy1bawsjv5nzvpbac7m9z1ciz778874csf"))))
|
"0hl9sa5xr9bi2ifq51wy1bawsjv5nzvpbac7m9z1ciz778874csf"))))
|
||||||
(build-system python-build-system)
|
(build-system python-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
`(#:tests? #f
|
`(#:tests? #f))
|
||||||
;;FIXME: test_sdist_with_utf8_encoded_filename fails in
|
;;FIXME: test_sdist_with_utf8_encoded_filename fails in
|
||||||
;; /tmp/nix-build-python2-setuptools-1.1.4.drv-0/setuptools-1.1.4/setuptools/tests/test_sdist.py"
|
;; /tmp/nix-build-python2-setuptools-1.1.4.drv-0/setuptools-1.1.4/setuptools/tests/test_sdist.py"
|
||||||
;; line 354
|
;; line 354
|
||||||
;; The tests pass with Python 2.7.5.
|
;; The tests pass with Python 2.7.5.
|
||||||
#:phases
|
|
||||||
(alist-replace
|
|
||||||
'install
|
|
||||||
(lambda* (#:key outputs #:allow-other-keys #:rest args)
|
|
||||||
(let* ((install (assoc-ref %standard-phases 'install))
|
|
||||||
(out (assoc-ref outputs "out"))
|
|
||||||
(python (assoc-ref %build-inputs "python"))
|
|
||||||
(python-version (string-take (string-take-right python 5) 3))
|
|
||||||
(path (string-append out "/lib/python" python-version
|
|
||||||
"/site-packages/")))
|
|
||||||
(mkdir-p path)
|
|
||||||
(setenv "PYTHONPATH" path)
|
|
||||||
(apply install args)))
|
|
||||||
%standard-phases)))
|
|
||||||
(home-page "https://pypi.python.org/pypi/setuptools")
|
(home-page "https://pypi.python.org/pypi/setuptools")
|
||||||
(synopsis
|
(synopsis
|
||||||
"Library designed to facilitate packaging Python projects")
|
"Library designed to facilitate packaging Python projects")
|
||||||
|
|
|
@ -54,12 +54,27 @@
|
||||||
(call-setuppy test-target '())
|
(call-setuppy test-target '())
|
||||||
#t))
|
#t))
|
||||||
|
|
||||||
(define* (install #:key outputs (configure-flags '())
|
(define (get-python-version python)
|
||||||
|
(string-take (string-take-right python 5) 3))
|
||||||
|
|
||||||
|
(define* (install #:key outputs inputs (configure-flags '())
|
||||||
#:allow-other-keys)
|
#:allow-other-keys)
|
||||||
"Install a given Python package."
|
"Install a given Python package."
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
(params (append (list (string-append "--prefix=" out))
|
(params (append (list (string-append "--prefix=" out))
|
||||||
configure-flags)))
|
configure-flags))
|
||||||
|
(python-version (get-python-version (assoc-ref inputs "python")))
|
||||||
|
(old-path (getenv "PYTHONPATH"))
|
||||||
|
(add-path (string-append out "/lib/python" python-version
|
||||||
|
"/site-packages/")))
|
||||||
|
;; create the module installation directory and add it to PYTHONPATH
|
||||||
|
;; to make setuptools happy
|
||||||
|
(mkdir-p add-path)
|
||||||
|
(setenv "PYTHONPATH"
|
||||||
|
(string-append (if old-path
|
||||||
|
(string-append old-path ":")
|
||||||
|
"")
|
||||||
|
add-path))
|
||||||
(call-setuppy "install" params)))
|
(call-setuppy "install" params)))
|
||||||
|
|
||||||
(define* (wrap #:key inputs outputs #:allow-other-keys)
|
(define* (wrap #:key inputs outputs #:allow-other-keys)
|
||||||
|
@ -79,10 +94,10 @@
|
||||||
|
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
(python (assoc-ref inputs "python"))
|
(python (assoc-ref inputs "python"))
|
||||||
(python-version (string-take (string-take-right python 5) 3))
|
|
||||||
(var `("PYTHONPATH" prefix
|
(var `("PYTHONPATH" prefix
|
||||||
,(cons (string-append out "/lib/python"
|
,(cons (string-append out "/lib/python"
|
||||||
python-version "/site-packages")
|
(get-python-version python)
|
||||||
|
"/site-packages")
|
||||||
(search-path-as-string->list
|
(search-path-as-string->list
|
||||||
(or (getenv "PYTHONPATH") ""))))))
|
(or (getenv "PYTHONPATH") ""))))))
|
||||||
(for-each (lambda (dir)
|
(for-each (lambda (dir)
|
||||||
|
|
Loading…
Reference in New Issue