hyb
2025-11-04 668edf874b4f77214a8ff4513e60e3c1a973f532
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
Ë
hñúh²Çãó`—dZddlZddlZddlZddlZddlmZddlmZddl    m
Z
m Z ddl    m Z ddlmZddlmZmZmZmZmZmZmZmZdd    lmZdd
lmZmZdd lmZm Z dd l!m"Z"dd l#m$Z$m%Z%m&Z&m'Z'ddl(m)Z)m*Z*m+Z+ddl,m-Z-m.Z.e j^e0«Z1dZ2dZ3dZ4dZ5Gd„de$«Z6da7dd„Z8d„Z9y)at
Define a modified ModuleGraph that can return its contents as a TOC and in other ways act like the old ImpTracker.
TODO: This class, along with TOC and Tree, should be in a separate module.
 
For reference, the ModuleGraph node types and their contents:
 
 nodetype         identifier        filename
 
 Script           full path to .py  full path to .py
 SourceModule     basename          full path to .py
 BuiltinModule    basename          None
 CompiledModule   basename          full path to .pyc
 Extension        basename          full path to .so
 MissingModule    basename          None
 Package          basename          full path to __init__.py
        packagepath is ['path to package']
        globalnames is set of global names __init__.py defines
 ExtensionPackage basename          full path to __init__.{so,dll}
        packagepath is ['path to package']
 
The main extension here over ModuleGraph is a method to extract nodes from the flattened graph and return them as a
TOC, or added to a TOC. Other added methods look up nodes by identifier and return facts about them, replacing what
the old ImpTracker list could do.
éN)Ú defaultdict)Údeepcopy)ÚHOMEPATHÚ PACKAGEPATH)Úlog)Údestination_name_for_extension)ÚBAD_MODULE_TYPESÚBINARY_MODULE_TYPESÚMODULE_TYPES_TO_TOC_DICTÚPURE_PYTHON_MODULE_TYPESÚPY3_BASE_MODULESÚVALID_MODULE_TYPESÚimportlib_load_sourceÚis_win)Úbytecode)ÚAdditionalFilesCacheÚModuleHookCache)ÚPreFindModulePathAPIÚPreSafeImportModuleAPI)Ú get_implies)Ú ModuleGraphÚDEFAULT_IMPORT_LEVELÚABSOLUTE_IMPORT_LEVELÚPackage)ÚDEBUGÚINFOÚTRACE)Úcollect_submodulesÚ
is_packagei0øÿÿiüÿÿiècóD‡—eZdZdZeeeeedœZd$ˆfd„    Zd„Z    d„Z
e d„«Z d„Z e Ze Zd„Zd    „Zd%ˆfd „    Zd „Zd „Zed
fˆfd„    Zˆfd„Zˆfd„Zd„Zd%d„Zd„Zd„Zd„Ze d%d„«Zd„Zd„Z d„Z!d„Z"d„Z#de$de%fd„Z&de'fd„Z(d$de'fd „Z)de*fd!„Z+de*fd"„Z,de*fd#„Z-ˆxZ.S)&ÚPyiModuleGraphaå
    Directed graph whose nodes represent modules and edges represent dependencies between these modules.
 
    This high-level subclass wraps the lower-level `ModuleGraph` class with support for graph and runtime hooks.
    While each instance of `ModuleGraph` represents a set of disconnected trees, each instance of this class *only*
    represents a single connected tree whose root node is the Python script originally passed by the user on the
    command line. For that reason, while there may (and typically do) exist more than one `ModuleGraph` instance,
    there typically exists only a singleton instance of this class.
 
    Attributes
    ----------
    _hooks : ModuleHookCache
        Dictionary mapping the fully-qualified names of all modules with normal (post-graph) hooks to the absolute paths
        of such hooks. See the the `_find_module_path()` method for details.
    _hooks_pre_find_module_path : ModuleHookCache
        Dictionary mapping the fully-qualified names of all modules with pre-find module path hooks to the absolute
        paths of such hooks. See the the `_find_module_path()` method for details.
    _hooks_pre_safe_import_module : ModuleHookCache
        Dictionary mapping the fully-qualified names of all modules with pre-safe import module hooks to the absolute
        paths of such hooks. See the `_safe_import_module()` method for details.
    _user_hook_dirs : list
        List of the absolute paths of all directories containing user-defined hooks for the current application.
    _excludes : list
        List of module names to be excluded when searching for dependencies.
    _additional_files_cache : AdditionalFilesCache
        Cache of all external dependencies (e.g., binaries, datas) listed in hook scripts for imported modules.
    _module_collection_mode : dict
        A dictionary of module/package collection mode settings set by hook scripts for their modules.
    _bindepend_symlink_suppression : set
        A set of paths or path patterns corresponding to shared libraries for which binary dependency analysis should
        not create symbolic links into top-level application directory.
    _base_modules: list
        Dependencies for `base_library.zip` (which remain the same for every executable).
    )rééééc ó”•—t‰|dd|i|¤Ž||_d|_||_|j |«|j «y)NÚexcludes©)ÚsuperÚ__init__Ú    _homepathÚ_top_script_nodeÚ    _excludesÚ_resetÚ_analyze_base_modules)ÚselfÚ pyi_homepathÚuser_hook_dirsr'ÚkwargsÚ    __class__s     €úNH:\Change_password\venv_build\Lib\site-packages\PyInstaller/depend/analysis.pyr*zPyiModuleGraph.__init__jsHø€Ü ‰ÑÑ5 (Ð5¨fÒ5à%ˆŒà $ˆÔð"ˆŒØ  ‰ NÔ#Ø ×"Ñ"Õ$ócó¨—d|_t«|_t«|_t «|_g|¢tjjtd«tf‘|_ tjd«|jd«|_|jd«|_|jd«|_t't(«|_|jD]\}}tjj-tjj|d««}    t/|dd    ¬
«5}t1j2|j5««}ddd«|j=||«Œ’t|j*«|_y#1swYŒ9xYw#t6$rYŒÅt8$r%}tj;d |›d |›«Yd}~Œíd}~wwxYw) zh
        Reset for another set of scripts. This is primary required for running the test-suite.
        NÚhooksz(Initializing module graph hook caches...ÚÚpre_safe_import_moduleÚpre_find_module_pathz rthooks.datÚrzutf-8)Úencodingz#Unable to read run-time hooks from z: )r,rÚ_additional_files_cacheÚdictÚ_module_collection_modeÚsetÚ_bindepend_symlink_suppressionÚosÚpathÚjoinrÚHOOK_PRIORITY_BUILTIN_HOOKSÚ_user_hook_dirsÚloggerÚinfoÚ _cache_hooksÚ_hooksÚ_hooks_pre_safe_import_moduleÚ_hooks_pre_find_module_pathrÚlistÚ_available_rthooksÚabspathÚopenÚastÚ literal_evalÚreadÚFileNotFoundErrorÚ    ExceptionÚerrorÚ_merge_rthooks)r0r2ÚuhdÚ_Úuhd_pathÚfÚrthooksÚes        r5r.zPyiModuleGraph._resetvs‚€ð!%ˆÔÜ';Ó'=ˆÔ$Ü'+£vˆÔ$Ü.1«eˆÔ+ð 
Ø ð 
ä W‰W\‰\œ+ wÓ /Ô1LÐ Mð 
ˆÔô      ‰ Ð>Ô?Ø×'Ñ'¨Ó+ˆŒ Ø-1×->Ñ->Ð?WÓ-XˆÔ*Ø+/×+<Ñ+<Ð=SÓ+TˆÔ(ô#.¬dÓ"3ˆÔØ×*Ñ*ò     8‰FˆCÜ—w‘w—‘¤r§w¡w§|¡|°C¸Ó'GÓHˆHð ܘ( C°'Ô:ð9¸aÜ!×.Ñ.¨q¯v©v«xÓ8G÷9ð × Ñ  ¨¨hÕ 7ð     8ô#' t×'>Ñ'>Ó"?ˆÕ÷9ð9ûä$ò áÜò Ü— ’ ÊHÑVWÐXÔYÜûð ús6Ä#FÄ1$F ÅFÆ F    ÆFÆ    GÆ$GÆ,G Ç Gc óž—t|t«s
Jd|z«‚|j«D]\}}t|t«s J|›d|›d«‚t|t«sJd|›d|›d«‚||j
vr7t jd||tjj|d««Œ‡|D]”}t|t«sJ|›d|›d    |›d
«‚tjj|d|«}tjj|«sJd |›d |›d |›d|›d    «‚|j
|j|«Œ–Œ"y)a9
        The expected data structure for a run-time hook file is a Python dictionary of type ``Dict[str, List[str]]``,
        where the dictionary keys are module names and the sequence strings are Python file names.
 
        Check then merge this data structure, updating the file names to be absolute.
        z&The root element in %s must be a dict.z( must be a dict whose keys are strings; z is not a string.z The value of z key z must be a list.ziRuntime hooks for %s have already been defined. Skipping the runtime hooks for %s that are defined in %s.r]z, item z must be a string.zIn z, key z , the file z expected to be located at z does not exist.N) Ú
isinstancer?ÚitemsÚstrrNrOrHÚwarningrCrDrEÚexistsÚappend)r0r]rYr[Ú module_nameÚpython_file_name_listÚpython_file_nameÚabs_paths        r5rXzPyiModuleGraph._merge_rthooksŸsX€ô˜'¤4Ô(Ð]Ð*RÐU]Ñ*]Ó]Ð(Ø29·-±-³/ó    FÑ .ˆKÐ.ä˜k¬3Ô/ð jÚS[Ò]hÐió jÐ/ôÐ3´TÔ:ñ SÚ<DÂkÐRó SÐ:à˜d×5Ñ5Ñ5Ü—‘ð%Ø&1°;ÄÇÁÇ Á ÈSÐR[Ó@\ôð
à$9ò FРä!Ð"2´CÔ8ðgÚ>FÊ ÒUeÐfógÐ8ôŸ7™7Ÿ<™<¨¨YÐ8HÓIä—w‘w—~‘~ hÔ/ñHâš{Ò,<ºhðHóHÐ/ð×'Ñ'¨ Ñ4×;Ñ;¸HÕEò Fñ    Fr6có,—tj|i|¤ŽS©N)rHÚ
findCaller)Úargsr3s  r5Ú _findCallerzPyiModuleGraph._findCallerÄs€ô× Ñ  $Ð1¨&Ñ1Ð1r6c 󐗠   |j|}tj|«sy|›ddj    t t |««›}    |j«\}}}}tjtj||||gd|d|«
}    tj|    «y#t$rYywxYw#t$r
d\}}}}YŒcwxYw)aÇ
        Print a debug message with the given level.
 
        1. Map the msg log level to a logger log level.
        2. Generate the message format (the same format as ModuleGraph)
        3. Find the caller, which findCaller expects three stack-frames above itself:
            [3] caller -> [2] msg (here) -> [1] _findCaller -> [0] logger.findCaller
        4. Create a logRecord with the caller's information.
        5. Handle the logRecord.
        Nú )z(unknown file)rz(unknown function)N) ÚLOG_LEVEL_MAPPINGÚKeyErrorrHÚ isEnabledForrEÚmapÚreprrnÚ
ValueErrorÚ
makeRecordÚnameÚhandle)
r0ÚlevelÚsrmÚmsgÚfnÚlnoÚfuncÚsinfoÚrecords
          r5r|zPyiModuleGraph.msgÊsʀð    Ø×*Ñ*¨5Ñ1ˆEô×"Ñ" 5Ô)Ø â˜CŸH™H¤S¬¨t£_Ô5Ð6ˆð    SØ#'×#3Ñ#3Ó#5Ñ  ˆBT˜5ô×"Ñ"¤6§;¡;°°r¸3ÀÀRÈÈtÐUYÐ[`Óaˆä ‰ fÕøôò    Ù ð    ûôò    SØ#RÑ  ˆBTš5ð    Sús#‚B#Á B2Â#    B/Â.B/Â2CÃCcóì—g}|jD]X\}}tjj||«}tjj    |«sŒF|j ||f«ŒZt ||«S)ac
        Create a cache of all hooks of the specified type.
 
        The cache will include all official hooks defined by the PyInstaller codebase _and_ all unofficial hooks
        defined for the current application.
 
        Parameters
        ----------
        hook_type : str
            Type of hooks to be cached, equivalent to the basename of the subpackage of the `PyInstaller.hooks`
            package containing such hooks (e.g., empty string for standard hooks, `pre_safe_import_module` for
            pre-safe-import-module hooks, `pre_find_module_path` for pre-find-module-path hooks).
        )rGrCrDrEÚisdirrer)r0Ú    hook_typeÚ    hook_dirsÚ user_hook_dirÚpriorityÚuser_hook_type_dirs      r5rJzPyiModuleGraph._cache_hooksêsp€ðˆ    Ø'+×';Ñ';ò    AÑ #ˆM˜8ô"$§¡§¡¨m¸YÓ!GР܏w‰w}‰}Ð/Õ0Ø× Ñ Ð"4°hÐ!?Õ@ð     Aô˜t YÓ/Ð/r6có—tjd«g}tD]-}t|«r|t    |«z }Œ|j |«Œ/|Dcgc]}|j |«D]}|‘ŒŒc}}|_ycc}}w)zN
        Analyze dependencies of the the modules in base_library.zip.
        z*Analyzing modules for base_library.zip ...N)rHrIr rrreÚ import_hookÚ _base_modules)r0Ú required_modsÚmÚreqÚmods     r5r/z$PyiModuleGraph._analyze_base_modulessz€ô     ‰ Ð@ÔA؈ ä!ò    (ˆAܘ!Œ}ØÔ!3°AÓ!6Ñ6‘ à×$Ñ$ QÕ'ð        (ð .;×\ cÀd×FVÑFVÐWZÓF[Ò\¸sšcÐ\˜cÓ\ˆÕùÓ\sÁA<Ncóô•—|j€N    t‰|    |«|_|jD]}|j|j|«Œ |jS|s |j}t‰|    ||¬«S#t$rst    d|t
j ¬«tj«jd«}t    |dddt
j iŽt jd«YŒÓwxYw)    a
        Wrap the parent's 'run_script' method and create graph from the first script in the analysis, and save its
        node to use as the "caller" node for all others. This gives a connected graph rather than a collection of
        unrelated trees.
        Nz
Syntax error in)ÚfileTéüÿÿÿr‘r")Úcaller) r,r)Ú
add_scriptÚ SyntaxErrorÚprintÚsysÚstderrÚ    tracebackÚ
format_excÚ
splitlinesÚexitr‹Úadd_edge)r0Úpathnamer“Úformatted_linesÚnoder4s     €r5r”zPyiModuleGraph.add_scriptsâø€ð ×  Ñ  Ð (ð Ü(-©Ñ(:¸8Ó(DÔ%ð×*Ñ*ò ;Ø— ‘ ˜d×3Ñ3°TÕ:ð ;ð×(Ñ(Ð (áà×.Ñ.Ü‘7Ñ% h°vÐ%Ó>Ð >øôò ÜÐ)¨8¼#¿*¹*ÕEÜ"+×"6Ñ"6Ó"8×"CÑ"CÀDÓ"IÜ r sÐ+Ð=´#·*±*Ò=Ü—‘˜– ð     úsA;Á;A9C7Ã6C7có‚—tjd«    t«}|jj    «D]å\}}|j |d¬«}|€Œt |«jtvr|j|«ŒI|j|«|jj||j|j«|jj|j «|j"j|j$«|j|«Œç|jj&|Ž|syŒ*)zÒ
        For each imported module, run this module's post-graph hooks if any.
 
        Parameters
        ----------
        analysis: build_main.Analysis
            The Analysis that calls the hooks
 
        z-Processing module hooks (post-graph stage)...F)Ú create_nspkgN)rHrIrArKraÚ    find_nodeÚtypeÚ__name__rÚaddÚ
post_graphr>ÚbinariesÚdatasr@ÚupdateÚmodule_collection_moderBÚbindepend_symlink_suppressionÚremove_modules)r0ÚanalysisÚhooked_module_namesrfÚ module_hookÚ module_nodes      r5Úprocess_post_graph_hooksz'PyiModuleGraph.process_post_graph_hooks,s)€ô&     ‰ ÐCÔDØô#&£%Ð ð-1¯K©K×,=Ñ,=Ó,?ò 5Ñ( ˜[à"Ÿn™n¨[Àu˜nÓM ðÐ&Øô˜ Ó$×-Ñ-Ô5GÑGØ'×+Ñ+¨KÔ8Øð×&Ñ& xÔ0ð×,Ñ,×0Ñ0°¸k×>RÑ>RÐT_×TeÑTeÔfð×,Ñ,×3Ñ3°K×4VÑ4VÔWð×3Ñ3×:Ñ:¸;×;dÑ;dÔeð$×'Ñ'¨ Õ4ð9 5ð> 'ˆDK‰K× &Ñ &Ð(;Ñ <ñ'ØñUr6có¾—t«}|rP|jj|d«}|r|j|j«|j d«d}|rŒP|S)ze
        Collect excludedimports from the hooks of the specified module and all its parents.
        Nú.r)rArKÚgetrªÚexcludedimportsÚ
rpartition)r0rfÚexcluded_importsr°s    r5Ú_find_all_excluded_importsz)PyiModuleGraph._find_all_excluded_importsls\€ô›5ÐÙàŸ+™+Ÿ/™/¨+°tÓ<ˆKÙØ ×'Ñ'¨ ×(CÑ(CÔDà%×0Ñ0°Ó5°aÑ8ˆKò ð Ðr6cóp•—|`|j|j«}|rB|tkDrt|t«r |j}n-dj |jj d«dd«}|dkDr'dj |j d«d|dz
«}|r |d|zz }n|}d„}||||j«}    |    r/tjd||j|    |j«gS|rlg}
|D]_} |dz| z} || ||j«}    |    r.tjd| |j|    |j«ŒO|
j| «Œa|
xsd}t‰|-|||||«} | D]9}t|«jtvrŒ|j|j«Œ;| S)Nr´éÿÿÿÿr"cóþ—|jd«}|D]g}|jd«}|dt|«|k(}|sŒ(|jd«}|dt|«|k(}|rtjd|||«Œe|cSy)zË
                    Helper for checking whether given module should be excluded.
                    Returns the name of exclusion rule if module should be excluded, None otherwise.
                    r´Nz^Deactivating suppression rule %r for module %r because it also applies to the referrer (%r)...)ÚsplitÚlenrHÚdebug)    rfr¸Ú referrer_nameÚmodule_name_partsÚexcluded_importÚexcluded_import_partsÚmatchÚreferrer_name_partsÚreferrer_matchs             r5Ú_exclude_modulez9PyiModuleGraph._safe_import_hook.<locals>._exclude_module™sª€ð
)4×(9Ñ(9¸#Ó(>Ð%Ø+;ò3˜Ø0?×0EÑ0EÀcÓ0JÐ-Ø 1Ð2M´3Ð7LÓ3MРNÐRgÑ g˜Ú ð3@×2EÑ2EÀcÓ2JÐ/Ø-@ÐA\Ä#ÐF[ÓB\Ð-]ÐavÑ-v˜NÙ-Ü &§ ¡ ð%7Ø8GÈÐVcô!"ð!)à#2Ò2ð'3ð( r6zxSuppressing import of %r from module %r due to excluded import %r specified in a hook for %r (or its parent package(s)).)r¹Ú
identifierrr`rrEr½rHr¿rer)Ú_safe_import_hookr¤r¥r)r0Útarget_module_partnameÚ source_moduleÚtarget_attr_namesrzÚ    edge_attrr¸Úbase_module_namerÇÚexcluded_import_ruleÚfiltered_target_attr_namesÚtarget_attr_nameÚsubmodule_nameÚ ret_modulesÚ
ret_moduler4s               €r5rÉz PyiModuleGraph._safe_import_hookzsø€ð Ñ $ð $×>Ñ>¸}×?WÑ?WÓXÐ ò ðÔ0Ò0Ü! -´Ô9à+8×+CÑ+CÑ(ð,/¯8©8°M×4LÑ4L×4RÑ4RÐSVÓ4WÐX[ÐY[Ð4\Ó+]Ð(ð˜q’yØ+.¯8©8Ð4D×4JÑ4JÈ3Ó4OÐP]ÐSXÐ[\ÑS\ÐQ]Ð4^Ó+_Ð(á-Ø(¨CÐ2HÑ,HÑHÑ(à'=Ð$ò ñ>(7Ø$Ø$Ø!×,Ñ,ó(Ð$ñ
(Ü—L‘Lð6Ø7GÈ×IaÑIaÐcwØ%×0Ñ0ôð
Iñ%Ø13Ð.Ø,=òPÐ(Ø)9¸CÑ)?ÐBRÑ)R˜Ù/>Ø*Ø,Ø)×4Ñ4ó0Ð,ñ
0Ü"ŸL™Lð!EØFTÐVc×VnÑVnØ 4°m×6NÑ6Nõð 7×=Ñ=Ð>NÕOðPð$)CÒ(JÀdÐ%ä‘gÑ/Ø " MÐ3DÀeÈYó
ˆ ð&ò    CˆJܐJÓ×(Ñ(Ô0BÑBØð × +Ñ +¨J×,AÑ,AÕ Bð     CðÐr6cóâ•—|jj|d«}|Àtjj    |j
«\}}t jd||«d|jdd«z}t||j
«}t||||¬«}    t|d«std|z«‚|j|    «|    j}|    j}t ‰
|E|||«S)    a
        Create a new graph node for the module with the passed name under the parent package signified by the passed
        graph node.
 
        This method wraps the superclass method with support for pre-import module hooks. If such a hook exists for
        this module (e.g., a script `PyInstaller.hooks.hook-{module_name}` containing a function
        `pre_safe_import_module()`), that hook will be run _before_ the superclass method is called.
 
        Pre-Safe-Import-Hooks are performed just *prior* to importing the module. When running the hook, the modules
        parent package has already been imported and ti's `__path__` is set up. But the module is just about to be
        imported.
 
        See the superclass method for description of parameters and return value.
        Nz1Processing pre-safe-import-module hook %r from %rÚ)PyInstaller_hooks_pre_safe_import_module_r´rZ)Ú module_graphÚmodule_basenamerfÚparent_packager:z9pre_safe_import_module() function not defined by hook %r.)rLÚpoprCrDr½Ú hook_filenamerHrIÚreplacerrÚhasattrÚ    NameErrorr:rØrfr)Ú_safe_import_module) r0rØrfrÙÚhookÚ    hook_pathÚ hook_basenameÚhook_module_nameÚ hook_moduleÚhook_apir4s           €r5rßz"PyiModuleGraph._safe_import_moduleðsòø€ð"×1Ñ1×5Ñ5°kÀ4ÓHˆØ Ð ä')§w¡w§}¡}°T×5GÑ5GÓ'HÑ $ˆI}Ü K‰KÐKÈ]Ð\eÔ fØJÈ[×M`ÑM`ÐadÐfiÓMjÑjÐ Ü/Ð0@À$×BTÑBTÓUˆKô.Ø!Ø /Ø'Ø-ô    ˆHô˜;Ð(@ÔAÜР[Ð^iÑ iÓjÐjØ × .Ñ .¨xÔ 8ð'×6Ñ6ˆOØ"×.Ñ.ˆKô‰wÑ*¨?¸KÈÓXÐXr6cóÈ•—|jj|d«}|³tjj    |j
«\}}t jd||«d|jdd«z}t||j
«}t|||¬«}    t|d«std|z«‚|j|    «|    j}t‰
|A|||«S)    a,
        Get a 3-tuple detailing the physical location of the module with the passed name if that module exists _or_
        raise `ImportError` otherwise.
 
        This method wraps the superclass method with support for pre-find module path hooks. If such a hook exists
        for this module (e.g., a script `PyInstaller.hooks.hook-{module_name}` containing a function
        `pre_find_module_path()`), that hook will be run _before_ the superclass method is called.
 
        See superclass method for parameter and return value descriptions.
        Nz/Processing pre-find-module-path hook %r from %rÚ'PyInstaller_hooks_pre_find_module_path_r´rZ)r×rfÚ search_dirsr;z7pre_find_module_path() function not defined by hook %r.)rMrÚrCrDr½rÛrHrIrÜrrrÝrÞr;rèr)Ú_find_module_path) r0ÚfullnamerfrèràrárâÚ hook_fullnamerärår4s           €r5réz PyiModuleGraph._find_module_pathsâø€ð×/Ñ/×3Ñ3°H¸dÓCˆØ Ð ä')§w¡w§}¡}°T×5GÑ5GÓ'HÑ $ˆI}Ü K‰KÐIÈ=ÐZcÔ dØEÈ×HXÑHXÐY\Ð^aÓHbÑbˆMÜ/° ¸t×?QÑ?QÓRˆKô,Ø!Ø$Ø'ôˆHô˜;Ð(>Ô?ÜРYÐ\gÑ gÓhÐhØ × ,Ñ ,¨XÔ 6ð#×.Ñ.ˆKô‰wÑ(¨°;À ÓLÐLr6cóؗi}t}|j|j¬«D]B}t|«j}||vsŒ|j
sŒ*|j
||j <ŒD|S)zÐ
        Get code objects from ModuleGraph for pure Python modules. This allows to avoid writing .pyc/pyo files to hdd
        at later stage.
 
        :return: Dict with module name and code object.
        ©Ústart)r Ú
iter_graphr,r¤r¥ÚcoderÈ)r0Ú    code_dictÚ    mod_typesr Úmg_types     r5Úget_code_objectszPyiModuleGraph.get_code_objectsDsh€ðˆ    Ü,ˆ    Ø—O‘O¨$×*?Ñ*?OÓ@ò        ;ˆDô ˜4“j×)Ñ)ˆGؘ)Ò#Ø—9“9Ø15·±I˜dŸo™oÒ.ð        ;ðÐr6có¨—t«}|j|j¬«D](}|j||«}|€Œ|j    |«Œ*|S)ai
        Return the name, path and type of selected nodes as a TOC. The selection is determined by the given list
        of PyInstaller TOC typecodes. If that list is empty we return the complete flattened graph as a TOC with the
        ModuleGraph note types in place of typecodes -- meant for debugging only. Normally we return ModuleGraph
        nodes whose types map to the requested PyInstaller typecode(s) as indicated in the MODULE_TYPES_TO_TOC_DICT.
 
        We use the ModuleGraph (really, ObjectGraph) flatten() method to scan all the nodes. This is patterned after
        ModuleGraph.report().
        rí)rNrïr,Ú _node_to_tocre)r0ÚtypecodeÚtocr Úentrys     r5Ú    _make_toczPyiModuleGraph._make_tocYsX€ô‹fˆØ—O‘O¨$×*?Ñ*?OÓ@ò    "ˆDØ×%Ñ% d¨HÓ5ˆEðÑ Ø—
‘
˜5Õ!ð     "ð ˆ
r6có,—|jt«S)zB
        Return all pure Python modules formatted as TOC.
        )rúr ©r0s r5Ú make_pure_toczPyiModuleGraph.make_pure_tocls€ð
~‰~Ô6Ó7Ð7r6có,—|jt«S)zD
        Return all binary Python modules formatted as TOC.
        )rúr
rüs r5Úmake_binaries_tocz PyiModuleGraph.make_binaries_tocss€ð~‰~Ô1Ó2Ð2r6có,—|jt«S)zE
        Return all MISSING Python modules formatted as TOC.
        )rúr    rüs r5Úmake_missing_toczPyiModuleGraph.make_missing_tocys€ð~‰~Ô.Ó/Ð/r6cóŒ—t|«j}|€J‚|r||vry|dk(rLtjj    |j
«\}}tjj |«}n!|dk(r|jdz}n |j}|j
 |j
nd}t|«}t|}|||fS)NÚScriptÚExtensionPackagez    .__init__r9)
r¤r¥rCrDÚsplitextÚfilenameÚbasenamerÈrbr )r r÷rórxÚextrDÚtoc_types       r5rözPyiModuleGraph._node_to_tocs¼€ôt“*×%Ñ%ˆØÐ"Ð"Ð"á ˜ xÑ/àà hÒ äŸ'™'×*Ñ*¨4¯=©=Ó9‰KˆT3Ü—7‘7×#Ñ# DÓ)‰DØ Ð*Ò *ð—?‘? [Ñ0‰Dà—?‘?ˆDØ $§ ¡ Р9ˆt}Š}¸rˆô
4‹yˆä+¨GÑ4ˆØT˜8Ð#Ð#r6cóJ—|Dcgc]}|j|«‘Œc}Scc}w)a+
        Given a list of nodes, create a TOC representing those nodes. This is mainly used to initialize a TOC of
        scripts with the ones that are runtime hooks. The process is almost the same as _make_toc(), but the caller
        guarantees the nodes are valid, so minimal checking.
        )rö)r0Únodesr s   r5Ú nodes_to_toczPyiModuleGraph.nodes_to_toc¢s#€ð 5:Ö:¨D×!Ñ! $Õ'Ò:Ð:ùÒ:s… cóZ—|j|«}|€yt|«jdk(S)NFÚ BuiltinModule)r£r¤r¥)r0rxr s   r5Ú is_a_builtinzPyiModuleGraph.is_a_builtin«s-€Ø~‰~˜dÓ#ˆØ ˆ<ØÜD‹z×"Ñ" oÑ5Ð5r6c󰇇—ˆˆfd„}‰j‰«}|€gS‰j|«\}}d„|D«}|Dcgc] }|||«f‘Œc}Scc}w)a-
        List all modules importing the module with the passed name.
 
        Returns a list of (identifier, DependencyIinfo)-tuples. If the names module has not yet been imported, this
        method returns an empty list.
 
        Parameters
        ----------
        name : str
            Fully-qualified name of the module to be examined.
 
        Returns
        ----------
        list
            List of (fully-qualified names, DependencyIinfo)-tuples of all modules importing the module with the passed
            fully-qualified name.
 
        cóx•—‰jj|‰«}|‰jj|«Syrk)ÚgraphÚ edge_by_nodeÚ    edge_data)ÚimporterÚedgerxr0s  €€r5Úget_importer_edge_dataz<PyiModuleGraph.get_importers.<locals>.get_importer_edge_dataÄs9ø€Ø—:‘:×*Ñ*¨8°TÓ:ˆDàÐØ—z‘z×+Ñ+¨DÓ1Ð1ð r6c3ó:K—|]}|€Œ|j–—Œy­wrk)rÈ)Ú.0rs  r5ú    <genexpr>z/PyiModuleGraph.get_importers.<locals>.<genexpr>Îsèø€Ò[¨XÀhÑFZX×(Õ(Ñ[ùs‚Š)r£Ú    get_edges)r0rxrr rZÚ    importersrs``     r5Ú get_importerszPyiModuleGraph.get_importers±s]ù€õ&    2ð ~‰~˜dÓ#ˆØ ˆ<؈IØ—~‘~ dÓ+‰ ˆˆ9Ù[¸Ô[ˆ    ØMVÖWÀÑ1°(Ó;Ò<ÒWÐWùÒWs¿Acó(—g}tjd«|r\|D]W}tjd|«tjj    |«}|j |j |««ŒY|jt«}|D]‚\}}}||jvsŒ|j|D][}tjj|«\}    }
tjd|
|    «|j |j |««Œ]Œ„|S)z„
        Analyze custom run-time hooks and run-time hooks implied by found modules.
 
        :return : list of Graph nodes.
        zAnalyzing run-time hooks ...z!Including custom run-time hook %rz"Including run-time hook %r from %r) rHrIrCrDrPrer”rúrrOr½) r0Úcustom_runhooksÚ rthooks_nodesÚ    hook_fileÚtemp_tocÚmod_namerDr÷rirárâs            r5Úanalyze_runtime_hooksz$PyiModuleGraph.analyze_runtime_hooksÒs€ð ˆ ܏ ‰ Ð2Ô3ñ Ø,ò A    Ü— ‘ Ð?ÀÔKÜŸG™GŸO™O¨IÓ6    ð×$Ñ$ T§_¡_°YÓ%?Õ@ð  Að—>‘>Ô"4Ó5ˆØ*2ò    DÑ &ˆXt˜Xà˜4×2Ñ2Ò2à $× 7Ñ 7¸Ñ AòDHÜ/1¯w©w¯}©}¸XÓ/FÑ,I˜}Ü—K‘KРDÀmÐU^Ô_Ø!×(Ñ(¨¯©¸Ó)BÕCñDð        DðÐr6có~—|j€J‚|D]…}|j|«}|tjd|«n=tj    d|«    |j |«}t |«dk(sJ‚|d}|j|j|«Œ‡y#t$rtjd|«YŒªwxYw)zÅ
        Add hidden imports that are either supplied as CLI option --hidden-import=MODULENAME or as dependencies from
        some PyInstaller features when enabled (e.g., crypto feature).
        NzHidden import %r already foundzAnalyzing hidden import %rr"rzHidden import %r not found)
r,r£rHr¿rIrŠr¾Ú ImportErrorrWr)r0Ú module_listÚmodnmr r s     r5Úadd_hiddenimportsz PyiModuleGraph.add_hiddenimportsós¾€ð
×$Ñ$Ð0Ð0Ð0à ò    7ˆEØ—>‘> %Ó(ˆDØÐÜ— ‘ Ð=¸uÕEä— ‘ Ð8¸%Ô@ðØ ×,Ñ,¨UÓ3Eܘu›:¨š?Ð*˜?Ø  ™8Dð M‰M˜$×/Ñ/°Õ 6ñ!    7øô#òÜ—L‘LÐ!=¸uÔEÙðúsÁ&BÂB<Â;B<ÚmoduleÚreturncóB—i}tdhz}|j|«}|r|j|«}|D]i}|€Œt|«j|vrŒ|j
}||k(s|j |dz«rŒD|j€ŒQ|j||j
<Œk|S)z>
        Find modules that import a given **module**.
        rr´)r r£Úincomingr¤r¥rÈÚ
startswithrð)r0r*Úco_dictÚpure_python_module_typesr Ú    referrersr<rÈs        r5Úget_code_usingzPyiModuleGraph.get_code_using s¸€ðˆÜ#;Ø ð?
ñ$
Рð~‰~˜fÓ%ˆÙ ØŸ ™  dÓ+ˆIØò /ð9Øä˜“7×#Ñ#Ð+CÑCØØŸ\™\
Ø Ò'¨:×+@Ñ+@ÀÈ#ÁÔ+Nàð—6‘6>ØØ()¯©˜Ÿ ™ Ò%ð! /ð"ˆr6cóˆ—t«}||jddgdg«z}dD]}||j|gd¢g«z}Œ|S)zK
        Collect metadata for all packages that appear to need it.
        Ú pkg_resourcesÚget_distributionÚrequire)zimportlib.metadataÚimportlib_metadata)ÚmetadataÚ distributionÚversionÚfilesÚrequires)rAÚ_metadata_from)r0Úoutr7s   r5Úmetadata_requiredz PyiModuleGraph.metadata_required*sj€ô ‹eˆà ˆt×"Ñ"Ø Ø Ð  Ø ˆKó
ñ    
ˆð#Oò    Ð Ø 4×&Ñ&Ø"ÚLØóñ ‰Cð    ðˆ
r6c    ó–—ddlm}ddlm}t    «}t    «}|D],}|j t j|dz|z««Œ.|D],}|j t j|dz|z««Œ.t    «}    |j|«j«D]…\}
} t j| «j«D]Z} | D]S\} }t|«dk7rŒ|d}    | |vr|    j ||««n| |vr|    j ||d¬««ŒUŒ\Œ‡|    S#|j$rYŒmwxYw)aÛ
        Collect metadata whose requirements are implied by given function names.
 
        Args:
            package:
                The module name that must be imported in a source file to trigger the search.
            methods:
                Function names from **package** which take a distribution name as an argument and imply that metadata
                is required for that distribution.
            recursive_methods:
                Like **methods** but also implies that a distribution's dependencies' metadata must be collected too.
        Returns:
            Required metadata in hook data ``(source, dest)`` format as returned by
            :func:`PyInstaller.utils.hooks.copy_metadata()`.
 
        Scan all source code to be included for usage of particular *key* functions which imply that that code will
        require metadata for some distribution (which may not be its own) at runtime. In the case of a match,
        collect the required metadata.
        r)Ú copy_metadata)r7r´r"T)Ú    recursive)ÚPyInstaller.utils.hooksrAÚPyInstaller.compatr7rArªrÚ    any_aliasr2raÚrecursive_function_callsÚvaluesr¾ÚPackageNotFoundError)r0ÚpackageÚmethodsÚrecursive_methodsrAr7Ú need_metadataÚneed_recursive_metadataÚmethodr>rxrðÚcallsÚ function_namerms               r5r=zPyiModuleGraph._metadata_fromCs[€õ(    :Ý9ô›ˆ Ü"%£%ÐØò    MˆFØ ×  Ñ  ¤×!3Ñ!3°G¸c±MÀFÑ4JÓ!KÕ Lð    Mà'ò    WˆFØ #× *Ñ *¬8×+=Ñ+=¸gȹmÈfÑ>TÓ+UÕ Vð    Wô‹eˆà×-Ñ-¨gÓ6×<Ñ<Ó>ò    !‰JˆD$Ü!×:Ñ:¸4Ó@×GÑGÓIò !Ø+0ò !Ñ'M 4ä˜4“y A’~Ø Ø" 1™gGð!Ø(¨MÑ9ØŸJ™J¡}°WÓ'=Õ>Ø*Ð.EÑEØŸJ™J¡}°WÈÔ'MÔNøñ !ñ !ð    !ð"ˆ
øð    .×BÑBò!á ð!úsÃ59D6Ä6E    ÅE    có¶—|j|j¬«Dcgc]/}t|«jdk(rt    |j
«‘Œ1c}Scc}w)z?
        Return the list of collected python packages.
        rír)rïr,r¤r¥rbrÈ)r0r s  r5Úget_collected_packagesz%PyiModuleGraph.get_collected_packageswsP€ð .2¯_©_À4×CXÑCX¨_Ó-Yö
Ø%)ܐD‹z×"Ñ" iÒ/ô —‘Õ  ò
ð    
ùò
sŸ4Acóä—g}|j|j¬«D]N}t|j«}|jj |«D]\}}|j ||df«ŒŒP|S)zF
        Return the TOC list of binaries collected by hooks."
        ríÚBINARY)rïr,rbrÈr>r¨re©r0rør rfÚ    dest_nameÚsrc_names      r5Úmake_hook_binaries_tocz%PyiModuleGraph.make_hook_binaries_tocsv€ðˆØ—O‘O¨$×*?Ñ*?OÓ@ò    <ˆDܘdŸo™oÓ.ˆKØ'+×'CÑ'C×'LÑ'LÈ[Ó'Yò <Ñ#    ˜8Ø—
‘
˜I x°Ð:Õ;ñ <ð    <ð
ˆ
r6cóä—g}|j|j¬«D]N}t|j«}|jj |«D]\}}|j ||df«ŒŒP|S)zH
        Return the TOC list of data files collected by hooks."
        ríÚDATA)rïr,rbrÈr>r©rerUs      r5Úmake_hook_datas_tocz"PyiModuleGraph.make_hook_datas_tocsv€ðˆØ—O‘O¨$×*?Ñ*?OÓ@ò    :ˆDܘdŸo™oÓ.ˆKØ'+×'CÑ'C×'IÑ'IÈ+Ó'Vò :Ñ#    ˜8Ø—
‘
˜I x°Ð8Õ9ñ :ð    :ð
ˆ
r6©r(r(rk)/r¥Ú
__module__Ú __qualname__Ú__doc__rrrrqr*r.rXÚ staticmethodrnr|ÚmsginÚmsgoutrJr/r”r²r¹rrÉrßrérôrúrýrÿrrör rrr$r)rbr?r2rAr?r=rNrRrXr[Ú __classcell__)r4s@r5r!r!Cs(ø„ñ!ðH! U¨u¸À5ÑIÐõ
%ò'@òR#FðJñ2óð2ò
ð: €EØ €Fò0ò2 ]õ?ò4>ò@  ðOcÐnrõtôl+YôZ%MòNó*ò&8ò3ò 0ð ò $óð $òD;ò6ò XòBòB7ð2 Sð¨Tóð< 3óñ22È3ó2ðh
¨ó
ð
¨ó
ð
 T÷
r6r!có¾—|xsd}|xsd}d|vr|dz }trJtj|k(r7tjd«t    t«}|j |«|Stjd«t t|t«|¬«}tsAtjd«t    |«adt_    dt_
dt_ |S)    a¦
    Create the cached module graph.
 
    This function might appear weird but is necessary for speeding up test runtime because it allows caching basic
    ModuleGraph object that gets created for 'base_library.zip'.
 
    Parameters
    ----------
    excludes : list
        List of the fully-qualified names of all modules to be "excluded" and hence _not_ frozen into the executable.
    user_hook_dirs : list
        List of the absolute paths of all directories containing user-defined hooks for the current application or
        `None` if no such directories were specified.
 
    Returns
    ----------
    PyiModuleGraph
        Module graph with core dependencies.
    r(Ú__main__)rez)Reusing cached module dependency graph...z'Initializing module dependency graph...)r'Úimpliesr2z"Caching module dependency graph...N) Ú_cached_module_graph_r-rHrIrr.r!rrrKrLrM)r'r2rs   r5Úinitialize_modgraphrhs̀ð*$Ò) r€NØŠ~˜2€Hð˜Ñ!ؐMÑ!ˆõ Ô!6×!@Ñ!@ÀHÒ!L܏ ‰ Ð?Ô@ÜÔ.Ó/ˆØ  ‰ ^Ô$؈ ä
‡KKÐ9Ô:ô ÜØä“ Ø%ô  €Eõ !ä ‰ Ð8Ô9ä (¨£Ðð(,ÔÔ$Ø>BÔÔ;Ø<@ÔÔ9à €Lr6cól—td«}t«}tjj    t
dd«}dD]d}t|«}t |d«sŒtjj|j«}t||d«}|j||df«Œf|jdtjj|j«df«|dtjj    |d    «dfd
tjj    |d «dfd tjj    |d «dfgz }tr2|jdtjj    |d«df«|jdtjj    |d«df«|S)zf
    Get TOC with the bootstrapping modules and their dependencies.
    :return: TOC with modules
    ÚstructÚ PyInstallerÚloader)Ú_structÚzlibÚ__file__Ú    EXTENSIONÚPYMODULEÚpyimod01_archivezpyimod01_archive.pyÚpyimod02_importerszpyimod02_importers.pyÚpyimod03_ctypeszpyimod03_ctypes.pyÚpyimod04_pywin32zpyimod04_pywin32.pyÚpyiboot01_bootstrapzpyiboot01_bootstrap.pyÚPYSOURCE) Ú
__import__rNrCrDrErrÝrProrrer)Ú
mod_structÚ loader_modsÚ
loaderpathr#rÚmod_fileÚmod_dests       r5Úget_bootstrap_modulesr~àsp€ô ˜HÓ%€Jä“&€KÜ—‘—‘œh¨ °xÓ@€Jð(òBˆÜ˜Ó"ˆÜ 3˜
Õ #Ü—w‘w—‘ s§|¡|Ó4ˆHô6°hÀÈ+ÓVˆHØ × Ñ  ¨(°KÐ@Õ AðBð×ј¤"§'¡'§/¡/°*×2EÑ2EÓ"FÈ
ÐSÔTðØ    œRŸW™WŸ\™\¨*Ð6KÓLÈjÐYØ    œrŸw™wŸ|™|¨JÐ8OÓPÐR\Ð]Ø    œBŸG™GŸL™L¨Ð5IÓJÈJÐWðñ€Kõ
Ø×ÑÐ.´·±· ± ¸ZÐI^Ó0_ÐakÐlÔmà×ÑÐ-¬r¯w©w¯|©|¸JÐH`Ó/aÐcmÐnÔoØ Ðr6r\):r_rRrCr—r™Ú collectionsrÚcopyrrkrrrÚloggingÚPyInstaller.building.utilsrrDr    r
r r r rrrÚPyInstaller.dependrÚPyInstaller.depend.imphookrrÚPyInstaller.depend.imphookapirrÚ(PyInstaller.lib.modulegraph.find_modulesrÚ'PyInstaller.lib.modulegraph.modulegraphrrrrÚPyInstaller.logrrrrCrrÚ    getLoggerr¥rHrFÚHOOK_PRIORITY_CONTRIBUTED_HOOKSÚHOOK_PRIORITY_UPSTREAM_HOOKSÚHOOK_PRIORITY_USER_HOOKSr!rgrhr~r(r6r5ú<module>rs¢ðñó2 Û    Û
ÛÝ#Ýç-Ý&ÝE÷÷óõ(ßLßXÝ@ßuÓuß.Ñ.ßBà    ˆ×    Ñ    ˜8Ó    $€ð$ÐØ"'ÐØ ÐØÐôT [ôT ðnÐó@óF!r6