mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 14:32:59 +00:00
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.
This commit is contained in:
parent
385d523a8e
commit
054c5f0e10
@ -16,6 +16,6 @@ neovimRequireCheckHook () {
|
||||
}
|
||||
|
||||
echo "Using neovimRequireCheckHook"
|
||||
preDistPhases+=" neovimRequireCheckHook"
|
||||
appendToVar preDistPhases neovimRequireCheckHook
|
||||
|
||||
|
||||
|
@ -21,5 +21,5 @@ vimCommandCheckHook () {
|
||||
}
|
||||
|
||||
echo "Using vimCommandCheckHook"
|
||||
preDistPhases+=" vimCommandCheckHook"
|
||||
appendToVar preDistPhases vimCommandCheckHook
|
||||
|
||||
|
@ -22,5 +22,5 @@ writeShellScript "make-darwin-bundle-${name}" (''
|
||||
${writeDarwinBundle}/bin/write-darwin-bundle "''${!outputBin}" "${name}" "${exec}"
|
||||
}
|
||||
|
||||
preDistPhases+=" makeDarwinBundlePhase"
|
||||
appendToVar preDistPhases makeDarwinBundlePhase
|
||||
'')
|
||||
|
@ -13,5 +13,5 @@ octaveWriteRequiredOctavePackagesPhase() {
|
||||
# Yes its a bit long...
|
||||
if [ -z "${dontWriteRequiredOctavePackagesPhase-}" ]; then
|
||||
echo "Using octaveWriteRequiredOctavePackagesPhase"
|
||||
preDistPhases+=" octaveWriteRequiredOctavePackagesPhase"
|
||||
appendToVar preDistPhases octaveWriteRequiredOctavePackagesPhase
|
||||
fi
|
||||
|
@ -13,5 +13,5 @@ writeRequiredOctavePackagesPhase() {
|
||||
# Yes its a bit long...
|
||||
if [ -z "${dontWriteRequiredOctavePackagesPhase-}" ]; then
|
||||
echo "Using writeRequiredOctavePackagesPhase"
|
||||
preDistPhases+=" writeRequiredOctavePackagesPhase"
|
||||
appendToVar preDistPhases writeRequiredOctavePackagesPhase
|
||||
fi
|
||||
|
@ -58,5 +58,5 @@ function pytestCheckPhase() {
|
||||
|
||||
if [ -z "${dontUsePytestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
|
||||
echo "Using pytestCheckPhase"
|
||||
preDistPhases+=" pytestCheckPhase"
|
||||
appendToVar preDistPhases pytestCheckPhase
|
||||
fi
|
||||
|
@ -6,5 +6,5 @@ pythonCatchConflictsPhase() {
|
||||
}
|
||||
|
||||
if [ -z "${dontUsePythonCatchConflicts-}" ]; then
|
||||
preDistPhases+=" pythonCatchConflictsPhase"
|
||||
appendToVar preDistPhases pythonCatchConflictsPhase
|
||||
fi
|
||||
|
@ -18,5 +18,5 @@ pythonImportsCheckPhase () {
|
||||
|
||||
if [ -z "${dontUsePythonImportsCheck-}" ]; then
|
||||
echo "Using pythonImportsCheckPhase"
|
||||
preDistPhases+=" pythonImportsCheckPhase"
|
||||
appendToVar preDistPhases pythonImportsCheckPhase
|
||||
fi
|
||||
|
@ -13,5 +13,5 @@ pythonRemoveBinBytecodePhase () {
|
||||
}
|
||||
|
||||
if [ -z "${dontUsePythonRemoveBinBytecode-}" ]; then
|
||||
preDistPhases+=" pythonRemoveBinBytecodePhase"
|
||||
appendToVar preDistPhases pythonRemoveBinBytecodePhase
|
||||
fi
|
||||
|
@ -69,4 +69,4 @@ installSphinxPhase() {
|
||||
runHook postInstallSphinx
|
||||
}
|
||||
|
||||
preDistPhases+=" buildSphinxPhase installSphinxPhase"
|
||||
appendToVar preDistPhases buildSphinxPhase installSphinxPhase
|
||||
|
@ -13,5 +13,5 @@ unittestCheckPhase() {
|
||||
|
||||
if [ -z "${dontUseUnittestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
|
||||
echo "Using unittestCheckPhase"
|
||||
preDistPhases+=" unittestCheckPhase"
|
||||
appendToVar preDistPhases unittestCheckPhase
|
||||
fi
|
||||
|
@ -16,10 +16,17 @@ pytestForkedHook() {
|
||||
# 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
|
||||
|
@ -8,10 +8,17 @@ pytestXdistHook() {
|
||||
# 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
|
||||
|
@ -87,7 +87,7 @@ let
|
||||
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
|
||||
@ -100,7 +100,7 @@ let
|
||||
# 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" ];
|
||||
|
@ -84,7 +84,7 @@ buildPythonPackage rec {
|
||||
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
|
||||
@ -97,7 +97,7 @@ buildPythonPackage rec {
|
||||
# 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" ];
|
||||
|
@ -42,7 +42,7 @@ buildPythonPackage rec {
|
||||
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
|
||||
@ -55,7 +55,7 @@ buildPythonPackage rec {
|
||||
# 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; {
|
||||
|
@ -21,5 +21,5 @@ function manifestCheckPhase() {
|
||||
|
||||
if [ -z "${dontCheckManifest-}" ] && [ -z "${installCheckPhase-}" ]; then
|
||||
echo "Using manifestCheckPhase"
|
||||
preDistPhases+=" manifestCheckPhase"
|
||||
appendToVar preDistPhases manifestCheckPhase
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user