File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 15
15
import sys
16
16
import sysconfig
17
17
import tempfile
18
+ import uuid
18
19
19
20
MOVEFILE_DELAY_UNTIL_REBOOT = 4
20
21
@@ -472,8 +473,12 @@ def run_rebuild():
472
473
tmp = tempfile .NamedTemporaryFile (delete = False )
473
474
tmp .close ()
474
475
os .unlink (tmp .name )
475
- shutil .move (sys .executable , tmp .name )
476
- ctypes .windll .kernel32 .MoveFileExW (tmp .name , None , MOVEFILE_DELAY_UNTIL_REBOOT )
476
+ temp_path = tmp .name
477
+ if os .path .splitdrive (temp_path )[0 ] == os .path .splitdrive (sys .executable )[0 ]:
478
+ shutil .move (sys .executable , temp_path )
479
+ else :
480
+ shutil .move (sys .executable , sys .executable + uuid .uuid4 ().hex + ".old" )
481
+ ctypes .windll .kernel32 .MoveFileExW (temp_path , None , MOVEFILE_DELAY_UNTIL_REBOOT )
477
482
478
483
shutil .move (os .path .join (build_dir , "python.exe" ), interpreter_path )
479
484
elif platform .system () == "Linux" :
You can’t perform that action at this time.
0 commit comments