upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEmma <47298336+zzEmmazz@users.noreply.github.com>2026-11-22 23:21:26 +0200
committerEmma <47298336+zzEmmazz@users.noreply.github.com>2026-11-22 23:21:26 +0200
commit90a6b5d052d5e784cfbfd84002f8623612ed68b5 (patch)
tree31f825c319181a964f60d88848ea459b0d465f03 /tools
parent35fe778eb61071d8dbe5f82f9347ee303f7c212e (diff)
first_light.py: refuse a linked first_light even when nothing stale lies behind it
Review of #3577: reset_run_folders() judged first_light only through the dxbc and spirv folders it found. When first_light is a symlink or a junction to a folder that has neither, there was nothing to judge, and the new dxbc was created in the folder the link points to, outside the work folder. first_light itself is now checked before its children. tests/test_first_light.py gains the case with neither folder behind the link (symlink and junction): it fails on the previous commit with "SystemExit not raised" and the far folder gets a dxbc; with the check the run is refused and the far folder stays empty. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/first_light.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/first_light.py b/tools/first_light.py
index f54cc373f..2d6878afc 100644
--- a/tools/first_light.py
+++ b/tools/first_light.py
@@ -64,6 +64,15 @@ def reset_run_folders(work: str) -> str:
64 """ 64 """
65 base = os.path.join(work, "first_light") 65 base = os.path.join(work, "first_light")
66 real_base = os.path.join(os.path.realpath(work), "first_light") 66 real_base = os.path.join(os.path.realpath(work), "first_light")
67 # first_light itself is checked first: when it is a link to a folder with no dxbc or spirv in it, there is
68 # nothing stale to judge below, and the new dxbc would be created on the far side of the link.
69 if os.path.lexists(base) and (
70 not os.path.isdir(base) or os.path.normcase(os.path.realpath(base)) != os.path.normcase(real_base)
71 ):
72 raise SystemExit(
73 f"{base} is a symlink, a junction or a file: each run removes and creates folders under it and does "
74 "not follow a link to do it; remove it and run again"
75 )
67 stale = [os.path.join(base, name) for name in ("dxbc", "spirv") if os.path.lexists(os.path.join(base, name))] 76 stale = [os.path.join(base, name) for name in ("dxbc", "spirv") if os.path.lexists(os.path.join(base, name))]
68 for folder in stale: # both are checked before either is removed 77 for folder in stale: # both are checked before either is removed
69 real = os.path.join(real_base, os.path.basename(folder)) 78 real = os.path.join(real_base, os.path.basename(folder))