at 22.05-pre 1.8 kB view raw
1# Setup hook for setuptools. 2echo "Sourcing setuptools-build-hook" 3 4setuptoolsBuildPhase() { 5 echo "Executing setuptoolsBuildPhase" 6 local args 7 runHook preBuild 8 9 cp -f @setuppy@ nix_run_setup 10 args="" 11 if [ -n "$setupPyGlobalFlags" ]; then 12 args+="$setupPyGlobalFlags" 13 fi 14 if [ -n "$setupPyBuildFlags" ]; then 15 args+="build_ext $setupPyBuildFlags" 16 fi 17 eval "@pythonInterpreter@ nix_run_setup $args bdist_wheel" 18 19 runHook postBuild 20 echo "Finished executing setuptoolsBuildPhase" 21} 22 23setuptoolsShellHook() { 24 echo "Executing setuptoolsShellHook" 25 runHook preShellHook 26 27 if test -e setup.py; then 28 tmp_path=$(mktemp -d) 29 export PATH="$tmp_path/bin:$PATH" 30 export PYTHONPATH="$tmp_path/@pythonSitePackages@:$PYTHONPATH" 31 mkdir -p "$tmp_path/@pythonSitePackages@" 32 eval "@pythonInterpreter@ -m pip install -e . --prefix $tmp_path \ 33 --no-build-isolation >&2" 34 35 # Process pth file installed in tmp path. This allows one to 36 # actually import the editable installation. Note site.addsitedir 37 # appends, not prepends, new paths. Hence, it is not possible to override 38 # an existing installation of the package. 39 # https://github.com/pypa/setuptools/issues/2612 40 export NIX_PYTHONPATH="$tmp_path/@pythonSitePackages@:${NIX_PYTHONPATH-}" 41 fi 42 43 runHook postShellHook 44 echo "Finished executing setuptoolsShellHook" 45} 46 47if [ -z "${dontUseSetuptoolsBuild-}" ] && [ -z "${buildPhase-}" ]; then 48 echo "Using setuptoolsBuildPhase" 49 buildPhase=setuptoolsBuildPhase 50fi 51 52if [ -z "${dontUseSetuptoolsShellHook-}" ] && [ -z "${shellHook-}" ]; then 53 echo "Using setuptoolsShellHook" 54 shellHook=setuptoolsShellHook 55fi