1# Setup hook for pip.
2# shellcheck shell=bash
3
4echo "Sourcing pip-install-hook"
5
6pipInstallPhase() {
7 echo "Executing pipInstallPhase"
8 runHook preInstall
9
10 # shellcheck disable=SC2154
11 mkdir -p "$out/@pythonSitePackages@"
12 export PYTHONPATH="$out/@pythonSitePackages@:$PYTHONPATH"
13
14 local -a flagsArray=(
15 --no-index
16 --no-warn-script-location
17 --prefix="$out"
18 --no-cache
19 )
20 concatTo flagsArray pipInstallFlags
21
22 pushd dist || return 1
23 echoCmd 'pip install flags' "${flagsArray[@]}"
24 @pythonInterpreter@ -m pip install ./*.whl "${flagsArray[@]}"
25 popd || return 1
26
27 runHook postInstall
28 echo "Finished executing pipInstallPhase"
29}
30
31if [ -z "${dontUsePipInstall-}" ] && [ -z "${installPhase-}" ]; then
32 echo "Using pipInstallPhase"
33 installPhase=pipInstallPhase
34fi