mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +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"
|
echo "Using neovimRequireCheckHook"
|
||||||
preDistPhases+=" neovimRequireCheckHook"
|
appendToVar preDistPhases neovimRequireCheckHook
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,5 +21,5 @@ vimCommandCheckHook () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo "Using 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}"
|
${writeDarwinBundle}/bin/write-darwin-bundle "''${!outputBin}" "${name}" "${exec}"
|
||||||
}
|
}
|
||||||
|
|
||||||
preDistPhases+=" makeDarwinBundlePhase"
|
appendToVar preDistPhases makeDarwinBundlePhase
|
||||||
'')
|
'')
|
||||||
|
@ -13,5 +13,5 @@ octaveWriteRequiredOctavePackagesPhase() {
|
|||||||
# Yes its a bit long...
|
# Yes its a bit long...
|
||||||
if [ -z "${dontWriteRequiredOctavePackagesPhase-}" ]; then
|
if [ -z "${dontWriteRequiredOctavePackagesPhase-}" ]; then
|
||||||
echo "Using octaveWriteRequiredOctavePackagesPhase"
|
echo "Using octaveWriteRequiredOctavePackagesPhase"
|
||||||
preDistPhases+=" octaveWriteRequiredOctavePackagesPhase"
|
appendToVar preDistPhases octaveWriteRequiredOctavePackagesPhase
|
||||||
fi
|
fi
|
||||||
|
@ -13,5 +13,5 @@ writeRequiredOctavePackagesPhase() {
|
|||||||
# Yes its a bit long...
|
# Yes its a bit long...
|
||||||
if [ -z "${dontWriteRequiredOctavePackagesPhase-}" ]; then
|
if [ -z "${dontWriteRequiredOctavePackagesPhase-}" ]; then
|
||||||
echo "Using writeRequiredOctavePackagesPhase"
|
echo "Using writeRequiredOctavePackagesPhase"
|
||||||
preDistPhases+=" writeRequiredOctavePackagesPhase"
|
appendToVar preDistPhases writeRequiredOctavePackagesPhase
|
||||||
fi
|
fi
|
||||||
|
@ -58,5 +58,5 @@ function pytestCheckPhase() {
|
|||||||
|
|
||||||
if [ -z "${dontUsePytestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
|
if [ -z "${dontUsePytestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
|
||||||
echo "Using pytestCheckPhase"
|
echo "Using pytestCheckPhase"
|
||||||
preDistPhases+=" pytestCheckPhase"
|
appendToVar preDistPhases pytestCheckPhase
|
||||||
fi
|
fi
|
||||||
|
@ -6,5 +6,5 @@ pythonCatchConflictsPhase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "${dontUsePythonCatchConflicts-}" ]; then
|
if [ -z "${dontUsePythonCatchConflicts-}" ]; then
|
||||||
preDistPhases+=" pythonCatchConflictsPhase"
|
appendToVar preDistPhases pythonCatchConflictsPhase
|
||||||
fi
|
fi
|
||||||
|
@ -18,5 +18,5 @@ pythonImportsCheckPhase () {
|
|||||||
|
|
||||||
if [ -z "${dontUsePythonImportsCheck-}" ]; then
|
if [ -z "${dontUsePythonImportsCheck-}" ]; then
|
||||||
echo "Using pythonImportsCheckPhase"
|
echo "Using pythonImportsCheckPhase"
|
||||||
preDistPhases+=" pythonImportsCheckPhase"
|
appendToVar preDistPhases pythonImportsCheckPhase
|
||||||
fi
|
fi
|
||||||
|
@ -13,5 +13,5 @@ pythonRemoveBinBytecodePhase () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "${dontUsePythonRemoveBinBytecode-}" ]; then
|
if [ -z "${dontUsePythonRemoveBinBytecode-}" ]; then
|
||||||
preDistPhases+=" pythonRemoveBinBytecodePhase"
|
appendToVar preDistPhases pythonRemoveBinBytecodePhase
|
||||||
fi
|
fi
|
||||||
|
@ -69,4 +69,4 @@ installSphinxPhase() {
|
|||||||
runHook postInstallSphinx
|
runHook postInstallSphinx
|
||||||
}
|
}
|
||||||
|
|
||||||
preDistPhases+=" buildSphinxPhase installSphinxPhase"
|
appendToVar preDistPhases buildSphinxPhase installSphinxPhase
|
||||||
|
@ -13,5 +13,5 @@ unittestCheckPhase() {
|
|||||||
|
|
||||||
if [ -z "${dontUseUnittestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
|
if [ -z "${dontUseUnittestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
|
||||||
echo "Using unittestCheckPhase"
|
echo "Using unittestCheckPhase"
|
||||||
preDistPhases+=" unittestCheckPhase"
|
appendToVar preDistPhases unittestCheckPhase
|
||||||
fi
|
fi
|
||||||
|
@ -16,10 +16,17 @@ pytestForkedHook() {
|
|||||||
# until we have dependency mechanism in generic builder, we need to use this ugly hack.
|
# until we have dependency mechanism in generic builder, we need to use this ugly hack.
|
||||||
|
|
||||||
if [ -z "${dontUsePytestForked-}" ] && [ -z "${dontUsePytestCheck-}" ]; then
|
if [ -z "${dontUsePytestForked-}" ] && [ -z "${dontUsePytestCheck-}" ]; then
|
||||||
if [[ " ${preDistPhases:-} " =~ " pytestCheckPhase " ]]; then
|
if [[ " ${preDistPhases[*]:-} " =~ " pytestCheckPhase " ]]; then
|
||||||
preDistPhases+=" "
|
_preDistPhases="${preDistPhases[*]} "
|
||||||
preDistPhases="${preDistPhases/ pytestCheckPhase / pytestForkedHook pytestCheckPhase }"
|
_preDistPhases="${_preDistPhases/ pytestCheckPhase / pytestForkedHook pytestCheckPhase }"
|
||||||
|
if [[ -n "${__structuredAttrs-}" ]]; then
|
||||||
|
preDistPhases=()
|
||||||
else
|
else
|
||||||
preDistPhases+=" pytestForkedHook"
|
preDistPhases=""
|
||||||
|
fi
|
||||||
|
appendToVar preDistPhases $_preDistPhases
|
||||||
|
unset _preDistPhases
|
||||||
|
else
|
||||||
|
appendToVar preDistPhases pytestForkedHook
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -8,10 +8,17 @@ pytestXdistHook() {
|
|||||||
# until we have dependency mechanism in generic builder, we need to use this ugly hack.
|
# until we have dependency mechanism in generic builder, we need to use this ugly hack.
|
||||||
|
|
||||||
if [ -z "${dontUsePytestXdist-}" ] && [ -z "${dontUsePytestCheck-}" ]; then
|
if [ -z "${dontUsePytestXdist-}" ] && [ -z "${dontUsePytestCheck-}" ]; then
|
||||||
if [[ " ${preDistPhases:-} " =~ " pytestCheckPhase " ]]; then
|
if [[ " ${preDistPhases[*]:-} " =~ " pytestCheckPhase " ]]; then
|
||||||
preDistPhases+=" "
|
_preDistPhases="${preDistPhases[*]} "
|
||||||
preDistPhases="${preDistPhases/ pytestCheckPhase / pytestXdistHook pytestCheckPhase }"
|
_preDistPhases="${_preDistPhases/ pytestCheckPhase / pytestXdistHook pytestCheckPhase }"
|
||||||
|
if [[ -n "${__structuredAttrs-}" ]]; then
|
||||||
|
preDistPhases=()
|
||||||
else
|
else
|
||||||
preDistPhases+=" pytestXdistHook"
|
preDistPhases=""
|
||||||
|
fi
|
||||||
|
appendToVar preDistPhases $_preDistPhases
|
||||||
|
unset _preDistPhases
|
||||||
|
else
|
||||||
|
appendToVar preDistPhases pytestXdistHook
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -87,7 +87,7 @@ let
|
|||||||
pytestcachePhase() {
|
pytestcachePhase() {
|
||||||
find $out -name .pytest_cache -type d -exec rm -rf {} +
|
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.
|
# pytest generates it's own bytecode files to improve assertion messages.
|
||||||
# These files similar to cpython's bytecode files but are never laoded
|
# 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
|
# https://github.com/pytest-dev/pytest/blob/7.2.1/src/_pytest/assertion/rewrite.py#L51-L53
|
||||||
find $out -name "*-pytest-*.py[co]" -delete
|
find $out -name "*-pytest-*.py[co]" -delete
|
||||||
}
|
}
|
||||||
preDistPhases+=" pytestRemoveBytecodePhase"
|
appendToVar preDistPhases pytestRemoveBytecodePhase
|
||||||
'';
|
'';
|
||||||
|
|
||||||
pythonImportsCheck = [ "pytest" ];
|
pythonImportsCheck = [ "pytest" ];
|
||||||
|
@ -84,7 +84,7 @@ buildPythonPackage rec {
|
|||||||
pytestcachePhase() {
|
pytestcachePhase() {
|
||||||
find $out -name .pytest_cache -type d -exec rm -rf {} +
|
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.
|
# pytest generates it's own bytecode files to improve assertion messages.
|
||||||
# These files similar to cpython's bytecode files but are never laoded
|
# 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
|
# https://github.com/pytest-dev/pytest/blob/7.2.1/src/_pytest/assertion/rewrite.py#L51-L53
|
||||||
find $out -name "*-pytest-*.py[co]" -delete
|
find $out -name "*-pytest-*.py[co]" -delete
|
||||||
}
|
}
|
||||||
preDistPhases+=" pytestRemoveBytecodePhase"
|
appendToVar preDistPhases pytestRemoveBytecodePhase
|
||||||
'';
|
'';
|
||||||
|
|
||||||
pythonImportsCheck = [ "pytest" ];
|
pythonImportsCheck = [ "pytest" ];
|
||||||
|
@ -42,7 +42,7 @@ buildPythonPackage rec {
|
|||||||
find $out -name .pytest_cache -type d -exec rm -rf {} +
|
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.
|
# pytest generates it's own bytecode files to improve assertion messages.
|
||||||
# These files similar to cpython's bytecode files but are never laoded
|
# 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
|
# https://github.com/pytest-dev/pytest/blob/4.6.11/src/_pytest/assertion/rewrite.py#L32-L47
|
||||||
find $out -name "*-PYTEST.py[co]" -delete
|
find $out -name "*-PYTEST.py[co]" -delete
|
||||||
}
|
}
|
||||||
preDistPhases+=" pytestRemoveBytecodePhase"
|
appendToVar preDistPhases pytestRemoveBytecodePhase
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
@ -21,5 +21,5 @@ function manifestCheckPhase() {
|
|||||||
|
|
||||||
if [ -z "${dontCheckManifest-}" ] && [ -z "${installCheckPhase-}" ]; then
|
if [ -z "${dontCheckManifest-}" ] && [ -z "${installCheckPhase-}" ]; then
|
||||||
echo "Using manifestCheckPhase"
|
echo "Using manifestCheckPhase"
|
||||||
preDistPhases+=" manifestCheckPhase"
|
appendToVar preDistPhases manifestCheckPhase
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user