Nikita Karetnikov nik...@karetnikov.org skribis:
If you append (package-native-search-paths python) to the list of search
paths, then PYTHONPATH will automagically be defined appropriately (see
http://lists.gnu.org/archive/html/bug-guix/2013-03/msg00158.html.)
If you don’t, then PYTHONPATH will be undefined, unless you explicitly
define it in build/python-build-system.scm, which is not the recommended
option.
So just mimic the change made in the above commit for perl-build-system.
OK, I've added it. Should I remove the following part?
+ (let* ((out (assoc-ref outputs out))
+ (var `(PYTHONPATH prefix
+(,(string-append out /lib/python
+ python-version /site-packages)
+(for-each (lambda (dir)
+(let ((files (list-of-files dir)))
+ (for-each (cut wrap-program var)
+files)))
+ bindirs)))
Or is it a different issue?
Yes, see below.
[...]
+(define* (python-build store name source inputs
+ #:key
+ (python (@ (gnu packages python) python))
+ (python-version
+(string-take (package-version
+ (@ (gnu packages python) python)) 3))
+ (tests? #t)
+ (configure-flags ''())
+ (phases '(@ (guix build python-build-system)
+ %standard-phases))
+ (outputs '(out))
+ (search-paths '())
+ (system (%current-system))
+ (guile #f)
+ (imported-modules '((guix build python-build-system)
+ (guix build gnu-build-system)
+ (guix build utils)))
+ (modules '((guix build python-build-system)
+ (guix build gnu-build-system)
+ (guix build utils
+ Build SOURCE using PYTHON, and with INPUTS. This assumes that SOURCE
+provides a 'setup.py' file as its build system.
+ (define python-search-paths
+(append (package-native-search-paths python)
+(standard-search-paths)))
+
+ (define builder
+`(begin
+ (use-modules ,@modules)
+ (python-build #:name ,name
+ #:source ,(if (and source (derivation-path? source))
+ (derivation-path-output-path source)
+ source)
+ #:configure-flags ,configure-flags
+ #:system ,system
+ #:test-target test
+ #:tests? ,tests?
+ #:outputs %outputs
+ #:python-version ,python-version
+ #:search-paths ',(map search-path-specification-sexp
+ (append python-search-paths
+ (standard-search-paths)))
Typo here. Should be:
(append python-search-paths search-paths)
Otherwise the ‘search-paths’ argument would not be honored.
[...]
+(define* (wrap #:key outputs python-version #:allow-other-keys)
+ (define (list-of-files dir)
+(map (cut string-append dir / )
+ (or (scandir dir (lambda (f)
+(let ((s (stat (string-append dir / f
+ (eq? 'regular (stat:type s)
+ '(
+
+ (define bindirs
+(append-map (match-lambda
+ ((_ . dir)
+ (list (string-append dir /bin)
+(string-append dir /sbin
+outputs))
+
+ (let* ((out (assoc-ref outputs out))
+ (var `(PYTHONPATH prefix
+(,(string-append out /lib/python
+ python-version /site-packages)
We also need to account for extra Python modules the package depends on:
(let* (...
(var `(PYTHONPATH prefix
,(cons (string-append out /lib/python
python-version /site-packages)
(search-path-as-string-list
(or (getenv PYTHONPATH) )
...)
To answer your previous question, this ‘wrap’ phase serves a different
(but related) purpose than the ‘native-search-paths’ thing: it ensures
that the ‘bzr’ program, when run by the user, finds all its Python
modules.
[...]
+(define-public bazaar
+ (package
+(name bazaar)
+(version 2.5.1)
+(source
+ (origin
+ (method url-fetch)
+ (uri (string-append https://launchpad.net/bzr/2.5/; version
+ /+download/bzr- version .tar.gz))
+ (sha256
+ (base32
+