python/hooks/setuptools-build-hook.sh: use `--parallel` flag only for fresh setuptools
Without the change attempt to enable parallelist for `python2` packages fails with unsupported `--parallel` flag for `setuptools`-based packages: $ nix build --no-link -f. --arg config '{enableParallelBuildingByDefault = true;}' xdg-utils error: builder for '/nix/store/...-python2.7-setuptools-44.0.0.drv' failed with exit code 1; last 10 log lines: > no configure script, doing nothing > Running phase: buildPhase > Executing setuptoolsBuildPhase > usage: nix_run_setup [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] > or: nix_run_setup --help [cmd1 cmd2 ...] > or: nix_run_setup --help-commands > or: nix_run_setup cmd --help > > error: option --parallel not recognized
This commit is contained in:
parent
f904a6b3b5
commit
187ac583a0
|
@ -195,6 +195,8 @@ in {
|
|||
propagatedBuildInputs = [ setuptools wheel ];
|
||||
substitutions = {
|
||||
inherit pythonInterpreter setuppy;
|
||||
# python2.pkgs.setuptools does not support parallelism
|
||||
setuptools_has_parallel = setuptools != null && lib.versionAtLeast setuptools.version "69";
|
||||
};
|
||||
} ./setuptools-build-hook.sh) {};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ echo "Sourcing setuptools-build-hook"
|
|||
|
||||
setuptoolsBuildPhase() {
|
||||
echo "Executing setuptoolsBuildPhase"
|
||||
local args
|
||||
local args setuptools_has_parallel=@setuptools_has_parallel@
|
||||
runHook preBuild
|
||||
|
||||
cp -f @setuppy@ nix_run_setup
|
||||
|
@ -12,7 +12,9 @@ setuptoolsBuildPhase() {
|
|||
args+="$setupPyGlobalFlags"
|
||||
fi
|
||||
if [ -n "$enableParallelBuilding" ]; then
|
||||
setupPyBuildFlags+=" --parallel $NIX_BUILD_CORES"
|
||||
if [ -n "$setuptools_has_parallel" ]; then
|
||||
setupPyBuildFlags+=" --parallel $NIX_BUILD_CORES"
|
||||
fi
|
||||
fi
|
||||
if [ -n "$setupPyBuildFlags" ]; then
|
||||
args+=" build_ext $setupPyBuildFlags"
|
||||
|
|
Loading…
Reference in New Issue