mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-21 13:13:33 +00:00
27 lines
602 B
Nix
27 lines
602 B
Nix
|
# This function provides generic bits to install a Python wheel.
|
||
|
|
||
|
{ python
|
||
|
, bootstrapped-pip
|
||
|
}:
|
||
|
|
||
|
{ buildInputs ? []
|
||
|
# Additional flags to pass to "pip install".
|
||
|
, installFlags ? []
|
||
|
, ... } @ attrs:
|
||
|
|
||
|
attrs // {
|
||
|
buildInputs = buildInputs ++ [ bootstrapped-pip ];
|
||
|
|
||
|
installPhase = attrs.installPhase or ''
|
||
|
runHook preInstall
|
||
|
|
||
|
mkdir -p "$out/${python.sitePackages}"
|
||
|
export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
|
||
|
|
||
|
pushd dist
|
||
|
${bootstrapped-pip}/bin/pip install *.whl --no-index --prefix=$out --no-cache ${toString installFlags}
|
||
|
popd
|
||
|
|
||
|
runHook postInstall
|
||
|
'';
|
||
|
}
|