treewide: handle preDistPhases __structuredAttrs-agnostically

Always specify the preDistPhases attribute as a list instead of a string.

Append elements to the preDistPhases Bash variable using appendToVar
instead of string or Bash array concatenation.

Handle element insertion before a specific element using string
substitution as before, but handle both structured and unstructured
attributes.

Changed files
+40 -26
pkgs
+1 -1
pkgs/applications/editors/vim/plugins/neovim-require-check-hook.sh
···
}
echo "Using neovimRequireCheckHook"
-
preDistPhases+=" neovimRequireCheckHook"
+
appendToVar preDistPhases neovimRequireCheckHook
+1 -1
pkgs/applications/editors/vim/plugins/vim-command-check-hook.sh
···
}
echo "Using vimCommandCheckHook"
-
preDistPhases+=" vimCommandCheckHook"
+
appendToVar preDistPhases vimCommandCheckHook
+1 -1
pkgs/build-support/make-darwin-bundle/default.nix
···
${writeDarwinBundle}/bin/write-darwin-bundle "''${!outputBin}" "${name}" "${exec}"
}
-
preDistPhases+=" makeDarwinBundlePhase"
+
appendToVar preDistPhases makeDarwinBundlePhase
'')
+1 -1
pkgs/development/interpreters/octave/hooks/octave-write-required-octave-packages-hook.sh
···
# Yes its a bit long...
if [ -z "${dontWriteRequiredOctavePackagesPhase-}" ]; then
echo "Using octaveWriteRequiredOctavePackagesPhase"
-
preDistPhases+=" octaveWriteRequiredOctavePackagesPhase"
+
appendToVar preDistPhases octaveWriteRequiredOctavePackagesPhase
fi
+1 -1
pkgs/development/interpreters/octave/hooks/write-required-octave-packages-hook.sh
···
# Yes its a bit long...
if [ -z "${dontWriteRequiredOctavePackagesPhase-}" ]; then
echo "Using writeRequiredOctavePackagesPhase"
-
preDistPhases+=" writeRequiredOctavePackagesPhase"
+
appendToVar preDistPhases writeRequiredOctavePackagesPhase
fi
+1 -1
pkgs/development/interpreters/python/hooks/pytest-check-hook.sh
···
if [ -z "${dontUsePytestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
echo "Using pytestCheckPhase"
-
preDistPhases+=" pytestCheckPhase"
+
appendToVar preDistPhases pytestCheckPhase
fi
+1 -1
pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh
···
}
if [ -z "${dontUsePythonCatchConflicts-}" ]; then
-
preDistPhases+=" pythonCatchConflictsPhase"
+
appendToVar preDistPhases pythonCatchConflictsPhase
fi
+1 -1
pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh
···
if [ -z "${dontUsePythonImportsCheck-}" ]; then
echo "Using pythonImportsCheckPhase"
-
preDistPhases+=" pythonImportsCheckPhase"
+
appendToVar preDistPhases pythonImportsCheckPhase
fi
+1 -1
pkgs/development/interpreters/python/hooks/python-remove-bin-bytecode-hook.sh
···
}
if [ -z "${dontUsePythonRemoveBinBytecode-}" ]; then
-
preDistPhases+=" pythonRemoveBinBytecodePhase"
+
appendToVar preDistPhases pythonRemoveBinBytecodePhase
fi
+1 -1
pkgs/development/interpreters/python/hooks/sphinx-hook.sh
···
runHook postInstallSphinx
}
-
preDistPhases+=" buildSphinxPhase installSphinxPhase"
+
appendToVar preDistPhases buildSphinxPhase installSphinxPhase
+1 -1
pkgs/development/interpreters/python/hooks/unittest-check-hook.sh
···
if [ -z "${dontUseUnittestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
echo "Using unittestCheckPhase"
-
preDistPhases+=" unittestCheckPhase"
+
appendToVar preDistPhases unittestCheckPhase
fi
+11 -4
pkgs/development/python-modules/pytest-forked/setup-hook.sh
···
# until we have dependency mechanism in generic builder, we need to use this ugly hack.
if [ -z "${dontUsePytestForked-}" ] && [ -z "${dontUsePytestCheck-}" ]; then
-
if [[ " ${preDistPhases:-} " =~ " pytestCheckPhase " ]]; then
-
preDistPhases+=" "
-
preDistPhases="${preDistPhases/ pytestCheckPhase / pytestForkedHook pytestCheckPhase }"
+
if [[ " ${preDistPhases[*]:-} " =~ " pytestCheckPhase " ]]; then
+
_preDistPhases="${preDistPhases[*]} "
+
_preDistPhases="${_preDistPhases/ pytestCheckPhase / pytestForkedHook pytestCheckPhase }"
+
if [[ -n "${__structuredAttrs-}" ]]; then
+
preDistPhases=()
+
else
+
preDistPhases=""
+
fi
+
appendToVar preDistPhases $_preDistPhases
+
unset _preDistPhases
else
-
preDistPhases+=" pytestForkedHook"
+
appendToVar preDistPhases pytestForkedHook
fi
fi
+11 -4
pkgs/development/python-modules/pytest-xdist/setup-hook.sh
···
# until we have dependency mechanism in generic builder, we need to use this ugly hack.
if [ -z "${dontUsePytestXdist-}" ] && [ -z "${dontUsePytestCheck-}" ]; then
-
if [[ " ${preDistPhases:-} " =~ " pytestCheckPhase " ]]; then
-
preDistPhases+=" "
-
preDistPhases="${preDistPhases/ pytestCheckPhase / pytestXdistHook pytestCheckPhase }"
+
if [[ " ${preDistPhases[*]:-} " =~ " pytestCheckPhase " ]]; then
+
_preDistPhases="${preDistPhases[*]} "
+
_preDistPhases="${_preDistPhases/ pytestCheckPhase / pytestXdistHook pytestCheckPhase }"
+
if [[ -n "${__structuredAttrs-}" ]]; then
+
preDistPhases=()
+
else
+
preDistPhases=""
+
fi
+
appendToVar preDistPhases $_preDistPhases
+
unset _preDistPhases
else
-
preDistPhases+=" pytestXdistHook"
+
appendToVar preDistPhases pytestXdistHook
fi
fi
+2 -2
pkgs/development/python-modules/pytest/7.nix
···
pytestcachePhase() {
find $out -name .pytest_cache -type d -exec rm -rf {} +
}
-
preDistPhases+=" pytestcachePhase"
+
appendToVar preDistPhases pytestcachePhase
# pytest generates it's own bytecode files to improve assertion messages.
# These files similar to cpython's bytecode files but are never laoded
···
# https://github.com/pytest-dev/pytest/blob/7.2.1/src/_pytest/assertion/rewrite.py#L51-L53
find $out -name "*-pytest-*.py[co]" -delete
}
-
preDistPhases+=" pytestRemoveBytecodePhase"
+
appendToVar preDistPhases pytestRemoveBytecodePhase
'';
pythonImportsCheck = [ "pytest" ];
+2 -2
pkgs/development/python-modules/pytest/default.nix
···
pytestcachePhase() {
find $out -name .pytest_cache -type d -exec rm -rf {} +
}
-
preDistPhases+=" pytestcachePhase"
+
appendToVar preDistPhases pytestcachePhase
# pytest generates it's own bytecode files to improve assertion messages.
# These files similar to cpython's bytecode files but are never laoded
···
# https://github.com/pytest-dev/pytest/blob/7.2.1/src/_pytest/assertion/rewrite.py#L51-L53
find $out -name "*-pytest-*.py[co]" -delete
}
-
preDistPhases+=" pytestRemoveBytecodePhase"
+
appendToVar preDistPhases pytestRemoveBytecodePhase
'';
pythonImportsCheck = [ "pytest" ];
+2 -2
pkgs/development/python2-modules/pytest/default.nix
···
find $out -name .pytest_cache -type d -exec rm -rf {} +
}
-
preDistPhases+=" pytestcachePhase"
+
appendToVar preDistPhases pytestcachePhase
# pytest generates it's own bytecode files to improve assertion messages.
# These files similar to cpython's bytecode files but are never laoded
···
# https://github.com/pytest-dev/pytest/blob/4.6.11/src/_pytest/assertion/rewrite.py#L32-L47
find $out -name "*-PYTEST.py[co]" -delete
}
-
preDistPhases+=" pytestRemoveBytecodePhase"
+
appendToVar preDistPhases pytestRemoveBytecodePhase
'';
meta = with lib; {
+1 -1
pkgs/servers/home-assistant/build-custom-component/manifest-requirements-check-hook.sh
···
if [ -z "${dontCheckManifest-}" ] && [ -z "${installCheckPhase-}" ]; then
echo "Using manifestCheckPhase"
-
preDistPhases+=" manifestCheckPhase"
+
appendToVar preDistPhases manifestCheckPhase
fi