nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1# Setup hook to use for pip projects
2echo "Sourcing pip-build-hook"
3
4pipBuildPhase() {
5 echo "Executing pipBuildPhase"
6 runHook preBuild
7
8 mkdir -p dist
9 echo "Creating a wheel..."
10 @pythonInterpreter@ -m pip wheel --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist .
11 echo "Finished creating a wheel..."
12
13 runHook postBuild
14 echo "Finished executing pipBuildPhase"
15}
16
17pipShellHook() {
18 echo "Executing pipShellHook"
19 runHook preShellHook
20
21 # Long-term setup.py should be dropped.
22 if [ -e pyproject.toml ]; then
23 tmp_path=$(mktemp -d)
24 export PATH="$tmp_path/bin:$PATH"
25 export PYTHONPATH="$tmp_path/@pythonSitePackages@:$PYTHONPATH"
26 mkdir -p "$tmp_path/@pythonSitePackages@"
27 @pythonInterpreter@ -m pip install -e . --prefix "$tmp_path" >&2
28 fi
29
30 runHook postShellHook
31 echo "Finished executing pipShellHook"
32}
33
34if [ -z "${dontUsePipBuild-}" ] && [ -z "${buildPhase-}" ]; then
35 echo "Using pipBuildPhase"
36 buildPhase=pipBuildPhase
37fi
38
39if [ -z "${shellHook-}" ]; then
40 echo "Using pipShellHook"
41 shellHook=pipShellHook
42fi