mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-04 16:51:40 -05:00
Add fixup hook
This hook should fix common mistakes like installing `tests` in site-packages which leads to collisions.
This commit is contained in:
parent
c1b21de0ba
commit
090e2dd957
4 changed files with 21 additions and 3 deletions
|
@ -99,7 +99,7 @@ let
|
|||
# The canonical name is setuptools-scm
|
||||
setuptools-scm = super.setuptools_scm;
|
||||
|
||||
inherit (hooks) removePathDependenciesHook;
|
||||
inherit (hooks) removePathDependenciesHook poetry2nixFixupHook;
|
||||
}
|
||||
)
|
||||
# Null out any filtered packages, we don't want python.pkgs from nixpkgs
|
||||
|
|
|
@ -22,4 +22,12 @@ in
|
|||
} ./remove-path-dependencies.sh
|
||||
) {};
|
||||
|
||||
poetry2nixFixupHook = callPackage (
|
||||
{}:
|
||||
makeSetupHook {
|
||||
name = "fixup-hook.sh";
|
||||
deps = [];
|
||||
} ./fixup-hook.sh
|
||||
) {};
|
||||
|
||||
}
|
||||
|
|
8
hooks/fixup-hook.sh
Normal file
8
hooks/fixup-hook.sh
Normal file
|
@ -0,0 +1,8 @@
|
|||
poetry2nix-fixup-hook() {
|
||||
# Including tests in the output is a common mistake
|
||||
if [ -z "${dontFixupTests-}" ]; then
|
||||
rm -rf $out/lib/python3.7/site-packages/tests
|
||||
fi
|
||||
}
|
||||
|
||||
postFixupHooks+=(poetry2nix-fixup-hook)
|
|
@ -106,8 +106,10 @@ pythonPackages.callPackage (
|
|||
# Stripping pre-built wheels lead to `ELF load command address/offset not properly aligned`
|
||||
dontStrip = format == "wheel";
|
||||
|
||||
nativeBuildInputs = (if (!isSource && (getManyLinuxDeps fileInfo.name).str != null) then [ autoPatchelfHook ] else [])
|
||||
++ lib.optional (isLocal) pkgs.yj
|
||||
nativeBuildInputs = [
|
||||
pythonPackages.poetry2nixFixupHook
|
||||
]
|
||||
++ lib.optional (!isSource && (getManyLinuxDeps fileInfo.name).str != null) autoPatchelfHook
|
||||
++ lib.optional (format == "pyproject") pythonPackages.removePathDependenciesHook
|
||||
;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue