diff options
author | Eric Culp <eculperic@gmail.com> | 2019-10-13 17:20:04 -0700 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2019-10-14 08:44:43 +0200 |
commit | 90be4c2c7875c9487508d95b5c638d97e2903ada (patch) | |
tree | 5c47de54cd1dca9cd32029bc929ca49131320650 /pkgs/development/python-modules/setuptools/default.nix | |
parent | dd6261cabec24796c943bfa623c1dd1110aab4f9 (diff) | |
download | nixpkgs-90be4c2c7875c9487508d95b5c638d97e2903ada.tar nixpkgs-90be4c2c7875c9487508d95b5c638d97e2903ada.tar.gz nixpkgs-90be4c2c7875c9487508d95b5c638d97e2903ada.tar.bz2 nixpkgs-90be4c2c7875c9487508d95b5c638d97e2903ada.tar.lz nixpkgs-90be4c2c7875c9487508d95b5c638d97e2903ada.tar.xz nixpkgs-90be4c2c7875c9487508d95b5c638d97e2903ada.tar.zst nixpkgs-90be4c2c7875c9487508d95b5c638d97e2903ada.zip |
pythonPackages.setuptools: Remove windows files and make reproducible
- setuptools includes *.exe files by default, but can be excluded with an ENV variable. - setuptools was built as an egg, which had reproducibility problems. Instead use a wheel These are various *.exe and *.xml files used only on windows. setuptools includes them by default since it normally creates a single release for all operating systems. This reduces the size from 1020.0K to 801.6K according to `nix-path -sh`. The egg is a zip file. setuptools leaves timestamps in the egg, which makes the build unreproducible. Unfortunately the files aren't compressed so the size of setuptools increases to 2.3M from 0.8M according to `nix path-info -sh`. With this change, setuptools is reproducible according to nix-build -A python37Packages.setuptools --check
Diffstat (limited to 'pkgs/development/python-modules/setuptools/default.nix')
-rw-r--r-- | pkgs/development/python-modules/setuptools/default.nix | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/pkgs/development/python-modules/setuptools/default.nix b/pkgs/development/python-modules/setuptools/default.nix index 569ff017ea9..c802d58a60a 100644 --- a/pkgs/development/python-modules/setuptools/default.nix +++ b/pkgs/development/python-modules/setuptools/default.nix @@ -6,11 +6,17 @@ , unzip , callPackage , bootstrapped-pip +, lib +, pipInstallHook +, setuptoolsBuildHook }: buildPythonPackage rec { pname = "setuptools"; version = "41.2.0"; + # Because of bootstrapping we don't use the setuptoolsBuildHook that comes with format="setuptools" directly. + # Instead, we override it to remove setuptools to avoid a circular dependency. + # The same is done for pip and the pipInstallHook. format = "other"; src = fetchPypi { @@ -19,19 +25,18 @@ buildPythonPackage rec { sha256 = "66b86bbae7cc7ac2e867f52dc08a6bd064d938bac59dfec71b9b565dd36d6012"; }; - # There is nothing to build - dontBuild = true; + nativeBuildInputs = [ + bootstrapped-pip + (pipInstallHook.override{pip=null;}) + (setuptoolsBuildHook.override{setuptools=null; wheel=null;}) + ]; - nativeBuildInputs = [ bootstrapped-pip ]; - - installPhase = '' - dst=$out/${python.sitePackages} - mkdir -p $dst - export PYTHONPATH="$dst:$PYTHONPATH" - ${python.pythonForBuild.interpreter} setup.py install --prefix=$out - wrapPythonPrograms + preBuild = lib.strings.optionalString (!stdenv.hostPlatform.isWindows) '' + export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0 ''; + pipInstallFlags = [ "--ignore-installed" ]; + # Adds setuptools to nativeBuildInputs causing infinite recursion. catchConflicts = false; |