@@ -611,29 +611,21 @@ def _install_esptool_from_tl_install(platform, python_exe, uv_executable):
611
611
612
612
def _setup_certifi_env (env , python_exe = None ):
613
613
"""
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.
617
616
"""
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
+
637
629
# Set environment variables for certificate bundles
638
630
os .environ ["CERTIFI_PATH" ] = cert_path
639
631
os .environ ["SSL_CERT_FILE" ] = cert_path
0 commit comments