@@ -27,9 +27,21 @@ def parse_version_wrapper(txt):
2727 return version
2828
2929
30+ def _run (cmd , ** kwargs ):
31+ # For some reason, when combined with wsl calls, Python thinks the directory we're in has been deleted
32+ # so os.getcwd() fails
33+ saved_directory = os .getcwd ()
34+ subprocess .run (cmd , ** kwargs )
35+ os .chdir (saved_directory )
36+
37+
3038def _verbose_run (cmd , ** kwargs ):
3139 print (' ' .join (c if ' ' not in c else f'"{ c } "' for c in cmd ), flush = True )
40+ # For some reason, when combined with wsl calls, Python thinks the directory we're in has been deleted
41+ # so os.getcwd() fails
42+ saved_directory = os .getcwd ()
3243 subprocess .run (cmd , ** kwargs )
44+ os .chdir (saved_directory )
3345
3446
3547def clear_pythia_directory ():
@@ -56,7 +68,7 @@ def del_rw(action, name, exc):
5668def create_interpreters (version , dest ):
5769 version = parse_version_wrapper (version )
5870 print (f'Creating Python { version } interpreters in "{ dest } " directory...' , flush = True )
59- subprocess . run ([sys .executable , os .path .join ('tools' , 'create_embedded_python.py' ), '--version' , str (version ), dest ], check = True )
71+ _run ([sys .executable , os .path .join ('tools' , 'create_embedded_python.py' ), '--version' , str (version ), dest ], check = True )
6072
6173
6274def _get_embed (version , system , arch ):
@@ -113,7 +125,7 @@ def run_tests(version, arch, system):
113125
114126def build_pbos ():
115127 print ('Building PBOs...' , flush = True )
116- subprocess . run ([sys .executable , os .path .join ('tools' , 'create_pbos.py' )], check = True )
128+ _run ([sys .executable , os .path .join ('tools' , 'create_pbos.py' )], check = True )
117129
118130
119131def copy_templates (version ):
@@ -136,7 +148,7 @@ def copy_templates(version):
136148def safety_checks (version ):
137149 version = parse_version_wrapper (version )
138150 print ('Running safety checks...' , flush = True )
139- subprocess . run ([sys .executable , os .path .join ('tools' , 'safety_checks.py' ), str (version )], check = True )
151+ _run ([sys .executable , os .path .join ('tools' , 'safety_checks.py' ), str (version )], check = True )
140152
141153
142154def pack_mod ():
0 commit comments