Skip to content

Commit 3ea5eb0

Browse files
authored
remove fallback for certifi environment setup in penv_setup.py
1 parent 9152569 commit 3ea5eb0

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

builder/penv_setup.py

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -611,29 +611,21 @@ def _install_esptool_from_tl_install(platform, python_exe, uv_executable):
611611

612612
def _setup_certifi_env(env, python_exe=None):
613613
"""
614-
Setup certifi environment variables with priority from the given python_exe virtual environment.
615-
If python_exe is provided, runs a subprocess to extract certifi path from that env to guarantee penv usage.
616-
Falls back to importing certifi from current environment on failure.
614+
Setup certifi environment variables from the given python_exe virtual environment.
615+
Uses a subprocess call to extract certifi path from that environment to guarantee penv usage.
617616
"""
618-
cert_path = None
619-
if python_exe:
620-
try:
621-
# Run python executable from penv to get certifi path
622-
out = subprocess.check_output(
623-
[python_exe, "-c", "import certifi; print(certifi.where())"],
624-
text=True,
625-
timeout=5
626-
)
627-
cert_path = out.strip()
628-
except Exception:
629-
cert_path = None
630-
if not cert_path:
631-
try:
632-
import certifi
633-
cert_path = certifi.where()
634-
except Exception:
635-
print("Info: certifi not available; skipping CA environment setup.")
636-
return
617+
try:
618+
# Run python executable from penv to get certifi path
619+
out = subprocess.check_output(
620+
[python_exe, "-c", "import certifi; print(certifi.where())"],
621+
text=True,
622+
timeout=5
623+
)
624+
cert_path = out.strip()
625+
except Exception as e:
626+
print(f"Error: Failed to obtain certifi path from the virtual environment: {e}")
627+
return
628+
637629
# Set environment variables for certificate bundles
638630
os.environ["CERTIFI_PATH"] = cert_path
639631
os.environ["SSL_CERT_FILE"] = cert_path

0 commit comments

Comments
 (0)