From 68052b56195715185efed7ccb91733cb4ae5d5f2 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Tue, 13 Feb 2018 16:32:16 +0200 Subject: [PATCH] python: Pull ensureNewerSourcesHook call to all-packages.nix Documents the reason why it's needed and also prevents the ensureNewerSourcesHook call being evaluated again and again for every single Python package. --- pkgs/development/interpreters/python/build-python-package.nix | 4 ++-- pkgs/development/interpreters/python/mk-python-derivation.nix | 4 ++-- pkgs/top-level/all-packages.nix | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkgs/development/interpreters/python/build-python-package.nix b/pkgs/development/interpreters/python/build-python-package.nix index 12d17b2e8322..6a07a006c6b5 100644 --- a/pkgs/development/interpreters/python/build-python-package.nix +++ b/pkgs/development/interpreters/python/build-python-package.nix @@ -6,7 +6,7 @@ , wrapPython , setuptools , unzip -, ensureNewerSourcesHook +, ensureNewerSourcesForZipFilesHook , toPythonModule , namePrefix , bootstrapped-pip @@ -19,7 +19,7 @@ let wheel-specific = import ./build-python-package-wheel.nix { }; common = import ./build-python-package-common.nix { inherit python bootstrapped-pip; }; mkPythonDerivation = import ./mk-python-derivation.nix { - inherit lib python wrapPython setuptools unzip ensureNewerSourcesHook toPythonModule namePrefix; + inherit lib python wrapPython setuptools unzip ensureNewerSourcesForZipFilesHook toPythonModule namePrefix; }; in diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index d9cff16f448f..96a9cdf0c615 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -5,7 +5,7 @@ , wrapPython , setuptools , unzip -, ensureNewerSourcesHook +, ensureNewerSourcesForZipFilesHook # Whether the derivation provides a Python module or not. , toPythonModule , namePrefix @@ -69,7 +69,7 @@ toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attrs [ name = namePrefix + name; - nativeBuildInputs = [ (ensureNewerSourcesHook { year = "1980"; }) ] + nativeBuildInputs = [ ensureNewerSourcesForZipFilesHook ] ++ nativeBuildInputs; buildInputs = [ wrapPython ] diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 73abc6006e25..274e726ebf8a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -92,6 +92,10 @@ with pkgs; } ''); + # Zip file format only allows times after year 1980, which makes e.g. Python wheel building fail with: + # ValueError: ZIP does not support timestamps before 1980 + ensureNewerSourcesForZipFilesHook = ensureNewerSourcesHook { year = "1980"; }; + updateAutotoolsGnuConfigScriptsHook = makeSetupHook { substitutions = { gnu_config = gnu-config;}; } ../build-support/setup-hooks/update-autotools-gnu-config-scripts.sh;