34 lines
1013 B
Python
34 lines
1013 B
Python
# Runtime hook: load this CPython's Tcl/Tk before Graphviz's tcl86t.dll (8.6.10)
|
|
# can shadow them. PyInstaller then points TCL_LIBRARY at bundled _tcl_data (8.6.12).
|
|
def _pyi_rthook():
|
|
import os
|
|
import sys
|
|
|
|
if not getattr(sys, "frozen", False):
|
|
return
|
|
base = getattr(sys, "_MEIPASS", None) or os.path.dirname(sys.executable)
|
|
os.environ["PATH"] = base + os.pathsep + os.environ.get("PATH", "")
|
|
try:
|
|
os.add_dll_directory(base)
|
|
except (AttributeError, OSError):
|
|
pass
|
|
tcldir = os.path.join(base, "_tcl_data")
|
|
tkdir = os.path.join(base, "_tk_data")
|
|
if os.path.isdir(tcldir):
|
|
os.environ["TCL_LIBRARY"] = tcldir
|
|
if os.path.isdir(tkdir):
|
|
os.environ["TK_LIBRARY"] = tkdir
|
|
try:
|
|
import ctypes
|
|
|
|
for name in ("tcl86t.dll", "tk86t.dll"):
|
|
path = os.path.join(base, name)
|
|
if os.path.isfile(path):
|
|
ctypes.WinDLL(path)
|
|
except Exception:
|
|
pass
|
|
|
|
|
|
_pyi_rthook()
|
|
del _pyi_rthook
|