python.pkgs.buildPythonPackage: use distutils-cfg to block downloads, fixes #25428
While we tell pip not to fetch (with the `--no-index` option),
`setuptools` can do so itself. In the past we used a `distutils.cfg`
with `allow-hosts = None` to prevent setuptools from fetching itself.
This was removed when we started building wheels in
2562f94de4e4fd2ddc677187fa2e2848L69.
The `dist-utils.cfg` code was still there, and adding it to
`buildInputs` is sufficient.
Tested with python.pkgs.passlib by removing the `checkInputs` / `nose`.
commitb73e3bfafd42dbc9caca2eae918ce936c9471c23
authorFrederik Rietdijk <fridh@fridh.nl>
dateThu 7 Sep 2017, 19:22 (9 years ago)
parenta26ae76
pkgs/development/interpreters/python/mk-python-derivation.nix+3−1
@@ -6,6 +6,8 @@
66, setuptools
77, unzip
88, ensureNewerSourcesHook
9+# Prevent impurities by blocking setuptools/easy-install from downloading sdists
10+, distutils-cfg
911}:
1012
1113{ name
@@ -60,7 +62,7 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "checkInputs"
6062
6163 inherit pythonPath;
6264
63− buildInputs = [ wrapPython ] ++ buildInputs ++ pythonPath
65+ buildInputs = [ distutils-cfg wrapPython ] ++ buildInputs ++ pythonPath
6466 ++ [ (ensureNewerSourcesHook { year = "1980"; }) ]
6567 ++ (lib.optional (lib.hasSuffix "zip" attrs.src.name or "") unzip)
6668 ++ lib.optionals doCheck checkInputs;
pkgs/top-level/python-packages.nix+1
@@ -34,6 +34,7 @@ let
3434 bootstrapped-pip = callPackage ../development/python-modules/bootstrapped-pip { };
3535
3636 mkPythonDerivation = makeOverridable( callPackage ../development/interpreters/python/mk-python-derivation.nix {
37+ distutils-cfg = callPackage ../development/python-modules/distutils-cfg { };
3738 });
3839
3940 # Derivations built with `buildPythonPackage` can already be overriden with `override`, `overrideAttrs`, and `overrideDerivation`.