gnu: python-wrapper: Refer to the target Python when cross-compiling.

Previously, "guix build python-wrapper --target=aarch64-linux-gnu" would
return a wrapper that symlinks the native programs (e.g., 'python3' for
x86_64-linux) instead of the target programs.

* gnu/packages/python.scm (wrap-python3)[arguments]: Use gexps.  Use
'this-package-input' to refer to Python when cross-compiling.
This commit is contained in:
Ludovic Courtès 2023-03-09 22:33:05 +01:00
parent ef893df92a
commit af916f3f8b
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -635,12 +635,20 @@ (define* (wrap-python3 python
(inputs `(("bash" ,bash)))
(propagated-inputs `(("python" ,python)))
(arguments
`(#:modules ((guix build utils))
(list #:modules '((guix build utils))
#:builder
(begin
#~(begin
(use-modules (guix build utils))
;; TODO: Remove 'assoc-ref' uses on next rebuild cycle.
(let ((bin (string-append (assoc-ref %outputs "out") "/bin"))
(python (string-append (assoc-ref %build-inputs "python") "/bin/")))
(python (string-append
;; XXX: '%build-inputs' contains the native
;; Python when cross-compiling.
#$(if (%current-target-system)
(this-package-input "python")
#~(assoc-ref %build-inputs "python"))
"/bin/")))
(mkdir-p bin)
(for-each
(lambda (old new)