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