diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2019-01-02 20:09:44 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2019-01-04 10:45:22 +0100 |
commit | f665828fa374580f4b2fd725761d23e18f55e526 (patch) | |
tree | 3bae5444b8a2fdec44f7cf41656c6b2e9a9c9b32 /pkgs/development/interpreters/python/mk-python-derivation.nix | |
parent | 613498af978d65a7497cdd0dfd4f15c834348c61 (diff) |
Python: improve cross-compilation
This changeset allows for cross-compilation of Python packages. Packages built with buildPythonPackage are not allowed to refer to the build machine. Executables that have shebangs will refer to the host.
Diffstat (limited to 'pkgs/development/interpreters/python/mk-python-derivation.nix')
-rw-r--r-- | pkgs/development/interpreters/python/mk-python-derivation.nix | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index b9a6835908f95..7718bdfde5d34 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -77,7 +77,7 @@ let self = toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attr buildInputs = [ wrapPython ] ++ lib.optional (lib.hasSuffix "zip" (attrs.src.name or "")) unzip - ++ lib.optional catchConflicts setuptools # If we no longer propagate setuptools +# ++ lib.optional catchConflicts setuptools # If we no longer propagate setuptools ++ buildInputs ++ pythonPath; @@ -100,9 +100,12 @@ let self = toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attr # Check if we have two packages with the same name in the closure and fail. # If this happens, something went wrong with the dependencies specs. # Intentionally kept in a subdirectory, see catch_conflicts/README.md. - ${python.interpreter} ${./catch_conflicts}/catch_conflicts.py + ${python.pythonForBuild.interpreter} ${./catch_conflicts}/catch_conflicts.py '' + attrs.postFixup or ''''; + # Python packages built through cross-compilation are always for the host platform. + disallowedReferences = lib.optionals (python.stdenv.hostPlatform != python.stdenv.buildPlatform) [ python.pythonForBuild ]; + meta = { # default to python's platforms platforms = python.meta.platforms; |