zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
U
X±d|±ã@sÆddlZddlZddlZddlmZddlmZddlmZddlm    Z    ddl
m Z m Z ddl mZe e¡ZGdd    „d    ƒZGd
d „d ƒZed ƒZed ƒZedƒZedƒZdd„Zdd„ZeZeZdS)éN)Úcompat)Úisolated)Úlog)Ú    bindepend)ÚhooksÚmisc)Ú _modules_infoc@seZdZddd„Zdd„ZdS)Ú QtModuleInfoNcCs ||_||_||_|pg|_dS)N©ÚmoduleÚ
shared_libÚ translationÚplugins)Úselfr r r r©rúZd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\PyInstaller/utils/hooks/qt/__init__.pyÚ__init__OszQtModuleInfo.__init__cCs$d|j›d|j›d|j›d|j›S)Nz(module=z , shared_lib=z, translation=z
, plugins=r
©rrrrÚ__repr__`szQtModuleInfo.__repr__)NNN)Ú__name__Ú
__module__Ú __qualname__rrrrrrr    Ns
r    c@szeZdZdd„Zdd„Zdd„Zdd„Zd    d
„Zd d „Ze    d d„ƒZ
dd„Z ddd„Z dd„Z dd„Zdd„Zdd„ZdS)Ú QtLibraryInfocCs@|dkrtd |¡ƒ‚||_|dk|_|dkr2dnd|_|dkrzt d¡}Wntk
rfd    }YnX|r~tj     
dd
¡|_ ntj     
dd ¡|_ n¤|d krèzt d ¡}Wntk
r¾d}YnX|rÖtj     
d d¡|_ ntj     
d d ¡|_ nL|dkrt j rd|_ ntj     
dd ¡|_ n t j r$d|_ ntj     
dd ¡|_ | ¡dS)N)ÚPyQt5ÚPyQt6ÚPySide2ÚPySide6zInvalid namespace: {0}>rr>rréérzPyQt5 >= 5.15.4FZQt5ÚQtrzPyQt6 >= 6.0.3TZQt6rr)Ú    ExceptionÚformatÚ    namespaceÚis_pyqtÚqt_majorrZis_module_satisfiesÚAttributeErrorÚosÚpathÚjoinÚ
qt_rel_dirrÚis_winÚ_load_module_info)rr"Z
new_layoutrrrrks:
 
    
 
zQtLibraryInfo.__init__cCsd|j›dS)NzQtLibraryInfo(ú)©r"rrrrr¨szQtLibraryInfo.__repr__cCs$d|jkrt|ƒ‚| ¡t||ƒS)NÚversion)Ú__dict__r%Ú _load_qt_infoÚgetattr)rÚnamerrrÚ __getattr__¬s
zQtLibraryInfo.__getattr__c
Cszd|_tjdd„ƒ}z||jƒ}Wn4tk
rV}zt d||¡i}W5d}~XYnX| ¡D]\}}t|||ƒq`dS)z¥
        Load and process Qt library information. Called on the first access to the related attributes of the class
        (e.g., `version` or `location`).
        Nc sÚddl}ddl}ddl}| d|¡}|j‰|j}||jƒ}tˆdƒrldd„tˆj    ƒDƒ}‡fdd„|Dƒ}n$dd„tˆƒDƒ}‡fd    d„|Dƒ}|j
  |j ¡}    zˆ  ¡ ¡}
Wntk
rÆg}
YnXˆ ¡|
||    d
œS) Nrú.QtCorer'cSsg|]}| d¡r|‘qS©ÚPath©Úendswith©Ú.0ÚxrrrÚ
<listcomp>Ös
zNQtLibraryInfo._load_qt_info.<locals>._read_qt_library_info.<locals>.<listcomp>cs i|]}|ˆ tˆj|ƒ¡“qSr)r'r1Ú LibraryPathr9©Ú QLibraryInforrÚ
<dictcomp>×szNQtLibraryInfo._load_qt_info.<locals>._read_qt_library_info.<locals>.<dictcomp>cSsg|]}| d¡r|‘qSr5r7r9rrrr<Üs
csi|]}|ˆ tˆ|ƒ¡“qSr)Úlocationr1r9r>rrr@Ýs)Zis_debug_buildr.rAÚpackage_location)r&ÚsysÚ    importlibÚ import_moduler?ÚQCoreApplicationÚargvÚhasattrÚdirr=r'ÚdirnameÚ__file__r.Úsegmentsr%Z isDebugBuild) Úpackager&rCrDÚQtCorerFÚappZ
path_namesrArBr.rr>rÚ_read_qt_library_infoÃs, 
 
 
üz:QtLibraryInfo._load_qt_info.<locals>._read_qt_library_infoz(%s: failed to obtain Qt library info: %s)    r.rÚdecorater"r ÚloggerÚwarningÚitemsÚsetattr)rrPÚqt_infoÚeÚkÚvrrrr0·s    
+zQtLibraryInfo._load_qt_infocCsœtƒ|_tƒ|_tjD]€}|jr8t |j¡}|j|kr8qt|j    |j
rVd|j ›|j
›nd|j |j d}|j    dk    r|||j|j    <|j
dk    r||j|j
 ¡<qdS)zý
        Process the Qt modules info definition list and construct two dictionaries:
         - dictionary that maps Qt python module names to Qt module info entries
         - dictionary that maps shared library names to Qt module info entries
        rNr
)ÚdictÚpython_modulesÚshared_librariesrZQT_MODULES_INFOZbindingsZprocess_namespace_stringsr"r    r r r$r rÚlower)rÚentryZapplicable_bindingsZ
info_entryrrrr+ùs"
 
ü
 
zQtLibraryInfo._load_module_infocs"tƒ}tƒ}tƒ}|jdkr&gggfSt d||¡| dd¡d}||jkrv|j|}| |j¡|jrv|     |j¡t
  |¡}tt   |¡ƒ}|rl| ¡}    tjrÂ|j|jr°dnd}
t  |    |
¡}    tj tj |    ¡¡d ¡} tjr tj | ¡dd    kr tj | ¡d} |  d
¡r$| d d…} tjrŠ|  d ¡rh|  d t|jƒ¡shd t|jƒ| d d…} |  dt|jƒ¡rŠ| dd…} |  d¡r¢| dd…} t d||    | ¡| dkrØ| d¡sØt d||    ¡qŽ| |jkrŽt d||    | ¡|j| }|j r:|j |kr"| t   |    ¡¡qŽ|     |j!d|j ¡qŽ| |j¡|jrZ|     |j¡| t   |    ¡¡qŽg} |D]} | | "| ¡7} qtg}|jd}tj #|j$d¡‰|D]N}tj #||d¡}t% %|¡}|rê|‡fdd„|Dƒ7}nt &d||¡q¬t'|ƒ}t d|||| |¡|| |fS)a
        Collect all dependencies (hiddenimports, binaries, datas) for the given Qt python module.
 
        This function performs recursive analysis of extension module's link-time dependencies, and uses dictionaries
        built by `_load_module_info` to discover associated plugin types, translation file base names, and hidden
        imports that need to be collected.
        Nz%s: processing module %s...Ú.ééÿÿÿÿÚ BinariesPathÚ
PrefixPathrz.soÚlibéZqtééþÿÿÿZ_condaiúÿÿÿz3%s: raw imported library name %s -> parsed name %s.)Zqt5qmlZqt6qml)ÚQtQmlÚQtQuickz!%s: ignoring imported library %s.zI%s: collecting Qt module associated with imported shared library %s (%s).ÚTranslationsPathÚ translationsz_*.qmcsg|] }|ˆf‘qSrr)r:Ztranslation_file©Ztranslation_dstrrr<°sz0QtLibraryInfo.collect_module.<locals>.<listcomp>z\%s: could not find translations with base name %r! These translations will not be collected.zJ%s: dependencies for %s:
  hiddenimports = %r
  binaries = %r
  datas = %r)(Úsetr.rRÚdebugÚsplitr[Úupdaterr ÚaddrÚget_module_file_attributerÚ
getImportsÚpoprr*rAr#Z getfullnameofr&r'ÚsplitextÚbasenamer]Úis_linuxÚ
startswithÚ    is_darwinÚstrr$r8r\r r"Úcollect_pluginsr(r)ÚglobrSÚlist)rÚ module_nameZ hiddenimportsZtranslation_base_namesZ plugin_typesZshort_module_nameZqt_module_infoÚ module_fileZimported_librariesZimported_libraryZ dll_locationZlib_nameÚbinariesÚ plugin_typeÚdatasZtranslation_srcZtranslation_base_nameZtranslation_patternZtranslation_filesrrlrÚcollect_modulesž
 
 
 
 
 
   "   
 
þ
 
 
þüzQtLibraryInfo.collect_modulecCsndd„|Dƒ}g}|D]R}tj tj |¡¡}| d¡r^tj |¡ddd…d}||kr^q| |¡q|S)zì
        Filter the provided list of Qt plugin files and remove the debug variants, under the assumption that both the
        release version of a plugin (qtplugin.dll) and its debug variant (qtplugind.dll) appear in the list.
        cSs h|]}tj tj |¡¡’qSr)r&r'Únormcaserv)r:ÚfrrrÚ    <setcomp>Êsz8QtLibraryInfo._filter_release_plugins.<locals>.<setcomp>zd.dllrNraz.dll)r&r'r„rvr8ruÚappend)Ú plugin_filesZplugin_basenamesZrelease_plugin_filesZplugin_filenameZplugin_basenameZ release_namerrrÚ_filter_release_pluginsÃs
 z%QtLibraryInfo._filter_release_pluginscs~|jd}tj |¡s&td|›dƒ‚t tj ||¡¡}tj    rJ| 
|¡}t   d|||¡tj |j d|¡‰‡fdd„|DƒS)z…
        Collect all plugins of the specified type from the Qt plugin directory.
 
        Returns list of (src, dst) tuples.
        Z PluginsPathzQt plugin directory 'z' does not exist!z-%s: found plugin files for plugin type %r: %rrcsg|] }|ˆf‘qSrr)r:Z plugin_file©Zplugin_dst_dirrrr<ñsz1QtLibraryInfo.collect_plugins.<locals>.<listcomp>)rAr&r'Úisdirr rZ dlls_in_dirr(rr*r‰rRrnr))rrZplugin_src_dirrˆrrŠrr{Øs
 
zQtLibraryInfo.collect_pluginsNcsŽ|pg}t |j¡ ¡j‰|j|jr(dnd‰t ˆ¡ ¡‰‡‡fdd„}g}|D] }||ƒ}|sjgS||7}qR|D]}|||ƒ7}qx|S)a‡
        Try to find Qt DLLs from the specified mandatory pattern list. If all mandatory patterns resolve to DLLs,
        collect them all, as well as any DLLs from the optional pattern list. If a mandatory pattern fails to resolve
        to a DLL, return an empty list.
 
        This allows all-or-none collection of particular groups of Qt DLLs that may or may not be available.
        rbrccsNg}ˆ |¡}|D]6}ˆ|jkr.|j ˆ¡}nd}| t|ƒt|ƒf¡q|S)Nr_)r|ÚparentsÚparentÚ relative_tor‡rz)Z dll_patternÚdiscovered_dllsZ    dll_filesZdll_fileZ dst_dll_dir©Zdll_pathÚpackage_parent_pathrrÚ_process_dll_patterns
 
z@QtLibraryInfo._collect_all_or_none.<locals>._process_dll_pattern)Úpathlibr6rBÚresolverrAr#)rZmandatory_dll_patternsZoptional_dll_patternsr’Zcollected_dllsÚpatternrrrrÚ_collect_all_or_noneós
z"QtLibraryInfo._collect_all_or_nonecCsLg}tjsgS|| ddgdg¡7}|| dg¡7}|| dddg¡7}|S)zÏ
        Collect extra binaries/DLLs required by Qt. These include ANGLE DLLs, OpenGL software renderer DLL, and ICU
        DLLs. Applicable only on Windows (on other OSes, empty list is returned).
        z
libEGL.dllz libGLESv2.dllzd3dcompiler_??.dllzopengl32sw.dllz icudt??.dllz icuin??.dllz icuuc??.dll)rr*r–)rr€rrrÚcollect_extra_binaries%sz$QtLibraryInfo.collect_extra_binariesc
CsÌ|jdkrgStjsgStjdd„ƒ}||jƒs4gSt |j¡     ¡j
}|j d|j df}d}g}|D]`}t |¡     ¡}|D]H}||}|  ¡s’q|||j krª|j
 |¡}    nd}    | t|ƒt|    ƒf¡q|qf|S)z·
        Collect extra binaries/DLLs required by the QtNetwork module. These include OpenSSL DLLs. Applicable only
        on Windows (on other OSes, empty list is returned).
        NcSsFddl}ddl}| d|¡}|j}| d|¡}|j}||jƒ}| ¡S)Nrr4z
.QtNetwork)rCrDrErFÚ
QSslSocketrGZ supportsSsl)rMrCrDrNrFÚ    QtNetworkr˜rOrrrÚ _ssl_enabledLs  
z;QtLibraryInfo.collect_qtnetwork_files.<locals>._ssl_enabledrbrc)z libeay32.dllz ssleay32.dllzlibssl-1_1-x64.dllzlibcrypto-1_1-x64.dllr_)r.rr*rrQr"r“r6rBr”rrAÚexistsrŒrŽr‡rz)
rršr‘Ú    locationsZ    dll_namesr€rAÚdllZ dll_file_pathZ dst_dll_pathrrrÚcollect_qtnetwork_files=s.
 
 
 
z%QtLibraryInfo.collect_qtnetwork_filescs”|jdkrggfSd|jkr(|jd‰n
|jd‰ˆrBtj ˆ¡sXt d|ˆ¡ggfStj |jd¡‰ˆˆfg}‡‡fdd„t     
ˆ¡Dƒ}||fS)zH
        Collect additional binaries and data for QtQml module.
        NZQmlImportsPathZQml2ImportsPathz<%s: QML directory %r does not exist. QML files not packaged.Zqmlc s0g|](}|tj ˆtj tj |ˆ¡¡¡f‘qSr)r&r'r(rJÚrelpath)r:Zqml_plugin_file©Z qml_dst_dirZ qml_src_dirrrr<•sþþz5QtLibraryInfo.collect_qtqml_files.<locals>.<listcomp>) r.rAr&r'r‹rRrSr(r)rZdlls_in_subdirs)rr‚r€rr rÚcollect_qtqml_fileszs
 
 
 
 
 ûz!QtLibraryInfo.collect_qtqml_filesc    Csºg}g}|j}d}tjr4tj tj |jdd¡¡}|rÔ|jd}ddddd    d
d d d g    }|jdkrp|     ddg¡|D]>}|d}tj |d|¡}    tj |d|¡}
|t
  |    |
d¡7}qt|tj |ddd¡dfg7}njd} d} |  tj |jd| ¡tj |d| ¡f¡|  tj |jd| ¡tj || ¡f¡tj |tj  |jd|jd¡¡} |  tj |jdd¡| f¡tj |jdd¡}tj |¡s0ddlm}tj  |jd|jd¡}|d krÐt d!||¡tjd"krê| tjd#¡}tj |d$d¡}t|d%ƒ$}td&|d'td( |¡|d'W5QRX|  || f¡tjr²t
 |jd)¡}t |¡}|D]L}tj |¡ d*¡rdtj tj |¡d+d,¡}t   |¡rd|  |d+f¡qd||fS)-z]
        Collect QtWebEngine helper process executable, translations, and resources.
        FZ LibrariesPathzQtWebEngineCore.frameworkZDataPathrNZQtWebEngineCorerirhZ QtQmlModelsr™ZQtGuiZ QtWebChannelZ QtPositioningrZQtOpenGLZQtDBusz
.frameworkrdTZ    Resourcesr_Zqtwebengine_localesÚ    resourcesrjrkZLibraryExecutablesPathrczQtWebEngineProcess*zqt.confr)ÚCONF)r_z..zI%s: unexpected relative Qt prefix path for QtWebEngineProcess qt.conf: %sú\ú/ZworkpathÚwz[Paths])Úfilez Prefix = {}z.QtWebEngineCorez
libnss3.soZnssz*.so)!r)rryr&r'r›r(rAr$ÚextendrZcollect_system_data_filesr‡rŸÚisfileZPyInstaller.configr£rRrSÚsepÚreplaceÚopenÚprintr!rwrrr"rrsrvrxrJr|)rr€r‚Z rel_data_pathZis_macos_frameworkZ    data_pathÚ    librariesÚiZ framework_dirZframework_src_pathZframework_dst_pathZlocalesr¢ÚdestZ qt_conf_filer£Z
rel_prefixÚfprZmodule_importsÚimpZnss_globrrrÚcollect_qtwebengine_filesŸs„ÿ
þ
 þ(ÿ 
ÿ   
 z'QtLibraryInfo.collect_qtwebengine_files)N)rrrrrr3r0r+rƒÚ staticmethodr‰r{r–r—ržr¡r³rrrrrjs= B")
 
2=%rrrrrcCsD|dkr tS|dkrtS|dkr$tS|dkr0tStd|›dƒ‚dS)z@
    Return QtLibraryInfo instance for the given namespace.
    rrrrzInvalid namespace: ú!N)Úpyqt5_library_infoÚpyqt6_library_infoÚpyside2_library_infoÚpyside6_library_infoÚ
ValueErrorr-rrrÚget_qt_library_info)sr»cCs`tj tj |¡¡\}}| d¡s&t‚| d¡s4t‚|dd…}| d¡d}t|ƒ}| |¡S)Nz.pyzhook-rr_r)    r&r'rurvrxÚAssertionErrorror»rƒ)Z    hook_fileÚ    hook_nameZhook_extr~r"rVrrrÚadd_qt_dependencies>s r¾)r|r&r“Z PyInstallerrrrÚloggingZPyInstaller.dependrZPyInstaller.utilsrrZPyInstaller.utils.hooks.qtrÚ    getLoggerrrRr    rr¶r·r¸r¹r»r¾Zadd_qt5_dependenciesZadd_qt6_dependenciesrrrrÚ<module> s0     
7>