diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2022-08-09 18:48:56 +0200 |
---|---|---|
committer | Frederik Rietdijk <freddyrietdijk@fridh.nl> | 2022-09-13 18:48:08 +0200 |
commit | 13bb0f49f7afe8296452d70e7782ac1d67b064da (patch) | |
tree | 676bf1cdd694f4225a9e255cdfe0c930d849a295 /pkgs | |
parent | 2444caed5af0e535220faf19929bc7b969cf35c1 (diff) | |
download | nixpkgs-13bb0f49f7afe8296452d70e7782ac1d67b064da.tar nixpkgs-13bb0f49f7afe8296452d70e7782ac1d67b064da.tar.gz nixpkgs-13bb0f49f7afe8296452d70e7782ac1d67b064da.tar.bz2 nixpkgs-13bb0f49f7afe8296452d70e7782ac1d67b064da.tar.lz nixpkgs-13bb0f49f7afe8296452d70e7782ac1d67b064da.tar.xz nixpkgs-13bb0f49f7afe8296452d70e7782ac1d67b064da.tar.zst nixpkgs-13bb0f49f7afe8296452d70e7782ac1d67b064da.zip |
buildPython*: wrap setuptools in hook for catching conflicts
By default buildPython* runs a hook for detecting conflicting packages. This hook needs pkg_resources which is part of setuptools. Before this commit, setuptools was simply added to the build. This meant that when setuptools was forgotten to be added to the build, the build and installation would still succeed because of this package from the hook. During runtime (and cross-compilation) one would notice the missing package.
Diffstat (limited to 'pkgs')
3 files changed, 3 insertions, 4 deletions
diff --git a/pkgs/development/interpreters/python/hooks/default.nix b/pkgs/development/interpreters/python/hooks/default.nix index 9d4b61c1a0f..63e94b56703 100644 --- a/pkgs/development/interpreters/python/hooks/default.nix +++ b/pkgs/development/interpreters/python/hooks/default.nix @@ -92,9 +92,8 @@ in rec { pythonCatchConflictsHook = callPackage ({ setuptools }: makeSetupHook { name = "python-catch-conflicts-hook"; - deps = [ setuptools ]; substitutions = { - inherit pythonInterpreter; + inherit pythonInterpreter pythonSitePackages setuptools; catchConflicts=../catch_conflicts/catch_conflicts.py; }; } ./python-catch-conflicts-hook.sh) {}; diff --git a/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh b/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh index 374a2eddb40..0abcad3c42f 100644 --- a/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh +++ b/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh @@ -2,7 +2,7 @@ echo "Sourcing python-catch-conflicts-hook.sh" pythonCatchConflictsPhase() { - @pythonInterpreter@ @catchConflicts@ + PYTHONPATH="@setuptools@/@pythonSitePackages@:$PYTHONPATH" @pythonInterpreter@ @catchConflicts@ } if [ -z "${dontUsePythonCatchConflicts-}" ]; then diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index f82611554a2..abb1ceb7879 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -126,7 +126,7 @@ let ensureNewerSourcesForZipFilesHook # move to wheel installer (pip) or builder (setuptools, flit, ...)? pythonRemoveTestsDirHook ] ++ lib.optionals catchConflicts [ - setuptools pythonCatchConflictsHook + pythonCatchConflictsHook ] ++ lib.optionals removeBinBytecode [ pythonRemoveBinBytecodeHook ] ++ lib.optionals (lib.hasSuffix "zip" (attrs.src.name or "")) [ |