summaryrefslogtreecommitdiff
path: root/gnu/packages/python.scm
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2019-06-29 17:31:07 +0200
committerMathieu Othacehe <m.othacehe@gmail.com>2019-09-24 08:12:54 +0200
commitceb9de75a6b39fd5df585418953d937361237202 (patch)
tree7dc63ea91aed54380d8bc1f67cbfdf9100095c9d /gnu/packages/python.scm
parentd7c53647323963ec656852a5b967f3e3792b99c3 (diff)
downloadguix-patches-ceb9de75a6b39fd5df585418953d937361237202.tar
guix-patches-ceb9de75a6b39fd5df585418953d937361237202.tar.gz
gnu: python: Further cross-compilation fixes.
* gnu/packages/patches/python-2.7-search-paths.patch: Add cross-compilation support. * gnu/packages/patches/python-3-search-paths.patch: Ditto. * gnu/packages/patches/python-cross-compile.patch: New patch. * gnu/local.mk (dist_patch_DATA): Add above new patch. * gnu/packages/python.scm (python-2.7)[patches]: Add new patch above, [arguments]: Set _PYTHON_HOST_PLATFORM env variable when cross compiling.
Diffstat (limited to 'gnu/packages/python.scm')
-rw-r--r--gnu/packages/python.scm23
1 files changed, 18 insertions, 5 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index b7a664271b..504a468bab 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -109,7 +109,8 @@
"python-2-deterministic-build-info.patch"
"python-2.7-site-prefixes.patch"
"python-2.7-source-date-epoch.patch"
- "python-2.7-adjust-tests.patch"))
+ "python-2.7-adjust-tests.patch"
+ "python-cross-compile.patch"))
(modules '((guix build utils)))
(snippet
'(begin
@@ -177,6 +178,12 @@
(add-before
'configure 'patch-lib-shells
(lambda _
+ ;; This variable is used in setup.py to enable cross compilation
+ ;; specific switches. As it is not set properly by configure
+ ;; script, set it manually.
+ ,@(if (%current-target-system)
+ '((setenv "_PYTHON_HOST_PLATFORM" ""))
+ '())
;; Filter for existing files, since some may not exist in all
;; versions of python that are built with this recipe.
(substitute* (filter file-exists?
@@ -256,7 +263,9 @@
(if (null? opt) "none" (car opt)))
(for-each (lambda (file)
(apply invoke
- `(,(string-append out "/bin/python")
+ `(,,(if (%current-target-system)
+ "python2"
+ '(string-append out "/bin/python"))
,@opt
"-m" "compileall"
"-f" ; force rebuild
@@ -302,7 +311,7 @@
`(("pkg-config" ,pkg-config)
;; When cross-compiling, a native version of Python itself is needed.
,@(if (%current-target-system)
- `(("self" ,this-package)
+ `(("python2" ,this-package)
("which" ,which))
'())))
(native-search-paths
@@ -376,10 +385,11 @@ data types.")
((#:phases phases)
`(modify-phases ,phases
(add-before 'check 'set-TZDIR
- (lambda* (#:key inputs #:allow-other-keys)
+ (lambda* (#:key inputs native-inputs #:allow-other-keys)
;; test_email requires the Olson time zone database.
(setenv "TZDIR"
- (string-append (assoc-ref inputs "tzdata")
+ (string-append (assoc-ref
+ (or native-inputs inputs) "tzdata")
"/share/zoneinfo"))
#t))
;; Unset SOURCE_DATE_EPOCH while running the test-suite and set it
@@ -415,6 +425,9 @@ data types.")
#t)))))))
(native-inputs
`(("tzdata" ,tzdata-for-tests)
+ ,@(if (%current-target-system)
+ `(("python3" ,this-package))
+ '())
,@(package-native-inputs python-2)))
(native-search-paths
(list (search-path-specification