@@ -16,13 +16,23 @@ def setup_virtualenv(self, env_name, custom_env_dir=None, mirror_url=None):
16
16
env_dir .mkdir (parents = True , exist_ok = True )
17
17
print (f"Creating virtual environment at { env_dir } for { env_name } ..." )
18
18
subprocess .run (["python" , "-m" , "venv" , str (env_dir )], check = True )
19
- subprocess .run (["python" , "-m" , "pip" , "install" , "--upgrade" , "pip" , "-i" , mirror_url ])
19
+
20
+ # Upgrade pip with or without mirror URL
21
+ pip_upgrade_command = ["python" , "-m" , "pip" , "install" , "--upgrade" , "pip" ]
22
+ if mirror_url :
23
+ pip_upgrade_command += ["-i" , mirror_url ]
24
+ subprocess .run (pip_upgrade_command , check = True )
25
+
26
+ print (requirements_path )
20
27
if requirements_path .exists ():
21
28
print (f"Installing dependencies for { env_name } from { requirements_path } ..." )
22
29
pip_command = env_dir / "bin" / "pip" if platform .system () != "Windows" else env_dir / "Scripts" / "pip"
23
30
install_command = [str (pip_command ), "install" , "-r" , str (requirements_path )]
31
+
32
+ # Add mirror URL if provided
24
33
if mirror_url :
25
34
install_command += ["-i" , mirror_url ]
35
+
26
36
subprocess .run (install_command , check = True )
27
37
else :
28
38
print (f"No requirements.txt found for { env_name } . Skipping dependencies installation." )
0 commit comments