gnu: 389-ds-base: Wrap with GUIX_PYTHONPATH.

* gnu/packages/openldap.scm (389-ds-base): Remove trailing #t.  Do not alter
PYTHONPATH.  Wrap with GUIX_PYTHONPATH.
This commit is contained in:
Maxim Cournoyer 2021-01-27 17:20:30 -05:00
parent fa5673b013
commit df76386b12
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -7,6 +7,7 @@
;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2020 Lars-Dominik Braun <ldb@leibniz-psychology.org> ;;; Copyright © 2020 Lars-Dominik Braun <ldb@leibniz-psychology.org>
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -228,7 +229,7 @@ (define-public 389-ds-base
`(#:modules ((srfi srfi-1) `(#:modules ((srfi srfi-1)
(guix build gnu-build-system) (guix build gnu-build-system)
((guix build python-build-system) ((guix build python-build-system)
#:select (python-version)) #:select (add-installed-pythonpath))
(guix build utils)) (guix build utils))
#:imported-modules ((guix build python-build-system) #:imported-modules ((guix build python-build-system)
,@%gnu-build-system-modules) ,@%gnu-build-system-modules)
@ -259,8 +260,8 @@ (define-public 389-ds-base
(("'/usr/bin/certutil'") (("'/usr/bin/certutil'")
(string-append "'" (which "certutil") "'")) (string-append "'" (which "certutil") "'"))
(("'/usr/bin/c_rehash'") (("'/usr/bin/c_rehash'")
(string-append "'" (which "perl") "', '" (which "c_rehash") "'"))) (string-append "'" (which "perl") "', '"
#t)) (which "c_rehash") "'")))))
(add-after 'unpack 'overwrite-default-locations (add-after 'unpack 'overwrite-default-locations
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))) (let ((out (assoc-ref outputs "out")))
@ -278,28 +279,21 @@ (define-public 389-ds-base
(substitute* '("src/lib389/lib389/instance/setup.py" (substitute* '("src/lib389/lib389/instance/setup.py"
"src/lib389/lib389/instance/remove.py") "src/lib389/lib389/instance/remove.py")
(("etc_dirsrv_path = .*") (("etc_dirsrv_path = .*")
"etc_dirsrv_path = '/etc/dirsrv/'\n")) "etc_dirsrv_path = '/etc/dirsrv/'\n")))))
#t)))
(add-after 'unpack 'fix-install-location-of-python-tools (add-after 'unpack 'fix-install-location-of-python-tools
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out")))
(pythondir (string-append
out "/lib/python"
(python-version (assoc-ref inputs "python"))
"/site-packages/")))
;; Install directory must be on PYTHONPATH. ;; Install directory must be on PYTHONPATH.
(setenv "PYTHONPATH" (add-installed-pythonpath inputs outputs)
(string-append (getenv "PYTHONPATH")
":" pythondir))
;; Install directory must exist. ;; Install directory must exist.
(mkdir-p pythondir) (mkdir-p pythondir)
(substitute* "src/lib389/setup.py" (substitute* "src/lib389/setup.py"
(("/usr") out)) (("/usr") out))
(substitute* "Makefile.am" (substitute* "Makefile.am"
(("setup.py install --skip-build" m) (("setup.py install --skip-build" m)
(string-append m " --prefix=" out (string-append
" --root=/ --single-version-externally-managed")))) m " --prefix=" out
#t)) " --root=/ --single-version-externally-managed"))))))
(add-after 'build 'build-python-tools (add-after 'build 'build-python-tools
(lambda* (#:key make-flags #:allow-other-keys) (lambda* (#:key make-flags #:allow-other-keys)
;; Set DETERMINISTIC_BUILD to override the embedded mtime in pyc ;; Set DETERMINISTIC_BUILD to override the embedded mtime in pyc
@ -308,27 +302,24 @@ (define-public 389-ds-base
;; Use deterministic hashes for strings, bytes, and datetime ;; Use deterministic hashes for strings, bytes, and datetime
;; objects. ;; objects.
(setenv "PYTHONHASHSEED" "0") (setenv "PYTHONHASHSEED" "0")
(apply invoke "make" "lib389" make-flags) (apply invoke "make" "lib389" make-flags)))
#t))
(add-after 'install 'install-python-tools (add-after 'install 'install-python-tools
(lambda* (#:key make-flags #:allow-other-keys) (lambda* (#:key make-flags #:allow-other-keys)
(apply invoke "make" "lib389-install" make-flags) (apply invoke "make" "lib389-install" make-flags)))
#t))
(add-after 'install-python-tools 'wrap-python-tools (add-after 'install-python-tools 'wrap-python-tools
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(path (getenv "PYTHONPATH"))) (pythonpath (getenv "GUIX_PYTHONPATH")))
(for-each (lambda (file) (for-each (lambda (file)
(wrap-program (string-append out file) (wrap-program (string-append out file)
`("PYTHONPATH" ":" prefix (,path)))) `("GUIX_PYTHONPATH" ":" prefix (,pythonpath))))
'("/sbin/dsconf" '("/sbin/dsconf"
"/sbin/dscreate" "/sbin/dscreate"
"/sbin/dsctl" "/sbin/dsctl"
"/sbin/dsidm" "/sbin/dsidm"
"/bin/ds-logpipe.py" "/bin/ds-logpipe.py"
"/bin/ds-replcheck" "/bin/ds-replcheck"
"/bin/readnsstate"))) "/bin/readnsstate"))))))))
#t)))))
(inputs (inputs
`(("bdb" ,bdb) `(("bdb" ,bdb)
("cracklib" ,cracklib) ("cracklib" ,cracklib)
@ -343,7 +334,7 @@ (define-public 389-ds-base
("net-snmp" ,net-snmp) ("net-snmp" ,net-snmp)
("nspr" ,nspr) ("nspr" ,nspr)
("nss" ,nss) ("nss" ,nss)
("nss:bin" ,nss "bin") ; for certutil ("nss:bin" ,nss "bin") ; for certutil
("openldap" ,openldap) ("openldap" ,openldap)
("openssl" ,openssl) ; #included by net-snmp ("openssl" ,openssl) ; #included by net-snmp
("pcre" ,pcre) ("pcre" ,pcre)