
    ic                    f   S SK Jr  S SKrS SKrS SKrS SKrS SKJr  S SKJ	r	  S SK
Jr  S SKrS SKJrJr  S SKJr  S SKJr  S S	KJr  S S
KJr  \R0                  " \5      r\" \R8                  5      r0 rS4S jrS5S jr S6S jr!S6S jr"S6S jr#\RH                  S7S j5       r%S8S9S jjr&S:S jr'S;S jr(S<S jr)S7S jr*S=S jr+S>S jr,S r-S?S jr.  S@     SAS jjr/S7S jr0S>S jr1SBS jr2S>S jr3S  S!4     SCS" jjr4S# r5SDS$ jr6/ S%Qr7S\74SES& jjr8    SF         SGS' jjr9SHSIS( jjr:SJSKS) jjr;SLS* jr<SS+ SSS!4           SMS, jjr=SNS- jr>SOS. jr?  S@     SPS/ jjr@SQS0 jrA\R                  (       a  S S1KCJDrE  g\R                  (       a  S S2KGJHrI  \R                  S3\I5        CIgg)R    )annotationsN)Pathdeque)Callable)HOMEPATHcompat)log)PostGraphAPI)isolated)importlib_metadataTc                   SSK Jn  Uc  0 n[        R                  " [        R
                  5      nUR                  U5        [        R                  R                  US   [        /-   5      nSU;   a0  [        R                  R                  UR                  S5      U/5      nXTS'   U(       a&  [        R                  " U SU06nUR                  5       $ [        R                  " U SU06$ )z
Executes an externally spawned Python interpreter. If capture_stdout is set to True, returns anything that was
emitted in the standard output as a single string. Otherwise, returns the exit code.
r   )CONFpathex
PYTHONPATHenv)PyInstaller.configr   copydeepcopyosenvironupdatepathsepjoinr   getr	   exec_pythonstripexec_python_rc)cmdr   capture_stdoutr   pp_envpptxts          MC:\des-py\RoboSAPF\venv\Lib\site-packages\PyInstaller\utils\hooks\__init__.py__exec_python_cmdr%   -   s     (
{]]2::&F
MM# 
h8*4	5B vZZ__fjj6;<<  #262yy{$$c6v66    c                H    [         R                  " U 5      n SU /n[        X!S9$ )Nz-cr    )textwrapdedentr%   )	statementr    r   s      r$   __exec_statementr,   I   s%    	*I
CS@@r&   c                    [        U SS9$ )a  
Execute a single Python statement in an externally-spawned interpreter, and return the resulting standard output
as a string.

Examples::

    tk_version = exec_statement("from _tkinter import TK_VERSION; print(TK_VERSION)")

    mpl_data_dir = exec_statement("import matplotlib; print(matplotlib.get_data_path())")
    datas = [ (mpl_data_dir, "") ]

Notes:
    As of v5.0, usage of this function is discouraged in favour of the
    new :mod:`PyInstaller.isolated` module.

Tr(   r,   r+   s    r$   exec_statementr0   O   s    " Id;;r&   c                    [        U SS9$ )z^
Executes a Python statement in an externally spawned interpreter, and returns the exit code.
Fr(   r.   r/   s    r$   exec_statement_rcr2   c   s     Ie<<r&   c                Z    [        U 5      R                  5       nU(       d  g[        U5      $ )a  
Execute a single Python statement in an externally-spawned interpreter, and :func:`eval` its output (if any).

Example::

  databases = eval_statement('''
     import sqlalchemy.databases
     print(sqlalchemy.databases.__all__)
     ''')
  for db in databases:
     hiddenimports.append("sqlalchemy.databases." + db)

Notes:
    As of v5.0, usage of this function is discouraged in favour of the
    new :mod:`PyInstaller.isolated` module.

 )r0   r   eval)r+   r#   s     r$   eval_statementr6   j   s'    $ 
#
)
)
+C9r&   c                    SSK nSSKn[        UR                  R	                  5       5      nUR                  U 5        [        [        UR                  R	                  5       5      U-
  U 1-
  5      $ )a  
Return list of modules required by binary (C/C++) Python extension.

Python extension files ends with .so (Unix) or .pyd (Windows). It is almost impossible to analyze binary extension
and its dependencies.

Module cannot be imported directly.

Let's at least try import it in a subprocess and observe the difference in module list from sys.modules.

This function could be used for 'hiddenimports' in PyInstaller hooks files.
r   N)sys	importlibsetmoduleskeysimport_modulelist)module_namer8   r9   originals       r$   get_pyextension_importsrA      s\     3;;##%&H K( CKK$$&'(2k]BCCr&   c                   SSK nSS/nSnU (       a  UR                  U 5        SU -  nOSn UR                  U5      R                  5       n[        R                  SU< SU< S	35        U(       a  UR                  S5      $ g! [         a    [        R                  S
5         N:UR                   a    [        R                  SU -  5         Ncf = f)z
Return the homebrew path to the requested formula, or the global prefix when called with no argument.

Returns the path as a string or None if not found.
r   Nbrewz--prefixzhomebrew formula "%s"zhomebrew prefixzFound z at ""zDetected homebrew not installedz#homebrew formula "%s" not installedutf8)	
subprocessappendcheck_outputr   loggerdebugOSErrorCalledProcessErrordecode)formularF   brewcmdpathdbgstrs        r$   get_homebrew_pathrR      s     z"GDw(72"F&&w/5576489
 {{6""  867(( F:WDEFs   =B C#'CCc                N    U R                  U5      (       a  U [        U5      S $ U $ )z
This function removes the given prefix from a string, if the string does indeed begin with the prefix; otherwise,
it returns the original string.
N)
startswithlen)stringprefixs     r$   remove_prefixrX      s+    
   c&kl##r&   c                ^    U(       a%  U R                  U5      (       a  U S[        U5      *  $ U $ )z
This function removes the given suffix from a string, if the string does indeed end with the suffix; otherwise,
it returns the original string.
N)endswithrU   )rV   suffixs     r$   remove_suffixr\      s-     &//&))mF|$$r&   c                    [         R                   H/  nU R                  U5      (       d  M  U SU R                  U5       s  $    [        R
                  R                  U 5      S   $ )zz
This function returns filename without its extension.

For Python C modules it removes even whole '.cpython-34m.so' etc.
r   )r	   EXTENSION_SUFFIXESrZ   rfindr   rP   splitext)filenamesuffs     r$   remove_file_extensionrc      sW     ))T""AhnnT233 * 77H%a((r&   c                t    [         R                  S 5       n U" U 5      $ ! [         R                   a     gf = f)aj  
Check if the specified module can be imported.

Intended as a silent module availability check, as it does not print ModuleNotFoundError traceback to stderr when
the module is unavailable.

Parameters
----------
module_name : str
    Fully-qualified name of the module.

Returns
----------
bool
    Boolean indicating whether the module can be imported or not.
c                <     [        U 5        g! [         a     gf = f)NTF)
__import__	Exceptionr?   s    r$   _can_import_module-can_import_module.<locals>._can_import_module   s$    	{# 		s    
F)r   decorateSubprocessDiedError)r?   ri   s     r$   can_import_modulerm      sD    (  !+..'' s     77c                    [         R                  S 5       n U" X5      $ ! [         a  n[        SU SU  35      UeSnAff = f)ak  
Get the string value of the passed attribute from the passed module if this attribute is defined by this module
_or_ raise `AttributeError` otherwise.

Since modules cannot be directly imported during analysis, this function spawns a subprocess importing this module
and returning the string value of this attribute in this module.

Parameters
----------
module_name : str
    Fully-qualified name of this module.
attr_name : str
    Name of the attribute in this module to be retrieved.

Returns
----------
str
    String value of this attribute.

Raises
----------
AttributeError
    If this attribute is undefined.
c                B    SS K nUR                  U 5      n[        X15      $ Nr   )r9   r=   getattr)r?   	attr_namer9   modules       r$   _get_module_attribute3get_module_attribute.<locals>._get_module_attribute  s     ((5v))r&   zFailed to retrieve attribute z from module N)r   rk   rg   AttributeError)r?   rr   rt   es       r$   get_module_attributerx      s]    2 * *k$[<< k<YK}U`Tabcijjks     
A<Ac                b   SnSU ;  aE   SSK nUR                  R                  U 5      R                  nUR	                  U 5      nU(       a  U$  [        R                  S 5       n U" U 5      nU$ ! [
        [        [        [        4 a     N=f = f! [         a  n[        SU  S35      UeSnAff = f)a  
Get the absolute path to the specified module or package.

Modules and packages *must not* be directly imported in the main process during the analysis. Therefore, to
avoid leaking the imports, this function uses an isolated subprocess when it needs to import the module and
obtain its ``__file__`` attribute.

Parameters
----------
package : str
    Fully-qualified name of module or package.

Returns
----------
str
    Absolute path of this module.
N.r   c                    SS K nUR                  R                  U 5      R                  nUR	                  U 5      nU(       a  U$  SS K	nUR                  U 5      nUR                  $ ! [
        [        [        [        4 a     N=f = frp   )importlib.utilutil	find_specloaderget_filenameImportErrorrv   	TypeError
ValueErrorr9   r=   __file__)packager9   r   ra   ps        r$   _get_module_file_attribute=get_module_file_attribute.<locals>._get_module_file_attributeJ  s}    
	!^^--g6==F**73H  	##G,zz ^Y
C 		s   AA' 'BBz:Failed to obtain the __file__ attribute of package/module !)r|   r}   r~   r   r   r   rv   r   r   r   rk   rg   )r   ra   r9   r   r   rw   s         r$   get_module_file_attributer   &  s    ,  H
'		!^^--g6==F**73H    (j-g6 O= ^Y
C 		6  jVW^V__`abhiijs*   AA/ %B /BB
B.B))B.c                    [        U S5      $ )a  
Get the absolute path of the PyWin32 DLL specific to the PyWin32 module with the passed name (`pythoncom`
or `pywintypes`).

On import, each PyWin32 module:

* Imports a DLL specific to that module.
* Overwrites the values of all module attributes with values specific to that DLL. This includes that module's
  `__file__` attribute, which then provides the absolute path of that DLL.

This function imports the module in isolated subprocess and retrieves its `__file__` attribute.
r   )rx   rh   s    r$   !get_pywin32_module_file_attributer   g  s       Z88r&   c                   [         R                  R                  U 5      n [        R                  " UR
                  5      nUR                  (       d  gUR                  R                  USS9$ ! [        R                   a     gf = f)a  
Check if a :pep:`0508` requirement is satisfied. Usually used to check if a package distribution is installed,
or if it is installed and satisfies the specified version requirement.

Parameters
----------
requirement : str
    Requirement string in :pep:`0508` format.

Returns
----------
bool
    Boolean indicating whether the requirement is satisfied or not.

Examples
--------

::

    # Assume Pillow 10.0.0 is installed.
    >>> from PyInstaller.utils.hooks import check_requirement
    >>> check_requirement('Pillow')
    True
    >>> check_requirement('Pillow < 9.0')
    False
    >>> check_requirement('Pillow >= 9.0, < 11.0')
    True
FT)prereleases)		packagingrequirementsRequirementr   versionnamePackageNotFoundError	specifiercontains)requirementparsed_requirementr   s      r$   check_requirementr   z  s}    : #//;;KH$,,-?-D-DE
 '' ''00d0KK 22 s    A- -BBc                P    Ub  [        S5      eUb  [        S5      e[        U 5      $ )a  
A compatibility wrapper for :func:`check_requirement`, intended for backwards compatibility with existing hooks.

In contrast to original implementation from PyInstaller < 6, this implementation only checks the specified
:pep:`0508` requirement string; i.e., it tries to retrieve the distribution metadata, and compare its version
against optional version specifier(s). It does not attempt to fall back to checking the module's version attribute,
nor does it support ``version`` and ``version_attr`` arguments.

Parameters
----------
requirements : str
    Requirements string passed to the :func:`check_requirement`.
version : None
    Deprecated and unsupported. Must be ``None``.
version_attr : None
    Deprecated and unsupported. Must be ``None``.

Returns
----------
bool
    Boolean indicating whether the requirement is satisfied or not.

Raises
----------
ValueError
    If either ``version`` or ``version_attr`` are specified and are not None.
zKCalling is_module_satisfies with version argument is not supported anymore.zPCalling is_module_satisfies with version argument_attr is not supported anymore.)r   r   )r   r   version_attrs      r$   is_module_satisfiesr     s4    @ fggkll\**r&   c                T    SS jnSU ;  a  U" U 5      $ [         R                  " X5      $ )z
Check if a Python module is really a module or is a package containing other modules, without importing anything
in the main process.

:param module_name: Module name to check.
:return: True if module is a package else otherwise.
c                     SSK nUR                  R                  U 5      n[        UR                  5      =(       d    UR
                  R                  S5      $ ! [         a     gf = f)a  
Determines whether the given name represents a package or not. If the name represents a top-level module or
a package, it is not imported. If the name represents a sub-module or a sub-package, its parent is imported.
In such cases, this function should be called from an isolated suprocess.

NOTE: the fallback check for `__init__.py` is there because `_distutils_hack.DistutilsMetaFinder` from
`setuptools` does not set spec.submodule_search_locations for `distutils` / `setuptools._distutils` even though
it is a package. The alternative would be to always perform full import, and check for the `__path__` attribute,
but that would also always require full isolation.
r   Nz__init__.pyF)r|   r}   r~   boolsubmodule_search_locationsoriginrZ   rg   )r?   r9   specs      r$   _is_packageis_package.<locals>._is_package  sV    	!>>++K8D778_DKK<P<PQ^<__ 		s   AA 
A%$A%rz   r?   strr   call)r?   r   s     r$   
is_packager     s+    ( +;''}}[66r&   c                \    SS jnSU ;  a
  U" U 5      nU$ [         R                  " X5      nU$ )a  
Given a package name, return all paths associated with the package. Typically, packages have a single location
path, but PEP 420 namespace packages may be split across multiple locations. Returns an empty list if the specified
package is not found or is not a package.
c                     SSK nUR                  R                  U 5      nU(       a  UR                  (       d  / $ UR                   Vs/ s H  n[	        U5      PM     sn$ s  snf ! [
         a    / s $ f = f)a  
Retrieve package path(s), as advertised by submodule_search_paths attribute of the spec obtained via
importlib.util.find_spec(package). If the name represents a top-level package, the package is not imported.
If the name represents a sub-module or a sub-package, its parent is imported. In such cases, this function
should be called from an isolated suprocess. Returns an empty list if specified package is not found or is not
a package.
r   N)r|   r}   r~   r   r   rg   )r   r9   r   rP   s       r$   _get_package_paths1get_all_package_paths.<locals>._get_package_paths  sf    	!>>++G4Dt>>	*.*I*IJ*I$CI*IJJJ 	I	s(   8A& A& 	A!A& !A& &A54A5rz   r   r   r   )r   r   	pkg_pathss      r$   get_all_package_pathsr     s:    & '&w/	  MM"4>	r&   c                T    [        XR                  S[        R                  5      5      $ )a&  
Given a package location path and package name, return the package base path, i.e., the directory in which the
top-level package is located. For example, given the path ``/abs/path/to/python/libs/pkg/subpkg`` and
package name ``pkg.subpkg``, the function returns ``/abs/path/to/python/libs``.
rz   )r\   replacer   sep)package_pathr   s     r$   package_base_pathr     s     sBFF'CDDr&   c                    [        U 5      nU(       d  [        SU  S35      e[        U5      S:  a  [        R	                  SX5        US   n[        X 5      nX24$ )a  
Given a package, return the path to packages stored on this machine and also returns the path to this particular
package. For example, if pkg.subpkg lives in /abs/path/to/python/libs, then this function returns
``(/abs/path/to/python/libs, /abs/path/to/python/libs/pkg/subpkg)``.

NOTE: due to backwards compatibility, this function returns only one package path along with its base directory.
In case of PEP 420 namespace package with multiple location, only first location is returned. To obtain all
package paths, use the ``get_all_package_paths`` function and obtain corresponding base directories using the
``package_base_path`` helper.
z	Package 'z%' does not exist or is not a package!   zQget_package_paths - package %s has multiple paths (%r); returning only first one!r   )r   r   rU   rI   warningr   )r   r   pkg_dirpkg_bases       r$   get_package_pathsr     sb     &g.I9WI-RSTT
9~_ah	
 lG 2Hr&   c                    gNT r   s    r$   <lambda>r   9  s    r&   	warn oncec                    [        U [        5      (       d  [        S5      eUS;  a  [        SU S35      e[        R                  SU 5        [        U 5      (       d+  [        R                  SU 5        [        U 5      (       a  U /$ / $ / n[        5       nUR                  U 5        [        R                  " 5        nU(       a~  UR                  5       nUR                  [        Xb5      u  pxnX7 V	s/ s H  o" U	5      (       d  M  U	PM     sn	-  nU H#  n
U" U
5      (       d  M  UR                  U
5        M%     U(       a  M~  SSS5        [        U5      n[        R                  SU5        U$ s  sn	f ! , (       d  f       N6= f)	a7  
List all submodules of a given package.

Arguments:
    package:
        An ``import``-able package.
    filter:
        Filter the submodules found: A callable that takes a submodule name and returns True if it should be
        included.
    on_error:
        The action to take when a submodule fails to import. May be any of:

        - raise: Errors are reraised and terminate the build.
        - warn: Errors are downgraded to warnings.
        - warn once: The first error issues a warning but all
          subsequent errors are ignored to minimise *stderr pollution*. This
          is the default.
        - ignore: Skip all errors. Don't warn about anything.
Returns:
    All submodules to be assigned to ``hiddenimports`` in a hook.

This function is intended to be used by hook scripts, not by main PyInstaller code.

Examples::

    # Collect all submodules of Sphinx don't contain the word ``test``.
    hiddenimports = collect_submodules(
        "Sphinx", ``filter=lambda name: 'test' not in name)

.. versionchanged:: 4.5
    Add the **on_error** parameter.

package must be a str)ignorer   warnraisezInvalid on-error action 'z:': Must be one of ('ignore', 'warn once', 'warn', 'raise')zCollecting submodules for %sz)collect_submodules - %s is not a package.Nz)collect_submodules - found submodules: %s)
isinstancer   r   r   rI   rJ   r   rm   r   rG   r   Pythonpopr   _collect_submodulessorted)r   filteron_errorpackage_submodulestodoisolated_pythonr   r;   subpackagesrs   subpackage_names              r$   collect_submodulesr   7  sZ   N gs##/00??'z1kl
 	
 LL/9 g@'J W%%9	 7DKK		o88:D-<-A-ABUW[-f*G( "Rf6&>6"RR $//**KK0 $/ d 
   23
LL<>PQ #S 
	s*   95E/.E*E*E/!E/*E//
E=c           	        SS K nSS KnSSKJn  SSKJn  UR                  SU 5        / n/ n [        U 5        XR                  ;  a  XgU4$ [!        UR                  U    SS 5      =(       d    / n	U	(       d  XgU4$ UR#                  U 5        UR                  SX	5        UR%                  XS-   5       H1  u  pnU(       d  UR#                  U 5        M   UR#                  U 5        M3     XgU4$ ! [         a  nUS;   a`  SSK	Jn  SR                  U" [        U5      U5      5      R                  5       nUR                  SU  SU  S	U 35        US
:X  a  SnXgU4s S nA$ US:X  a  [        SU  S35      Ue S nAGN=S nAff = f)Nr   )format_exception_only)rI   z-collect_submodules - scanning (sub)package %s)r   r   r4   z"Failed to collect submodules for 'z' because importing 'z
' raised: r   r   r   zUnable to load subpackage 'z'.__path__z@collect_submodules - scanning (sub)package %s in location(s): %srz   )r8   pkgutil	tracebackr   PyInstaller.utils.hooksrI   rJ   rf   rg   PyInstaller.logr   typer   r   r   r;   rq   rG   iter_modules)r   r   r8   r   r   rI   r;   r   expathsimporterispkgs               r$   r   r     s   /.
LL@$GGKN4 ;;X-- CKK%z48>BEX-- NN4 LLSUYa!(!5!5eCZ!HNN4 t$	 "I ))A  
N,,..tBx<=CCEBNN?vEZ[_Z``jkmjnop;&#11  ;D6DE2M !
Ns$   C( (
E92A E4E9E44E9c                @    U R                  US-   5      =(       d    X:H  $ )a  
This helper function is designed for use in the ``filter`` argument of :func:`collect_submodules`, by returning
``True`` if the given ``name`` is a module or a submodule of ``mod_or_submod``.

Examples:

    The following excludes ``foo.test`` and ``foo.test.one`` but not ``foo.testifier``. ::

        collect_submodules('foo', lambda name: not is_module_or_submodule(name, 'foo.test'))``
rz   )rT   )r   mod_or_submods     r$   is_module_or_submoduler     s      ??=3./H43HHr&   )*.dllz*.dylibzlib*.soc           	     .   [         R                  SU -  5        [        U [        5      (       d  [	        S5      e[        U 5      (       d  [         R                  SU 5        / $ [        U 5      n/ nU H  n[        XP5      nU H  n[        U5      R                  U5      nU Hj  n	U(       a  Un
OU	R                  R                  U5      n
[         R                  SU	< SU
< 35        UR                  [        U	5      [        U
5      45        Ml     M     M     U$ )a  
This function produces a list of (source, dest) of dynamic library files that reside in package. Its output can be
directly assigned to ``binaries`` in a hook script. The package parameter must be a string which names the package.

:param destdir: Relative path to ./dist/APPNAME where the libraries should be put.
:param search_patterns: List of dynamic library filename patterns to collect.
z#Collecting dynamic libraries for %sr   zZcollect_dynamic_libs - skipping library collection for module '%s' as it is not a package. z, )rI   rJ   r   r   r   r   r   r   r   r   rglobparentrelative_torG   )r   destdirsearch_patternspkg_dirsdylibsr   r   patternfilessourcedests              r$   collect_dynamic_libsr     s     LL6@A gs##/00 ghjq	
 	$W-HF$W6&GM''0E"D "==44X>D&$78s6{CI67   '   Mr&   c                  ^ [         R                  SU -  5        [        U [        5      (       d  [	        S5      e[        U 5      (       d  [         R                  SU 5        / $ U(       a  [        U5      O/ n[        U5      nU(       d(  U[        R                   Vs/ s H  nSU-   PM
     sn-  nO.U[        R                   Vs/ s H  ofS;  d  M
  SU-   PM     sn-  nUR                  S5        U(       a  [        U5      OS/n[        U5      nU4S jn/ n	[        U 5      n
U
 H  n[        5       m[        X5      nU(       a  [        R                   R#                  X5      nU" XUS5        U" XUS	5        U	T Vs/ s H2  n[        U5      [        UR$                  R'                  U5      5      4PM4     sn-  n	M     [         R                  S
U	5        U	$ s  snf s  snf s  snf )aX
  
This function produces a list of ``(source, dest)`` entries for data files that reside in ``package``.
Its output can be directly assigned to ``datas`` in a hook script; for example, see ``hook-sphinx.py``.
The data files are all files that are not shared libraries / binary python extensions (based on extension
check) and are not python source (.py) files or byte-compiled modules (.pyc). Collection of the .py and .pyc
files can be toggled via the ``include_py_files`` flag.
Parameters:

-   The ``package`` parameter is a string which names the package.
-   By default, python source files and byte-compiled modules (files with ``.py`` and ``.pyc`` suffix) are not
    collected; setting the ``include_py_files`` argument to ``True`` collects these files as well. This is typically
    used when a package requires source .py files to be available; for example, JIT compilation used in
    deep-learning frameworks, code that requires access to .py files (for example, to check their date), or code
    that tries to extend `sys.path` with subpackage paths in a way that is incompatible with PyInstaller's frozen
    importer.. However, in contemporary PyInstaller versions, the preferred way of collecting source .py files is by
    using the **module collection mode** setting (which enables collection of source .py files in addition to or
    in lieu of collecting byte-compiled modules into PYZ archive).
-   The ``subdir`` argument gives a subdirectory relative to ``package`` to search, which is helpful when submodules
    are imported at run-time from a directory lacking ``__init__.py``.
-   The ``excludes`` argument contains a sequence of strings or Paths. These provide a list of
    `globs <https://docs.python.org/3/library/pathlib.html#pathlib.Path.glob>`_
    to exclude from the collected data files; if a directory matches the provided glob, all files it contains will
    be excluded as well. All elements must be relative paths, which are relative to the provided package's path
    (/ ``subdir`` if provided).

    Therefore, ``*.txt`` will exclude only ``.txt`` files in ``package``\ 's path, while ``**/*.txt`` will exclude
    all ``.txt`` files in ``package``\ 's path and all its subdirectories. Likewise, ``**/__pycache__`` will exclude
    all files contained in any subdirectory named ``__pycache__``.
-   The ``includes`` function like ``excludes``, but only include matching paths. ``excludes`` override
    ``includes``: a file or directory in both lists will be excluded.

This function does not work on zipped Python eggs.

This function is intended to be used by hook scripts, not by main PyInstaller code.
zCollecting data files for %sr   zUcollect_data_files - skipping data collection for module '%s' as it is not a package.**/*>   .py.pycz**/__pycache__/*.pycc           	     V  > [        U5       H  u  pE[        U 5      R                  U5       Hv  nUR                  5       (       a5  XB:  a.  UR	                  [        US-  R                  U 5      5      5        MK  MM  U(       a  TR                  U5      OTR                  U5        Mx     M     g )Nr   )		enumerater   globis_dirrG   r   r   adddiscard)r   cludes	clude_len
is_includeicgsourcess          r$   clude_walker(collect_data_files.<locals>.clude_walkerH  s     f%DA']''*88::}c1v:*B*B7*K&LM %
 '1GKKNgooa6H + &r&   TFz$collect_data_files - Found files: %s)rI   rJ   r   r   r   r   r   r>   rU   r	   ALL_SUFFIXESrG   r   r:   r   r   rP   r   r   r   )r   include_py_filessubdirexcludesincludesexcludes_lensincludes_lenr  datasr   r   r   r  s                @r$   collect_data_filesr    s   T LL/'9: gs##/00 gnpwx	 "*tH~rHx=L )<)<=)<AVaZ)<== 	)<)<Y)<A@XZVaZ)<YY OO*+ "*tH~xHx=L
I, E$W-H%$W6ggll73G 	Wd;We< 	QA3q63qxx33H=>?QQ  LL7?Lo > Zb Rs   G	G	G;9Gc                   [        U [        5      (       d  [        S5      e/ n[        R                  " U 5       H  u  pEnU H  n[        R
                  R                  U5      S   nU(       d  U[        ;  d  M8  [        R
                  R                  XG5      n	[        [        U5      R                  U 5      5      n
Ub  [        R
                  R                  X5      n
UR                  X45        M     M     U$ )a  
This function produces a list of (source, dest) non-Python (i.e., data) files that reside somewhere on the system.
Its output can be directly assigned to ``datas`` in a hook script.

This function is intended to be used by hook scripts, not by main PyInstaller code.
zpath must be a strr   )r   r   r   r   walkrP   r`   PY_IGNORE_EXTENSIONSr   r   r   rG   )rP   r   r  r  dirpathdirnamesr   f	extensionr   r   s              r$   collect_system_data_filesr  s  s     dC  ,-- E$&GGDM 5A((+A.II5I$Ig14=44T:;&77<<6Df^,  %2 Lr&   c                   SSK Jn  U" U /5      n[        5       n/ nU(       Ga  UR                  5       n X;   a  M  [        R
                  " U 5      n[        US5      (       d  [        S[        U5       SU  S35      eUR                  n[        U[        5      (       d   UR                  R                  UR                  R                  -  nUR                  5       (       aC  UR                  R!                  S5      (       a#  [        S[#        U5      < S	U < S
U  SU  S3	5      e[        SU< S[        U5       S35      eUR%                  5       (       ar  UR                  S:X  aU  UR                  R                  R!                  S5      (       a+  [&        R(                  R*                  " UR,                  SS 6 n	O8UR                  n	O+UR                  5       (       a  Sn	O[        SU< SU  S35      eUR                  R                  S:X  aE  UR                  R                  R                  S:X  a!  [&        R(                  R+                  SSU	5      n	UR/                  [#        U5      [#        U	5      45        U(       d  U$ UR1                  U 5        UR2                  =(       d    /  V
s/ s H"  n
[4        R6                  R9                  U
5      PM$     nn
U V
s/ s H<  oR:                  b!  U
R:                  R=                  5       (       d  M0  U
R                  PM>     nn
X;-  nU(       a  GM  U$ ! [         a    UR                  n GNxf = fs  sn
f s  sn
f )a  
Collect distribution metadata so that ``importlib.metadata.distribution()`` or ``pkg_resources.get_distribution()``
can find it.

This function returns a list to be assigned to the ``datas`` global variable. This list instructs PyInstaller to
copy the metadata for the given package to the frozen application's data directory.

Parameters
----------
package_name : str
    Specifies the name of the package for which metadata should be copied.
recursive : bool
    If true, collect metadata for the package's dependencies too. This enables use of
    ``importlib.metadata.requires('package')`` or ``pkg_resources.require('package')`` inside the frozen
    application.

Returns
-------
list
    This should be assigned to ``datas``.

Examples
--------
    >>> from PyInstaller.utils.hooks import copy_metadata
    >>> copy_metadata('sphinx')
    [('c:\python27\lib\site-packages\Sphinx-1.3.2.dist-info',
      'Sphinx-1.3.2.dist-info')]


Some packages rely on metadata files accessed through the ``importlib.metadata`` (or the now-deprecated
``pkg_resources``) module. PyInstaller does not collect these metadata files by default.
If a package fails without the metadata (either its own, or of another package that it depends on), you can use this
function in a hook to collect the corresponding metadata files into the frozen application. The tuples in the
returned list contain two strings. The first is the full path to the package's metadata directory on the system. The
second is the destination name, which typically corresponds to the basename of the metadata directory. Adding these
tuples the the ``datas`` hook global variable, the metadata is collected into top-level application directory (where
it is usually searched for).

.. versionchanged:: 4.3.1

    Prevent ``dist-info`` metadata folders being renamed to ``egg-info`` which broke ``pkg_resources.require`` with
    *extras* (see :issue:`#3033`).

.. versionchanged:: 4.4.0

    Add the **recursive** option.
r   r   _pathzUnsupported distribution type z for z  - does not have _path attributez.eggz"Cannot collect metadata from path zu, which appears to be inside a zipped egg. PyInstaller >= 6.0 does not support zipped eggs anymore. Please reinstall z using modern package installation method instead of deprecated 'python setup.py install'. For example, if you are using pip package manager:
1. uninstall the zipped egg:
  pip uninstall z
2. make sure pip and its dependencies are up-to-date:
  python -m pip install --upgrade pip setuptools
3. install the package:
  pip install zb
To install a package from source, pass the path to the source directory to 'pip install' command.z, which is of unsupported type rz   zEGG-INFONzDistribution metadata path z is neither file nor directory!_vendor
setuptools)collectionsr   r:   r   r   distributionhasattrRuntimeErrorr   r  r   r   r   r   rg   is_filerZ   r   r   r   rP   r   partsrG   r   requiresr   r   r   markerevaluate)package_name	recursiver   r   doneoutdistsrc_path
src_parent	dest_pathreqr   s               r$   copy_metadatar/    s   ` ", D5D
C
xxz!..|<
 tW%%0dE,Oop  :: (D))
-%__33hoo6J6JJ
 !!##
(@(@(H(H"8X8I Jaam`p q' (4n 5% &2N 3x
x  #8Dcdhiqdrcsstu  ?? }}
*x/C/C/L/LV/T/TGGLL(..*=>	$MM	 I-h\|nLkl  ??9,1G1G1L1LP\1\\9iHI

CM3y>23J
 LP==K^\^K^_K^C	..::3?K^_,8hLSJJ<NRUR\R\ReReRgLhk $n Jw  -%__
-l `hs$   -L+ ')M/M	M+MMc                    [         R                  " U 5      nUR                  S5      nUb  UR                  5       $ g! [         R                   a     Of = fU n[         R
                  " 5       nUR                  U5      nU=(       d    /  H[  n  [         R                  " U 5      nUR                  S5      nUb  UR                  5       s  $ MB  ! [         R                   a     MY  f = f   g)a  
Try to find which package manager installed the specified distribution (e.g., pip, conda, rpm) by reading INSTALLER
file from distribution's metadata.

If the specified distribution does not exist, fall back to treating the passed name as importable package/module
name, and attempt to look up its associated distribution name; this matches the behavior of implementation found
in older PyInstaller versions (<= v6.12.0).

:param dist_name: Name of distribution to look up
:return: Name of package manager or None

.. versionchanged:: 6.13
    The passed name is now first treated as a distribution name (direct look-up), and only if that fails, it is
    treated as importable package/module name.
	INSTALLERN)r   r  	read_textr   r   packages_distributionsr   )	dist_namer*  installer_textr?   pkg_to_dist
dist_namess         r$   get_installerr8    s    $	!..y94%!'')) 22  K$;;=K-J  %2%		%229=D!^^K8N)%++-- *!66 	 	 & s!   9= AA9CC$#C$c                    gr   r   r   s    r$   r   r   U  s    tr&   c                    [        XX4S9n[        U 5      n[        XUS9n[        R                  " 5       n	[        U	R                  U / 5      5      n
U
 H  n U[        U5      -  nM     XgU4$ ! [         a     M'  f = f)ad  
Collect everything for a given package name.

Arguments:
    package_name:
        An ``import``-able package name.
    include_py_files:
        Forwarded to :func:`collect_data_files`.
    filter_submodules:
        Forwarded to :func:`collect_submodules`.
    exclude_datas:
        Forwarded to :func:`collect_data_files`.
    include_datas:
        Forwarded to :func:`collect_data_files`.
    on_error:
        Forwarded onto :func:`collect_submodules`.

Returns:
    tuple: A ``(datas, binaries, hiddenimports)`` triplet containing:

    - All data files, raw Python files (if **include_py_files**), and distribution metadata directories (if
      applicable).
    - All dynamic libraries as returned by :func:`collect_dynamic_libs`.
    - All submodules of **package_name**.

Typical use::

    datas, binaries, hiddenimports = collect_all('my_package_name')
)r	  r
  )r   r   )	r  r   r   r   r3  r:   r   r/  rg   )r&  r  filter_submodulesexclude_datasinclude_datasr   r  binarieshiddenimportsr6  r7  r4  s               r$   collect_allr@  R  s    J |nE#L1H&|O`aM %;;=K[__\267J		]9--E   M))  		s   A,,
A:9A:c                    / n/ n[         R                  " U S9 H@  nU[        UR                  R                  5      -  nUR                  UR                  5        MB     X4$ )a)  
Collect modules and metadata for all exporters of a given entry point.

Args:
    name:
        The name of the entry point. Check the documentation for the library that uses the entry point to find
        its name.
Returns:
    A ``(datas, hiddenimports)`` pair that should be assigned to the ``datas`` and ``hiddenimports``, respectively.

For libraries, such as ``pytest`` or ``keyring``, that rely on plugins to extend their behaviour.

Examples:
    Pytest uses an entry point called ``'pytest11'`` for its extensions.
    To collect all those extensions use::

        datas, hiddenimports = collect_entry_point("pytest11")

    These values may be used in a hook or added to the ``datas`` and ``hiddenimports`` arguments in the ``.spec``
    file. See :ref:`using spec files`.

.. versionadded:: 4.3
)group)r   entry_pointsr/  r*  r   rG   rs   )r   r  importsentry_points       r$   collect_entry_pointrF    s[    0 EG)66TB{//4455{))* C >r&   c                ^    U R                   R                  nSnX;   a  X#U   ;   a  X1   U   nU$ )a|  
Get user settings for hooks.

Args:
    module_name:
        The module/package for which the key setting belong to.
    key:
        A key for the config.
Returns:
    The value for the config. ``None`` if not set.

The ``get_hook_config`` function will lookup settings in the ``Analysis.hooksconfig`` dict.

The hook settings can be added to ``.spec`` file in the form of::

    a = Analysis(["my-app.py"],
        ...
        hooksconfig = {
            "gi": {
                "icons": ["Adwaita"],
                "themes": ["Adwaita"],
                "languages": ["en_GB", "zh_CN"],
            },
        },
        ...
    )
N)analysishooksconfig)hook_apir?   keyconfigvalues        r$   get_hook_configrN    s<    8 **FE{(;!;#C(Lr&   c                    Ub'  U H   n[         R                   " X5      (       d  M     O   gUb&  U H   n[         R                   " X5      (       d  M     g   g)a  
Generic inclusion/exclusion decision function based on filename and list of include and exclude patterns.

Args:
    filename:
        Filename considered for inclusion.
    include_list:
        List of inclusion file patterns.
    exclude_list:
        List of exclusion file patterns.

Returns:
    A boolean indicating whether the file should be included or not.

If ``include_list`` is provided, True is returned only if the filename matches one of include patterns (and does not
match any patterns in ``exclude_list``, if provided). If ``include_list`` is not provided, True is returned if
filename does not match any patterns in ``exclude list``, if provided. If neither list is provided, True is
returned for any filename.
FT)fnmatch)ra   include_listexclude_listr   s       r$   include_or_exclude_filerS    sR    0 #Gx11 $ #Gx11 $ r&   c           
     6   U=(       d    / nU=(       d    / nUc  U S-   n[         R                  (       d  X#4$ [        U 5      u  pE[        U5      nXA-  nUR	                  5       (       d  X#4$ X6R                  S5       Vs/ s H2  n[        U5      [        UR                  R                  U5      5      4PM4     sn-  nUUR                  S5       Vs/ s H2  n[        U5      [        UR                  R                  U5      5      4PM4     sn-  nX#4$ s  snf s  snf )a  
Collect data files and binaries from the .libs directory of a delvewheel-enabled python wheel. Such wheels ship
their shared libraries in a .libs directory that is located next to the package directory, and therefore falls
outside the purview of the collect_dynamic_libs() utility function.

Args:
    package_name:
        Name of the package (e.g., scipy).
    libdir_name:
        Optional name of the .libs directory (e.g., scipy.libs). If not provided, ".libs" is added to
        ``package_name``.
    datas:
        Optional list of datas to which collected data file entries are added. The combined result is retuned
        as part of the output tuple.
    binaries:
        Optional list of binaries to which collected binaries entries are added. The combined result is retuned
        as part of the output tuple.

Returns:
    tuple: A ``(datas, binaries)`` pair that should be assigned to the ``datas`` and ``binaries``, respectively.

Examples:
    Collect the ``scipy.libs`` delvewheel directory belonging to the Windows ``scipy`` wheel::

        datas, binaries = collect_delvewheel_libs_directory("scipy")

    When the collected entries should be added to existing ``datas`` and ``binaries`` listst, the following form
    can be used to avoid using intermediate temporary variables and merging those into existing lists::

        datas, binaries = collect_delvewheel_libs_directory("scipy", datas=datas, binaries=binaries)

.. versionadded:: 5.6
z.libsr   z.load[-_]order*)	r	   is_winr   r   r   r   r   r   r   )	r&  libdir_namer  r>  r   r   libs_dirdll_fileload_order_files	            r$   !collect_delvewheel_libs_directoryrZ    s   F KRE~2H"W, == *,7HH~H%H?? ]j]jkr]st]sQY#h-X__%@%@%J!KL]sttH
 
%-]]3D%EG%E/ ?#S)?)?)K)KH)U%VW%EG GE ? u
Gs   >9D9D)conda)CONDA_META_DIRzAssuming this is not an Anaconda environment or an additional venv/pipenv/... environment manager is being used on top, because the conda-meta folder %s does not exist.r   )T)r+   r   r   )r4   )rN   r   )rV   r   rW   r   )rV   r   r[   r   )ra   r   )r?   r   rr   r   r   )r   r   )NN)r   r   r   Noner   r]  )r   r   r   r   )r   r   r   zCallable[[str], bool]r   r   )r   r   r   r   )r   r   r   z
str | Noner   r>   )FNNN)
r   r   r  r   r  str | os.PathLike | Noner	  list | Noner
  r_  )NF)rP   r   r   r^  r  r   )F)r&  r   r'  r   )r4  r   )r&  r   r  r   r;  r   r<  r_  r=  r_  r   r   )r   r   )rJ  r   r?   r   rK  r   )ra   r   rQ  r_  rR  r_  )NNN)K
__future__r   r   r   r)   rP  pathlibr   r  r   typingr   packaging.requirementsr   PyInstallerr   r	   r
   loggingPyInstaller.depend.imphookapir   r   PyInstaller.compatr   	getLogger__name__rI   r:   r  r  hook_variablesr%   r,   r0   r2   r6   rk   rA   rR   rX   r\   rc   rm   rx   r   r   r   r   r   r   r   r   r   r   r   PY_DYLIB_PATTERNSr   r  r  r/  r8  r@  rF  rN  rS  rZ  is_pure_condar   r[  conda_supportis_condaPyInstaller.utils.hooks.condar\  _tmpr   r   r&   r$   <module>rq     sm   #  	       ( & 6   1			8	$ 6../  78A<(=2 
D D26	
)F#kL>B9&+Ld $+$+$+ $+N7DBE8 %6PP!P Ph/*dI  >B[l 'X #'+  sss %s 	s
 sl6M`1l ""3!%!%4*4*4*  4* 	4*
 4* 4*n@ J !% $$$$ $NAH 
>__D
NN	HIM 	 r&   