voice-dictation/scripts/pyi_rth_tk.py

17 lines
497 B
Python

"""Point Tcl/Tk at bundled scripts rather than build-machine installations."""
import os
import sys
from pathlib import Path
if hasattr(sys, "_MEIPASS"):
base = Path(sys._MEIPASS)
for variable, candidates in (
("TCL_LIBRARY", ("_tcl_data", "tcl")),
("TK_LIBRARY", ("_tk_data", "tk")),
):
for name in candidates:
directory = base / name
if directory.is_dir():
os.environ[variable] = str(directory)
break