From 0a4898c21a04336bf9919da3ec95050890e77e5b Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Mon, 19 Sep 2022 10:00:42 +0200 Subject: [PATCH 1/2] Revert "buildPython*: store dist (wheel/sdist) in dist output" Revert for now and fix on python-unstable branch. This reverts commit adbc59c9d3b6be2cdb1c29b84afa8b30d9cc7593. --- .../development/interpreters/python/hooks/default.nix | 5 ----- .../python/hooks/python-output-dist-hook.sh | 10 ---------- .../interpreters/python/mk-python-derivation.nix | 11 +---------- pkgs/top-level/python-packages.nix | 1 - 4 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 pkgs/development/interpreters/python/hooks/python-output-dist-hook.sh diff --git a/pkgs/development/interpreters/python/hooks/default.nix b/pkgs/development/interpreters/python/hooks/default.nix index 63e94b567035..903ad0215cdf 100644 --- a/pkgs/development/interpreters/python/hooks/default.nix +++ b/pkgs/development/interpreters/python/hooks/default.nix @@ -114,11 +114,6 @@ in rec { }; } ./python-namespaces-hook.sh) {}; - pythonOutputDistHook = callPackage ({ }: - makeSetupHook { - name = "python-output-dist-hook"; - } ./python-output-dist-hook.sh ) {}; - pythonRecompileBytecodeHook = callPackage ({ }: makeSetupHook { name = "python-recompile-bytecode-hook"; diff --git a/pkgs/development/interpreters/python/hooks/python-output-dist-hook.sh b/pkgs/development/interpreters/python/hooks/python-output-dist-hook.sh deleted file mode 100644 index e73e45cd597a..000000000000 --- a/pkgs/development/interpreters/python/hooks/python-output-dist-hook.sh +++ /dev/null @@ -1,10 +0,0 @@ -# Setup hook for storing dist folder (wheels/sdists) in a separate output -echo "Sourcing python-catch-conflicts-hook.sh" - -pythonOutputDistPhase() { - echo "Executing pythonOutputDistPhase" - mv "dist" "$dist" - echo "Finished executing pythonOutputDistPhase" -} - -preFixupPhases+=" pythonOutputDistPhase" diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index abb1ceb7879e..a032c08d2a82 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -17,7 +17,6 @@ , pythonCatchConflictsHook , pythonImportsCheckHook , pythonNamespacesHook -, pythonOutputDistHook , pythonRemoveBinBytecodeHook , pythonRemoveTestsDirHook , setuptoolsBuildHook @@ -50,8 +49,6 @@ # Enabled to detect some (native)BuildInputs mistakes , strictDeps ? true -, outputs ? [ "out" ] - # used to disable derivation, useful for specific python versions , disabled ? false @@ -109,13 +106,11 @@ else let inherit (python) stdenv; - withDistOutput = lib.elem format ["pyproject" "setuptools" "flit"]; - name_ = name; self = toPythonModule (stdenv.mkDerivation ((builtins.removeAttrs attrs [ "disabled" "checkPhase" "checkInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts" "format" - "disabledTestPaths" "outputs" + "disabledTestPaths" ]) // { name = namePrefix + name_; @@ -149,8 +144,6 @@ let ] ++ lib.optionals (python.pythonAtLeast "3.3") [ # Optionally enforce PEP420 for python3 pythonNamespacesHook - ] ++ lib.optionals withDistOutput [ - pythonOutputDistHook ] ++ nativeBuildInputs; buildInputs = buildInputs ++ pythonPath; @@ -184,8 +177,6 @@ let # Python packages built through cross-compilation are always for the host platform. disallowedReferences = lib.optionals (python.stdenv.hostPlatform != python.stdenv.buildPlatform) [ python.pythonForBuild ]; - outputs = outputs ++ lib.optional withDistOutput "dist"; - meta = { # default to python's platforms platforms = python.meta.platforms; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 63d2022fac62..6be0b1807bc5 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -119,7 +119,6 @@ in { pythonCatchConflictsHook pythonImportsCheckHook pythonNamespacesHook - pythonOutputDistHook pythonRecompileBytecodeHook pythonRelaxDepsHook pythonRemoveBinBytecodeHook From 3ff2d9362ce18cab4bebd6ebf17892e431df34e2 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Mon, 19 Sep 2022 10:01:25 +0200 Subject: [PATCH 2/2] Revert "buildPython*: wrap setuptools in hook for catching conflicts" Revert for now and fix on python-unstable branch. This reverts commit 13bb0f49f7afe8296452d70e7782ac1d67b064da. --- pkgs/development/interpreters/python/hooks/default.nix | 3 ++- .../interpreters/python/hooks/python-catch-conflicts-hook.sh | 2 +- pkgs/development/interpreters/python/mk-python-derivation.nix | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/development/interpreters/python/hooks/default.nix b/pkgs/development/interpreters/python/hooks/default.nix index 903ad0215cdf..5d605b240ad8 100644 --- a/pkgs/development/interpreters/python/hooks/default.nix +++ b/pkgs/development/interpreters/python/hooks/default.nix @@ -92,8 +92,9 @@ in rec { pythonCatchConflictsHook = callPackage ({ setuptools }: makeSetupHook { name = "python-catch-conflicts-hook"; + deps = [ setuptools ]; substitutions = { - inherit pythonInterpreter pythonSitePackages setuptools; + inherit pythonInterpreter; 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 0abcad3c42f2..374a2eddb407 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() { - PYTHONPATH="@setuptools@/@pythonSitePackages@:$PYTHONPATH" @pythonInterpreter@ @catchConflicts@ + @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 a032c08d2a82..f37ad592cb49 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -121,7 +121,7 @@ let ensureNewerSourcesForZipFilesHook # move to wheel installer (pip) or builder (setuptools, flit, ...)? pythonRemoveTestsDirHook ] ++ lib.optionals catchConflicts [ - pythonCatchConflictsHook + setuptools pythonCatchConflictsHook ] ++ lib.optionals removeBinBytecode [ pythonRemoveBinBytecodeHook ] ++ lib.optionals (lib.hasSuffix "zip" (attrs.src.name or "")) [