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`.
This commit is contained in:
parent
a26ae760e2
commit
b73e3bfafd
@ -6,6 +6,8 @@
|
|||||||
, setuptools
|
, setuptools
|
||||||
, unzip
|
, unzip
|
||||||
, ensureNewerSourcesHook
|
, ensureNewerSourcesHook
|
||||||
|
# Prevent impurities by blocking setuptools/easy-install from downloading sdists
|
||||||
|
, distutils-cfg
|
||||||
}:
|
}:
|
||||||
|
|
||||||
{ name
|
{ name
|
||||||
@ -60,7 +62,7 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "checkInputs"
|
|||||||
|
|
||||||
inherit pythonPath;
|
inherit pythonPath;
|
||||||
|
|
||||||
buildInputs = [ wrapPython ] ++ buildInputs ++ pythonPath
|
buildInputs = [ distutils-cfg wrapPython ] ++ buildInputs ++ pythonPath
|
||||||
++ [ (ensureNewerSourcesHook { year = "1980"; }) ]
|
++ [ (ensureNewerSourcesHook { year = "1980"; }) ]
|
||||||
++ (lib.optional (lib.hasSuffix "zip" attrs.src.name or "") unzip)
|
++ (lib.optional (lib.hasSuffix "zip" attrs.src.name or "") unzip)
|
||||||
++ lib.optionals doCheck checkInputs;
|
++ lib.optionals doCheck checkInputs;
|
||||||
|
@ -34,6 +34,7 @@ let
|
|||||||
bootstrapped-pip = callPackage ../development/python-modules/bootstrapped-pip { };
|
bootstrapped-pip = callPackage ../development/python-modules/bootstrapped-pip { };
|
||||||
|
|
||||||
mkPythonDerivation = makeOverridable( callPackage ../development/interpreters/python/mk-python-derivation.nix {
|
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`.
|
# Derivations built with `buildPythonPackage` can already be overriden with `override`, `overrideAttrs`, and `overrideDerivation`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user