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`.
wip/yesman
Frederik Rietdijk 7 years ago
parent a26ae760e2
commit b73e3bfafd
  1. 4
      pkgs/development/interpreters/python/mk-python-derivation.nix
  2. 1
      pkgs/top-level/python-packages.nix

@ -6,6 +6,8 @@
, setuptools
, unzip
, ensureNewerSourcesHook
# Prevent impurities by blocking setuptools/easy-install from downloading sdists
, distutils-cfg
}:
{ name
@ -60,7 +62,7 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "checkInputs"
inherit pythonPath;
buildInputs = [ wrapPython ] ++ buildInputs ++ pythonPath
buildInputs = [ distutils-cfg wrapPython ] ++ buildInputs ++ pythonPath
++ [ (ensureNewerSourcesHook { year = "1980"; }) ]
++ (lib.optional (lib.hasSuffix "zip" attrs.src.name or "") unzip)
++ lib.optionals doCheck checkInputs;

@ -34,6 +34,7 @@ let
bootstrapped-pip = callPackage ../development/python-modules/bootstrapped-pip { };
mkPythonDerivation = makeOverridable( callPackage ../development/interpreters/python/mk-python-derivation.nix {
distutils-cfg = callPackage ../development/python-modules/distutils-cfg { };
});
# Derivations built with `buildPythonPackage` can already be overriden with `override`, `overrideAttrs`, and `overrideDerivation`.

Loading…
Cancel
Save