nixpkgs/pkgs/development/interpreters/python/build-python-package-common.nix

32 lines
759 B
Nix
Raw Normal View History

2016-12-03 12:04:52 +00:00
# This function provides generic bits to install a Python wheel.
{ python
}:
{ buildInputs ? []
# Additional flags to pass to "pip install".
, installFlags ? []
, ... } @ attrs:
attrs // {
buildInputs = buildInputs ++ [ python.pythonForBuild.pkgs.bootstrapped-pip ];
2016-12-03 12:04:52 +00:00
configurePhase = attrs.configurePhase or ''
runHook preConfigure
runHook postConfigure
'';
2016-12-03 12:04:52 +00:00
installPhase = attrs.installPhase or ''
runHook preInstall
mkdir -p "$out/${python.sitePackages}"
export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
pushd dist
${python.pythonForBuild.pkgs.bootstrapped-pip}/bin/pip install *.whl --no-index --prefix=$out --no-cache ${toString installFlags} --build tmpbuild
2016-12-03 12:04:52 +00:00
popd
runHook postInstall
'';
}