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.master
parent
ef893df92a
commit
af916f3f8b
|
@ -635,30 +635,38 @@ for more information.")))
|
||||||
(inputs `(("bash" ,bash)))
|
(inputs `(("bash" ,bash)))
|
||||||
(propagated-inputs `(("python" ,python)))
|
(propagated-inputs `(("python" ,python)))
|
||||||
(arguments
|
(arguments
|
||||||
`(#:modules ((guix build utils))
|
(list #:modules '((guix build utils))
|
||||||
#:builder
|
#:builder
|
||||||
(begin
|
#~(begin
|
||||||
(use-modules (guix build utils))
|
(use-modules (guix build utils))
|
||||||
(let ((bin (string-append (assoc-ref %outputs "out") "/bin"))
|
|
||||||
(python (string-append (assoc-ref %build-inputs "python") "/bin/")))
|
;; TODO: Remove 'assoc-ref' uses on next rebuild cycle.
|
||||||
(mkdir-p bin)
|
(let ((bin (string-append (assoc-ref %outputs "out") "/bin"))
|
||||||
(for-each
|
(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)
|
(lambda (old new)
|
||||||
(symlink (string-append python old)
|
(symlink (string-append python old)
|
||||||
(string-append bin "/" new)))
|
(string-append bin "/" new)))
|
||||||
`("python3" ,"pydoc3" ,"pip3")
|
`("python3" ,"pydoc3" ,"pip3")
|
||||||
`("python" ,"pydoc" ,"pip"))
|
`("python" ,"pydoc" ,"pip"))
|
||||||
;; python-config outputs search paths based upon its location,
|
;; python-config outputs search paths based upon its location,
|
||||||
;; use a bash wrapper to avoid changing its outputs.
|
;; use a bash wrapper to avoid changing its outputs.
|
||||||
(let ((bash (string-append (assoc-ref %build-inputs "bash")
|
(let ((bash (string-append (assoc-ref %build-inputs "bash")
|
||||||
"/bin/bash"))
|
"/bin/bash"))
|
||||||
(old (string-append python "python3-config"))
|
(old (string-append python "python3-config"))
|
||||||
(new (string-append bin "/python-config")))
|
(new (string-append bin "/python-config")))
|
||||||
(with-output-to-file new
|
(with-output-to-file new
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(format #t "#!~a~%" bash)
|
(format #t "#!~a~%" bash)
|
||||||
(format #t "exec \"~a\" \"$@\"~%" old)
|
(format #t "exec \"~a\" \"$@\"~%" old)
|
||||||
(chmod new #o755))))))))
|
(chmod new #o755))))))))
|
||||||
(synopsis "Wrapper for the Python 3 commands")
|
(synopsis "Wrapper for the Python 3 commands")
|
||||||
(description
|
(description
|
||||||
"This package provides wrappers for the commands of Python@tie{}3.x such
|
"This package provides wrappers for the commands of Python@tie{}3.x such
|
||||||
|
|
Reference in New Issue