python: add pythonRemoveTestsDirHook
This will automatically remove a top-level "tests" directory from being installed.
This commit is contained in:
parent
fe898d5f76
commit
3973a3c79c
@ -94,6 +94,14 @@ in rec {
|
|||||||
name = "python-remove-bin-bytecode-hook";
|
name = "python-remove-bin-bytecode-hook";
|
||||||
} ./python-remove-bin-bytecode-hook.sh) {};
|
} ./python-remove-bin-bytecode-hook.sh) {};
|
||||||
|
|
||||||
|
pythonRemoveTestsDirHook = callPackage ({ }:
|
||||||
|
makeSetupHook {
|
||||||
|
name = "python-remove-tests-dir-hook";
|
||||||
|
substitutions = {
|
||||||
|
inherit pythonSitePackages;
|
||||||
|
};
|
||||||
|
} ./python-remove-tests-dir-hook.sh) {};
|
||||||
|
|
||||||
setuptoolsBuildHook = callPackage ({ setuptools, wheel }:
|
setuptoolsBuildHook = callPackage ({ setuptools, wheel }:
|
||||||
makeSetupHook {
|
makeSetupHook {
|
||||||
name = "setuptools-setup-hook";
|
name = "setuptools-setup-hook";
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
# Clean up top-level tests directory in site-package installation.
|
||||||
|
echo "Sourcing python-remove-tests-dir-hook"
|
||||||
|
|
||||||
|
pythonRemoveTestsDir() {
|
||||||
|
echo "Executing pythonRemoveTestsDir"
|
||||||
|
|
||||||
|
rm -rf $out/@pythonSitePackages@/tests
|
||||||
|
|
||||||
|
echo "Finished executing pythonRemoveTestsDir"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "${dontUsePythonRemoveTestsDir-}" ]; then
|
||||||
|
postFixupHooks+=(pythonRemoveTestsDir)
|
||||||
|
fi
|
||||||
|
|
@ -17,6 +17,7 @@
|
|||||||
, pythonCatchConflictsHook
|
, pythonCatchConflictsHook
|
||||||
, pythonImportsCheckHook
|
, pythonImportsCheckHook
|
||||||
, pythonRemoveBinBytecodeHook
|
, pythonRemoveBinBytecodeHook
|
||||||
|
, pythonRemoveTestsDirHook
|
||||||
, setuptoolsBuildHook
|
, setuptoolsBuildHook
|
||||||
, setuptoolsCheckHook
|
, setuptoolsCheckHook
|
||||||
, wheelUnpackHook
|
, wheelUnpackHook
|
||||||
@ -108,6 +109,7 @@ let
|
|||||||
python
|
python
|
||||||
wrapPython
|
wrapPython
|
||||||
ensureNewerSourcesForZipFilesHook # move to wheel installer (pip) or builder (setuptools, flit, ...)?
|
ensureNewerSourcesForZipFilesHook # move to wheel installer (pip) or builder (setuptools, flit, ...)?
|
||||||
|
pythonRemoveTestsDirHook
|
||||||
] ++ lib.optionals catchConflicts [
|
] ++ lib.optionals catchConflicts [
|
||||||
setuptools pythonCatchConflictsHook
|
setuptools pythonCatchConflictsHook
|
||||||
] ++ lib.optionals removeBinBytecode [
|
] ++ lib.optionals removeBinBytecode [
|
||||||
|
@ -108,7 +108,7 @@ in {
|
|||||||
inherit buildSetupcfg;
|
inherit buildSetupcfg;
|
||||||
|
|
||||||
inherit (callPackage ../development/interpreters/python/hooks { })
|
inherit (callPackage ../development/interpreters/python/hooks { })
|
||||||
eggUnpackHook eggBuildHook eggInstallHook flitBuildHook pipBuildHook pipInstallHook pytestCheckHook pythonCatchConflictsHook pythonImportsCheckHook pythonRemoveBinBytecodeHook setuptoolsBuildHook setuptoolsCheckHook venvShellHook wheelUnpackHook;
|
eggUnpackHook eggBuildHook eggInstallHook flitBuildHook pipBuildHook pipInstallHook pytestCheckHook pythonCatchConflictsHook pythonImportsCheckHook pythonRemoveBinBytecodeHook pythonRemoveTestsDirHook setuptoolsBuildHook setuptoolsCheckHook venvShellHook wheelUnpackHook;
|
||||||
|
|
||||||
# helpers
|
# helpers
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user