Skip to content

Commit d5a75f3

Browse files
committed
ci: Relaunch create-artifacts.py via subprocess
There have been a number of CI issues related to creating artifacts, where no output is produced from the script even though it seemingly starts successfully. In case this comes from `execvpe` somehow, switch to relaunching via subprocess.
1 parent 69c34f8 commit d5a75f3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

ci/create-artifacts.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,29 @@ def main():
4949

5050
if __name__ == "__main__":
5151
print("Starting script...") # For debugging CI failures
52-
# FIXME(ci): remove after the bump to windoes-2025 GHA images
52+
print("version: ", sys.version)
53+
# FIXME(ci): If the windows-2025 images update to a minimum python above 3.9,
54+
# this can be removed.
55+
#
5356
# Python <= 3.9 does not support the very helpful `root_dir` argument,
5457
# and that is the version used by the Windows GHA images. Rather than
5558
# using setup-python or doing something in the CI script, just find
5659
# the newer version and relaunch if this happens to be run with an old
5760
# version.
5861
try:
5962
glob("", root_dir="")
60-
except TypeError:
63+
except TypeError as e:
6164
if os.environ.get("CI") is None:
62-
sys.exit(1)
65+
raise e # Just fail if we're not in CI
6366

6467
# Find the next 3.1x Python version
6568
dirs = sorted(Path(r"C:\hostedtoolcache\windows\Python").iterdir())
6669
usepy = next(x for x in dirs if r"\3.1" in str(x))
6770
py = usepy.joinpath(r"x64\python.exe")
68-
print(f"relaunching with {py}")
69-
os.execvp(py, [__file__] + sys.argv)
71+
args = [py, __file__, *sys.argv[1:]]
72+
print(f"relaunching with {args}")
73+
sp.run(args, check=True)
74+
exit()
7075

7176
main()
7277
else:

0 commit comments

Comments
 (0)