at 24.05-pre 58 lines 1.9 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 "$enableParallelBuilding" ]; then 15 setupPyBuildFlags+=" --parallel $NIX_BUILD_CORES" 16 fi 17 if [ -n "$setupPyBuildFlags" ]; then 18 args+=" build_ext $setupPyBuildFlags" 19 fi 20 eval "@pythonInterpreter@ nix_run_setup $args bdist_wheel" 21 22 runHook postBuild 23 echo "Finished executing setuptoolsBuildPhase" 24} 25 26setuptoolsShellHook() { 27 echo "Executing setuptoolsShellHook" 28 runHook preShellHook 29 30 if test -e setup.py; then 31 tmp_path=$(mktemp -d) 32 export PATH="$tmp_path/bin:$PATH" 33 export PYTHONPATH="$tmp_path/@pythonSitePackages@:$PYTHONPATH" 34 mkdir -p "$tmp_path/@pythonSitePackages@" 35 eval "@pythonInterpreter@ -m pip install -e . --prefix $tmp_path \ 36 --no-build-isolation >&2" 37 38 # Process pth file installed in tmp path. This allows one to 39 # actually import the editable installation. Note site.addsitedir 40 # appends, not prepends, new paths. Hence, it is not possible to override 41 # an existing installation of the package. 42 # https://github.com/pypa/setuptools/issues/2612 43 export NIX_PYTHONPATH="$tmp_path/@pythonSitePackages@:${NIX_PYTHONPATH-}" 44 fi 45 46 runHook postShellHook 47 echo "Finished executing setuptoolsShellHook" 48} 49 50if [ -z "${dontUseSetuptoolsBuild-}" ] && [ -z "${buildPhase-}" ]; then 51 echo "Using setuptoolsBuildPhase" 52 buildPhase=setuptoolsBuildPhase 53fi 54 55if [ -z "${dontUseSetuptoolsShellHook-}" ] && [ -z "${shellHook-}" ]; then 56 echo "Using setuptoolsShellHook" 57 shellHook=setuptoolsShellHook 58fi