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.
This commit is contained in:
Frederik Rietdijk
2019-01-02 20:09:44 +01:00
parent 613498af97
commit f665828fa3
14 changed files with 68 additions and 41 deletions

View File

@@ -1,7 +1,6 @@
# This function provides generic bits to install a Python wheel.
{ python
, bootstrapped-pip
}:
{ buildInputs ? []
@@ -10,7 +9,7 @@
, ... } @ attrs:
attrs // {
buildInputs = buildInputs ++ [ bootstrapped-pip ];
buildInputs = buildInputs ++ [ python.pythonForBuild.pkgs.bootstrapped-pip ];
configurePhase = attrs.configurePhase or ''
runHook preConfigure
@@ -24,7 +23,7 @@ attrs // {
export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
pushd dist
${bootstrapped-pip}/bin/pip install *.whl --no-index --prefix=$out --no-cache ${toString installFlags} --build tmpbuild
${python.pythonForBuild.pkgs.bootstrapped-pip}/bin/pip install *.whl --no-index --prefix=$out --no-cache ${toString installFlags} --build tmpbuild
popd
runHook postInstall