|
1 | 1 | diff --git a/src/pip/_vendor/certifi/core.py b/src/pip/_vendor/certifi/core.py
|
2 |
| -index 5d2b8cd32..8987449f6 100644 |
| 2 | +index 5d2b8cd32..b8140cf1a 100644 |
3 | 3 | --- a/src/pip/_vendor/certifi/core.py
|
4 | 4 | +++ b/src/pip/_vendor/certifi/core.py
|
5 |
| -@@ -33,7 +33,7 @@ try: |
| 5 | +@@ -8,7 +8,21 @@ This module returns the installation location of cacert.pem or its contents. |
| 6 | + """ |
| 7 | + import os |
| 8 | + |
| 9 | ++ |
| 10 | ++class _PipPatchedCertificate(Exception): |
| 11 | ++ pass |
| 12 | ++ |
| 13 | ++ |
| 14 | + try: |
| 15 | ++ # Return a certificate file on disk for a standalone pip zipapp running in |
| 16 | ++ # an isolated build environment to use. Passing --cert to the standalone |
| 17 | ++ # pip does not work since requests calls where() unconditionally on import. |
| 18 | ++ _PIP_STANDALONE_CERT = os.environ.get("_PIP_STANDALONE_CERT") |
| 19 | ++ if _PIP_STANDALONE_CERT: |
| 20 | ++ def where(): |
| 21 | ++ return _PIP_STANDALONE_CERT |
| 22 | ++ raise _PipPatchedCertificate() |
| 23 | ++ |
| 24 | + from importlib.resources import path as get_path, read_text |
| 25 | + |
| 26 | + _CACERT_CTX = None |
| 27 | +@@ -33,11 +47,13 @@ try: |
6 | 28 | # We also have to hold onto the actual context manager, because
|
7 | 29 | # it will do the cleanup whenever it gets garbage collected, so
|
8 | 30 | # we will also store that at the global level as well.
|
9 | 31 | - _CACERT_CTX = get_path("certifi", "cacert.pem")
|
10 | 32 | + _CACERT_CTX = get_path("pip._vendor.certifi", "cacert.pem")
|
11 | 33 | _CACERT_PATH = str(_CACERT_CTX.__enter__())
|
12 |
| - |
| 34 | + |
13 | 35 | return _CACERT_PATH
|
| 36 | + |
| 37 | ++except _PipPatchedCertificate: |
| 38 | ++ pass |
| 39 | + |
| 40 | + except ImportError: |
| 41 | + # This fallback will work for Python versions prior to 3.7 that lack the |
0 commit comments