forked from mirrors/nixpkgs
python3Packages.certifi: Ignore /no-cert-file.crt in NIX_SSL_CERT_FILE
This commit is contained in:
parent
de033ae75a
commit
92f67f68b3
|
@ -1,8 +1,8 @@
|
|||
diff --git a/certifi/core.py b/certifi/core.py
|
||||
index de02898..3ec9147 100644
|
||||
index de02898..c033d20 100644
|
||||
--- a/certifi/core.py
|
||||
+++ b/certifi/core.py
|
||||
@@ -4,6 +4,7 @@ certifi.py
|
||||
@@ -4,15 +4,25 @@ certifi.py
|
||||
|
||||
This module returns the installation location of cacert.pem or its contents.
|
||||
"""
|
||||
|
@ -10,16 +10,26 @@ index de02898..3ec9147 100644
|
|||
import sys
|
||||
|
||||
|
||||
@@ -12,7 +13,7 @@ if sys.version_info >= (3, 11):
|
||||
+def get_cacert_path_from_environ():
|
||||
+ path = os.environ.get("NIX_SSL_CERT_FILE", None)
|
||||
+
|
||||
+ if path == "/no-cert-file.crt":
|
||||
+ return None
|
||||
+
|
||||
+ return path
|
||||
+
|
||||
+
|
||||
if sys.version_info >= (3, 11):
|
||||
|
||||
from importlib.resources import as_file, files
|
||||
|
||||
_CACERT_CTX = None
|
||||
- _CACERT_PATH = None
|
||||
+ _CACERT_PATH = os.environ.get("NIX_SSL_CERT_FILE", None)
|
||||
+ _CACERT_PATH = get_cacert_path_from_environ()
|
||||
|
||||
def where() -> str:
|
||||
# This is slightly terrible, but we want to delay extracting the file
|
||||
@@ -39,14 +40,16 @@ if sys.version_info >= (3, 11):
|
||||
@@ -39,14 +49,16 @@ if sys.version_info >= (3, 11):
|
||||
return _CACERT_PATH
|
||||
|
||||
def contents() -> str:
|
||||
|
@ -34,11 +44,11 @@ index de02898..3ec9147 100644
|
|||
|
||||
_CACERT_CTX = None
|
||||
- _CACERT_PATH = None
|
||||
+ _CACERT_PATH = os.environ.get("NIX_SSL_CERT_FILE", None)
|
||||
+ _CACERT_PATH = get_cacert_path_from_environ()
|
||||
|
||||
def where() -> str:
|
||||
# This is slightly terrible, but we want to delay extracting the
|
||||
@@ -74,7 +77,9 @@ elif sys.version_info >= (3, 7):
|
||||
@@ -74,7 +86,9 @@ elif sys.version_info >= (3, 7):
|
||||
return _CACERT_PATH
|
||||
|
||||
def contents() -> str:
|
||||
|
@ -49,16 +59,16 @@ index de02898..3ec9147 100644
|
|||
|
||||
else:
|
||||
import os
|
||||
@@ -84,6 +89,8 @@ else:
|
||||
@@ -84,6 +98,8 @@ else:
|
||||
Package = Union[types.ModuleType, str]
|
||||
Resource = Union[str, "os.PathLike"]
|
||||
|
||||
+ _CACERT_PATH = os.environ.get("NIX_SSL_CERT_FILE", None)
|
||||
+ _CACERT_PATH = get_cacert_path_from_environ()
|
||||
+
|
||||
# This fallback will work for Python versions prior to 3.7 that lack the
|
||||
# importlib.resources module but relies on the existing `where` function
|
||||
# so won't address issues with environments like PyOxidizer that don't set
|
||||
@@ -102,7 +109,14 @@ else:
|
||||
@@ -102,7 +118,14 @@ else:
|
||||
def where() -> str:
|
||||
f = os.path.dirname(__file__)
|
||||
|
||||
|
|
Loading…
Reference in a new issue