Only sleep between rmtree and mkdir on Windows machines

This makes amalgamate builds slightly faster on non-Windows machines.
This commit is contained in:
Max Bernstein 2023-02-08 14:31:20 -05:00
parent 40c31fd1d1
commit a8bf40c7bf

View File

@ -19,6 +19,11 @@ import time
if os.path.exists("amalgamated"):
shutil.rmtree("amalgamated")
if os.name == "nt":
# On Windows, making a directory too soon after shutil.rmtree can fail
# with PermissionError. Sleep for 1 second as a simple hedge against
# this.
# See https://stackoverflow.com/a/60181105/569183
time.sleep(1)
os.mkdir("amalgamated")