Unpack the release's Tcl/Tk again when its pinned installer changed or the last unpack stopped.

make_launcher.py reused WORK/tcltk whenever DLLs/_tkinter.pyd was there: after a new Python or Tcl/Tk pin the old
files went into the release while its runtime id said new ones did, and an msiexec run cut short after that file
was written was trusted too. A stamp naming the msi, written once the unpack is complete, now decides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-08 09:29:53 -05:00
parent 138b8c8c29
commit dc1afcb54f

View File

@@ -113,10 +113,13 @@ def version():
# ---------------------------------------------------------------- python/
def tcltk_files():
"""The Tcl/Tk files of the pinned msi, unpacked into WORK/tcltk once. The stamp names the msi they came from and
is written last: an unpack from an older pin, or one stopped after _tkinter.pyd was written, is done again."""
dest = WORK / 'tcltk'
if (dest / 'DLLs' / '_tkinter.pyd').is_file():
return dest
msi = fetch('tcltk')
stamp, want = dest / '.unpacked-from', f'{msi.name} {msi.stat().st_size}'
if (dest / 'DLLs' / '_tkinter.pyd').is_file() and stamp.is_file() and stamp.read_text() == want:
return dest
shutil.rmtree(dest, ignore_errors=True)
dest.mkdir(parents=True)
if os.name == 'nt': # an administrative image: copies the files, installs nothing
@@ -125,6 +128,7 @@ def tcltk_files():
run(['msiextract', '-C', dest, msi], stdout=subprocess.DEVNULL)
if not (dest / 'DLLs' / '_tkinter.pyd').is_file():
sys.exit(f'{dest}: no _tkinter.pyd in {msi.name}')
stamp.write_text(want)
return dest