1# This function provides generic bits to install a Python wheel.
2
3{ python
4}:
5
6{ buildInputs ? []
7# Additional flags to pass to "pip install".
8, installFlags ? []
9, ... } @ attrs:
10
11attrs // {
12 buildInputs = buildInputs ++ [ python.pythonForBuild.pkgs.bootstrapped-pip ];
13
14 configurePhase = attrs.configurePhase or ''
15 runHook preConfigure
16 runHook postConfigure
17 '';
18
19 installPhase = attrs.installPhase or ''
20 runHook preInstall
21
22 mkdir -p "$out/${python.sitePackages}"
23 export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
24
25 pushd dist
26 ${python.pythonForBuild.pkgs.bootstrapped-pip}/bin/pip install *.whl --no-index --prefix=$out --no-cache ${toString installFlags} --build tmpbuild
27 popd
28
29 runHook postInstall
30 '';
31}