Skip to content

Commit ebd0a52

Browse files
ichard26sbidoul
authored andcommitted
Don't pass --cert to build subprocesses unless also given on CLI
This fixes a regression introduced by commit 34fc0e2. After that patch, --cert would always be given to the nested pip call, either pointing to pip's CA bundle, or to whatever the user had set on the CLI. This means truststore is always disabled... which is bad. We used to have to do some shenanigans to pass the CA bundle to the subprocess as certifi doesn't (didn't?) really play nice when in a zipfile. Regardless, we stopped packing pip into a zipfile to provision the build environment a while ago, so we can simply do the normal thing and pass --cert when it's actually given. Otherwise, the subprocess will find its CA bundle without fuss. There apparently aren't any truststore tests (as testing system CAs is probably a pain), so I didn't add one here either. At some point, we should, though.
1 parent aea8629 commit ebd0a52

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

news/13186.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix regression where truststore would never be used while installing build dependencies.

src/pip/_internal/build_env.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from types import TracebackType
1212
from typing import TYPE_CHECKING, Iterable, List, Optional, Set, Tuple, Type, Union
1313

14-
from pip._vendor.certifi import where
1514
from pip._vendor.packaging.version import Version
1615

1716
from pip import __file__ as pip_location
@@ -246,8 +245,6 @@ def _install_requirements(
246245
# target from config file or env var should be ignored
247246
"--target",
248247
"",
249-
"--cert",
250-
finder.custom_cert or where(),
251248
]
252249
if logger.getEffectiveLevel() <= logging.DEBUG:
253250
args.append("-vv")
@@ -276,6 +273,8 @@ def _install_requirements(
276273
args.extend(["--proxy", finder.proxy])
277274
for host in finder.trusted_hosts:
278275
args.extend(["--trusted-host", host])
276+
if finder.custom_cert:
277+
args.extend(["--cert", finder.custom_cert])
279278
if finder.client_cert:
280279
args.extend(["--client-cert", finder.client_cert])
281280
if finder.allow_all_prereleases:

0 commit comments

Comments
 (0)