mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-04 16:51:40 -05:00
Add hook to remove normal files from site-packages
This is a fairly common packaging mistake that it's better that we solve in a hook than in one-by-one in overrides. Normal files in site-packages isn't always a mistake, so we can't clean them up wholesale, but we can clean up some common mistakes.
This commit is contained in:
parent
7a936014e5
commit
31effa4e4e
2 changed files with 20 additions and 1 deletions
|
@ -67,6 +67,13 @@ in
|
||||||
{
|
{
|
||||||
name = "fixup-hook.sh";
|
name = "fixup-hook.sh";
|
||||||
deps = [ ];
|
deps = [ ];
|
||||||
|
substitutions = {
|
||||||
|
inherit pythonSitePackages;
|
||||||
|
filenames = builtins.concatStringsSep " " [
|
||||||
|
"pyproject.toml"
|
||||||
|
"README.md"
|
||||||
|
];
|
||||||
|
};
|
||||||
} ./fixup-hook.sh
|
} ./fixup-hook.sh
|
||||||
)
|
)
|
||||||
{ };
|
{ };
|
||||||
|
|
|
@ -1,8 +1,20 @@
|
||||||
poetry2nix-fixup-hook() {
|
poetry2nix-fixup-hook() {
|
||||||
|
|
||||||
# Including tests in the output is a common mistake
|
# Including tests in the output is a common mistake
|
||||||
if [ -z "${dontFixupTests-}" ]; then
|
if [ -z "${dontFixupTests-}" ]; then
|
||||||
rm -rf $out/lib/python3.7/site-packages/tests
|
rm -rf $out/@pythonSitePackages@/tests
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Including files in site-packages is a common packaging mistake
|
||||||
|
#
|
||||||
|
# While we cannot remove all normal files dumped in site-packages
|
||||||
|
# we can clean up some common mistakes
|
||||||
|
if [ -z "${dontFixupSitePackages-}" ]; then
|
||||||
|
for f in @filenames@; do
|
||||||
|
rm -f $out/@pythonSitePackages@/$f
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
postFixupHooks+=(poetry2nix-fixup-hook)
|
postFixupHooks+=(poetry2nix-fixup-hook)
|
||||||
|
|
Loading…
Add table
Reference in a new issue