This commit is contained in:
2026-01-31 16:11:25 -08:00
parent c854f8c6a8
commit dcf16e0cc4
6 changed files with 112 additions and 43 deletions

View File

@@ -100,8 +100,8 @@ def _resolve_verify_value(verify_ssl: bool) -> Union[bool, str]:
pass
return None
# Prefer pip_system_certs if available
for mod_name in ("pip_system_certs",):
# Prefer helpful modules if available (use safe checks to avoid first-chance import errors)
for mod_name in ("pip_system_certs", "certifi_win32"):
path = _try_module_bundle(mod_name)
if path:
try:
@@ -111,29 +111,18 @@ def _resolve_verify_value(verify_ssl: bool) -> Union[bool, str]:
logger.info(f"SSL_CERT_FILE not set; using bundle from {mod_name}: {path}")
return path
# Special-case helpers that merge system certs (eg. certifi_win32)
# Fallback to certifi
try:
import certifi_win32 as _cw # type: ignore
if hasattr(_cw, "add_windows_store_certs") and callable(_cw.add_windows_store_certs):
try:
_cw.add_windows_store_certs()
except Exception:
pass
try:
import certifi # type: ignore
import certifi # type: ignore
path = certifi.where()
if path:
try:
os.environ["SSL_CERT_FILE"] = path
except Exception:
pass
logger.info(
f"SSL_CERT_FILE not set; using certifi bundle after certifi_win32: {path}"
)
return path
path = certifi.where()
if path:
try:
os.environ["SSL_CERT_FILE"] = path
except Exception:
pass
logger.info(f"SSL_CERT_FILE not set; using certifi bundle: {path}")
return path
except Exception:
pass