zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
U
X±dÃ*ã@s¦ddlZddlZddlmZddlmZddlmZddlmZddl    m
Z
e  e ¡Z dZdZejd    d
„ƒZeƒ\ZZZZd d „Zd d„Zdd„Zdd„Zdd„ZdS)éN)Úcompat)Úisolated)Úlog)ÚTree)Ú    bindependÚtkÚtclcCs€zddl}ddlm}m}Wntk
r2YdSX| ¡}| d¡}z| d¡d}Wn|jk
rrd}YnX||||fS)    a%
    Isolated-subprocess helper to retrieve the basic Tcl/Tk information:
     - tcl_dir = path to the Tcl library/data directory.
     - tcl_version = Tcl version
     - tk_version = Tk version
     - tcl_theaded = boolean indicating whether Tcl/Tk is built with multi-threading support.
    rN)Ú TCL_VERSIONÚ
TK_VERSION)NNNFz info libraryztcl_platform(threaded)TF)    ÚtkinterZ_tkinterr    r
Ú ImportErrorZTclÚevalZgetvarZTclError)r r    r
rÚtcl_dirÚ tcl_threaded©rúUd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\PyInstaller/utils/hooks/tcl_tk.pyÚ_get_tcl_tk_infos    
 
 
rc    CsÐddl}|j |¡rdSzdd„|Dƒd}Wntk
rDYdSXd}d}t|dt ¡dP}| ¡D]@}| ¡     ¡}| 
d¡r†qjd    |kr’d
}d |kržd
}|rj|rjq¬qjW5QRX|rÌ|rÌt   d |¡dS) a
    If the current Tcl installation is a Teapot-distributed version of ActiveTcl *and* the current platform is macOS,
    log a non-fatal warning that the resulting executable will (probably) fail to run on non-host systems.
 
    PyInstaller does *not* freeze all ActiveTcl dependencies -- including Teapot, which is typically ignorable. Since
    Teapot is *not* ignorable in this case, this function warns of impending failure.
 
    See Also
    -------
    https://github.com/pyinstaller/pyinstaller/issues/621
    rNcSs"g|]}|d d¡r|d‘qS)ézinit.tcl)Úendswith)Ú.0ÚrrrrÚ
<listcomp>Xsz:_warn_if_activetcl_or_teapot_installed.<locals>.<listcomp>Fr)Úencodingú#Z    activetclTÚteapotzÿ
You appear to be using an ActiveTcl build of Tcl/Tk, which PyInstaller has
difficulty freezing. To fix this, comment out all references to "teapot" in:
 
     %s
 
See https://github.com/pyinstaller/pyinstaller/issues/621 for more information.
            ) Z macholib.utilÚutilZin_system_pathÚ
IndexErrorÚopenÚlocaleÚgetpreferredencodingÚ    readlinesÚstripÚlowerÚ
startswithÚloggerÚwarning)Útcl_rootÚtcltreeZmacholibZ init_resourceZmentions_activetclZmentions_teapotZ    init_fileÚlinerrrÚ&_warn_if_activetcl_or_teapot_installedDs4    
ùÿr)c
Cszd}d}d}d}t |¡}dd„}|D]B}tj |¡}| ¡}    d|    krT|}||ƒ}q&d|    kr&|}||ƒ}q&||f||fgS)a’
    Find Tcl and Tk shared libraries against which the _tkinter module is linked.
 
    Returns
    -------
    list
        list containing two tuples, one for Tcl and one for Tk library, where each tuple contains the library name and
        its full path, i.e., [(tcl_lib, tcl_libpath), (tk_lib, tk_libpath)]. If a library is not found, the
        corresponding tuple elements are set to None.
    NcSstjrt |¡}n|}|S)N)rZis_winrZ getfullnameof)ÚlibÚpathrrrÚ_get_library_paths z2find_tcl_tk_shared_libs.<locals>._get_library_pathrr)rZ
getImportsÚosr+Úbasenamer")
Útkinter_ext_fileZtcl_libZ tcl_libpathZtk_libZ
tk_libpathZ_tkinter_importsr,r*Zlib_nameZlib_name_lowerrrrÚfind_tcl_tk_shared_libszs  
     
 
r0cCsXtjr4t|ƒ}|dd}|dkr&dSd|kr4dSntj tj t¡dt›¡}t|fS)a
    Get a platform-specific 2-tuple of the absolute paths of the top-level external data directories for both
    Tcl and Tk, respectively.
 
    Returns
    -------
    list
        2-tuple that contains the values of `${TCL_LIBRARY}` and `${TK_LIBRARY}`, respectively.
    rrN)NNz Library/Frameworks/Tcl.frameworkr)    rÚ    is_darwinr0r-r+ÚjoinÚdirnamerÚ
tk_version)r/ZlibsZ path_to_tclZtk_dirrrrÚ _find_tcl_tk¦s
  r5cCsPt d¡d}d|›}tj |d|¡}tj |¡sDt d|¡gSt||dS)a 
    Get a list of TOC-style 3-tuples describing Tcl modules. The modules directory is separate from the library/data
    one, and is located at $tcl_root/../tclX, where X is the major Tcl version.
 
    Returns
    -------
    Tree
        Such list, if the modules directory exists.
    Ú.rrz..z(Tcl modules directory %s does not exist.)Úprefix)    Ú tcl_versionÚsplitr-r+r2Úisdirr$r%r)r&Ztcl_major_versionZmodules_dirnameZ modules_pathrrrÚ_collect_tcl_modulesÑs 
  r;cCs¾t|ƒ\}}tjr(|s(|s(t d¡gS|s:t d¡gStj |¡sVt d|¡gStj |¡srt d|¡gSt    |t
dddgd}t    |t ddd    gd}tjrªt ||ƒt |ƒ}|||S)
    Get a list of TOC-style 3-tuples describing all external Tcl/Tk data files.
 
    Returns
    -------
    Tree
        Such list.
    z‚Not collecting Tcl/Tk data - either python is using macOS' system Tcl/Tk framework, or Tcl/Tk data directories could not be found.z+Tcl/Tk improperly installed on this system.z"Tcl data directory "%s" not found.z!Tk data directory "%s" not found.Zdemosz*.libz tclConfig.sh)r7Zexcludesz tkConfig.sh)r5rr1r$ÚinfoÚerrorr-r+r:rÚ TCL_ROOTNAMEÚ TK_ROOTNAMEr)r;)r/r&Ztk_rootr'ZtktreeZtclmodulestreerrrÚcollect_tcl_tk_filesés*
ÿ
 
r@)rr-Z PyInstallerrrrÚloggingZPyInstaller.building.datastructrZPyInstaller.dependrÚ    getLoggerÚ__name__r$r?r>Zdecoraterrr8r4rr)r0r5r;r@rrrrÚ<module> s,     
 
%û6,+