%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/setuptools/config/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/setuptools/config/__pycache__/expand.cpython-312.pyc

�


_�d@��6�dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZddl
mZddlmZmZmZmZmZmZmZmZmZmZmZmZddlmZdd	lmZdd
lm Z ddl!m"Z#dd
l$m%Z%erddl&m'Z'ddl(m)Z)ddl*m+Z+ejXZ-ee.ej^fZ0ed�Z1edd��Z2Gd�d�Z3	d@dee.dee0dee.fd�Z4d@dee.e5ee0fde.fd�Z6dee0dee0fd�Z7dee5e0fde.fd�Z8de0de.fd �Z9		dAd!e.d"eee.e.fdee0fd#�Z:d$e.d%ee0defd&�Z;d'ed$e.defd(�Z<d$e.d"eee.e.fde0dee0ee.e.ffd)�Z=		dAd*e.d"eee.e.fdee0defd+�Z>		dAd,ee.e.fd"eee.e.fdee0dee.effd-�Z?dddd.�d/eee.e.fdee0dee.fd0�Z@d1e0d2e0de.fd3�ZAd4eeeee.eBfe.fde.fd5�ZCd6eDdeDfd7�ZE	d@d8eeFeDfdee0deee.ee.ffd9�ZGdBd:e.dee.eDffd;�ZHGd<�d=�ZIGd>�d?ee1e2f�ZJy)CaiUtility functions to expand configuration directives or special values
(such glob patterns).

We can split the process of interpreting configuration files into 2 steps:

1. The parsing the file contents from strings to value objects
   that can be understand by Python (for example a string with a comma
   separated list of keywords into an actual Python list of strings).

2. The expansion (or post-processing) of these values according to the
   semantics ``setuptools`` assign to them (for example a configuration field
   with the ``file:`` directive should be expanded from a list of file paths to
   a single string with the contents of those files concatenated)

This module focus on the second step, and therefore allow sharing the expansion
functions among several configuration file formats.

**PRIVATE MODULE**: API reserved for setuptools internal usage only.
�N)�iglob)�ConfigParser)�
ModuleSpec)�chain)�
TYPE_CHECKING�Callable�Dict�Iterable�Iterator�List�Mapping�Optional�Tuple�TypeVar�Union�cast)�Path)�
ModuleType)�DistutilsOptionError�)�	same_path)�SetuptoolsWarning)�Distribution)�ConfigDiscovery)�DistributionMetadata�_K�_VT)�	covariantc�j�eZdZdZdedefd�Zdeee	je	jffd�Zd�Zy)	�StaticModulez>Proxy to a module object that avoids executing arbitrary code.�name�specc���tjtj|j�j��}t
|�jt��|`	y�N)
�ast�parse�pathlibr�origin�
read_bytes�vars�update�locals�self)r-r!r"�modules    �:/usr/lib/python3/dist-packages/setuptools/config/expand.py�__init__zStaticModule.__init__Bs?�����7�<�<����4�?�?�A�B���T�
���&�(�#��I��returnc#�<�K�|jjD]|�t�tj�r�fd��j
D�Ed{����;t�tj�s�V�js�c�j�jf���~y7�J�w)Nc3�:�K�|]}|�jf���y�wr$��value)�.0�target�	statements  �r/�	<genexpr>z1StaticModule._find_assignments.<locals>.<genexpr>Js�����V�&�V�Y�_�_�5�V�s�)	r.�body�
isinstancer%�Assign�targets�	AnnAssignr6r8)r-r9s @r/�_find_assignmentszStaticModule._find_assignmentsGsn��������)�)�	:�I��)�S�Z�Z�0�V�I�DU�DU�V�V�V��I�s�}�}�5�)�/�/� �'�'����9�9�		:�V�s�AB�B�B�0B�=Bc���	t�fd�|j�D��S#t$r }t|j�d����|�d}~wwxYw)zHAttempt to load an attribute "statically", via :func:`ast.literal_eval`.c3��K�|]E\}}t|tj�r&|j�k(rtj|����Gy�wr$)r<r%�Name�id�literal_eval)r7r8r6�attrs   �r/r:z+StaticModule.__getattr__.<locals>.<genexpr>QsA������!�F�E��f�c�h�h�/�F�I�I��4E�� � ��'��s�AAz has no attribute N)�nextr@�	Exception�AttributeErrorr!)r-rF�es ` r/�__getattr__zStaticModule.__getattr__Ns]���	P���%)�%;�%;�%=���
��
�	P� �D�I�I�;�.@���!G�H�a�O��	P�s�!%�	A�A	�	AN)
�__name__�
__module__�__qualname__�__doc__�strrr0rrr%�ASTr@rK�r1r/r r ?sA��H��S��
��
:�8�E�#�'�'�3�7�7�2B�,C�#D�:�	Pr1r �patterns�root_dirr2c
�����hd�}g}�xstj��|D]��t�fd�|D��rltjj	tjj����}|j
t�fd�t|d��D�����tjj���jtjd�}|j|���|S)aExpand the list of glob patterns, but preserving relative paths.

    :param list[str] patterns: List of glob patterns
    :param str root_dir: Path to which globs should be relative
                         (current directory by default)
    :rtype: list
    >�*�?�[�]�{�}c3�&�K�|]}|�v���
y�wr$rR)r7�charr6s  �r/r:z glob_relative.<locals>.<genexpr>is�����9��t�u�}�9�s�c3��K�|]B}tjj|��jtjd����Dy�w)�/N)�os�path�relpath�replace�sep�r7rarTs  �r/r:z glob_relative.<locals>.<genexpr>ms9��������G�G�O�O�D�(�3�;�;�B�F�F�C�H��s�AAT)�	recursiver_)
r`�getcwd�anyra�abspath�join�extend�sortedrrbrcrd�append)rSrT�glob_characters�expanded_values�	glob_pathrar6s `    @r/�
glob_relativerqZs����5�O��O��&�2�9�9�;�H��)���9��9�9�����������X�u�(E�F�I��"�"��� %�i�4� @���
��7�7�?�?�5�(�3�;�;�B�F�F�C�H�D��"�"�4�(�)�"�r1�	filepathsc����ddlm}tjj	�xstj
����fd�||�D�}dj
�fd�t|�D��S)z�Return the content of the files concatenated using ``
`` as str

    This function is sandboxed and won't reach anything outside ``root_dir``

    (By default ``root_dir`` is the current directory).
    r)�always_iterablec3�^�K�|]$}tjj�|����&y�wr$)r`rarjres  �r/r:zread_files.<locals>.<genexpr>�s �����V�4�"�'�'�,�,�x��.�V�s�*-�
c3�L�K�|]}t|��r
t|����y�wr$)�
_assert_local�
_read_fileres  �r/r:zread_files.<locals>.<genexpr>�s(���������x�(�	�4���s�!$)� setuptools.extern.more_itertoolsrtr`rarirgrj�_filter_existing_files)rrrTrt�
_filepathss `  r/�
read_filesr}{sX���A��w�w���x�6�2�9�9�;�7�H�V�?�9�;U�V�J��9�9��*�:�6���r1c#�K�|D]?}tjj|�r|���'tjd|�d���Ay�w)NzFile z cannot be found)r`ra�isfiler�emit)rrras  r/r{r{�sD�����E��
�7�7�>�>�$���J��"�"�U�4�(�2B�#C�D�	E�s�AA�filepathc�|�tj|d��5}|j�cddd�S#1swYyxYw)Nzutf-8)�encoding)�io�open�read)r��fs  r/ryry�s0��	����G�	,����v�v�x����s�2�;c���ttjj|��ttjj|��jvrd|�d|�d�}t|��y)NzCannot access z (or anything outside �)T)rr`rari�parentsr)r�rT�msgs   r/rxrx�sW���B�G�G�O�O�H�%�&�d�2�7�7�?�?�8�3L�.M�.U�.U�U��x�l�*@���A�N��"�3�'�'�r1�	attr_desc�package_dirc�t�|xstj�}|j�jd�}|j	�}dj|�}|xsd}t
|||�\}}}t||�}	tt||�|�S#t$rt||�}	t|	|�cYSwxYw)a�Reads the value of an attribute from a module.

    This function will try to read the attributed statically first
    (via :func:`ast.literal_eval`), and only evaluate the module if it fails.

    Examples:
        read_attr("package.attr")
        read_attr("package.module.attr")

    :param str attr_desc: Dot-separated string describing how to reach the
        attribute (see examples above)
    :param dict[str, str] package_dir: Mapping of package names to their
        location in disk (represented by paths relative to ``root_dir``).
    :param str root_dir: Path to directory containing all the packages in
        ``package_dir`` (current directory by default).
    :rtype: str
    �.r0)r`rg�strip�split�poprj�_find_module�
_find_spec�getattrr rH�
_load_spec)
r�r�rT�
attrs_path�	attr_name�module_name�_parent_pathrar"r.s
          r/�	read_attrr��s���,�&�2�9�9�;�H����"�(�(��-�J���� �I��(�(�:�&�K��+��K�&2�;��X�&V�#�L�$���k�4�(�D�*��|�K��6�	�B�B���*��D�+�.���v�y�)�)�*�s�=B�!B7�6B7r��module_pathc��tjj||�}|xstjj|�}|�t	|��|Sr$)�	importlib�util�spec_from_file_location�	find_spec�ModuleNotFoundError)r�r�r"s   r/r�r��sF���>�>�1�1�+�{�K�D��8�9�>�>�+�+�K�8�D��|�!�+�.�.��Kr1r"c��t|d|�}|tjvrtj|Stjj|�}|tj|<|jj|�|S)NrL)r��sys�modulesr�r��module_from_spec�loader�exec_module)r"r�r!r.s    r/r�r��sd���4��[�1�D��s�{�{���{�{�4� � �
�^�^�
,�
,�T�
2�F��C�K�K����K�K���F�#��Mr1c�b�|}|jd�}|r�|d|vrk||d}|jdd�}t|�dkDr)tjj||d�}|d}n|}dj|g|dd��}n'd|vr#tjj||d�}tjj
|g|jd����}t
|�d�tjj|d�ft|�d	���}	td
�|	D�d�}
||
|fS)a0Given a module (that could normally be imported by ``module_name``
    after the build is complete), find the path to the parent directory where
    it is contained and the canonical name that could be used to import it
    considering the ``package_dir`` in the build configuration and ``root_dir``
    r�rr_�N�z.pyz__init__.pyz.*c3�`K�|]&}tjj|�s�#|���(y�wr$)r`rar)r7�xs  r/r:z_find_module.<locals>.<genexpr>�s����C�a�������1B��C�s�$.�.)	r��rsplit�lenr`rarjrrrG)r�r�rT�parent_path�module_parts�custom_path�parts�
parent_module�
path_start�
candidatesr�s           r/r�r��s0���K��$�$�S�)�L����?�k�)�%�l�1�o�6�K��&�&�s�A�.�E��5�z�A�~� �g�g�l�l�8�U�1�X�>�� %�a��
� +�
��(�(�M�#E�L���4D�#E�F�K�
�;�
��'�'�,�,�x��R��A�K������k�C�K�,=�,=�c�,B�C�J���<�s�	�R�W�W�\�\�*�m�D�E�
���B�� ��J��C�:�C�T�J�K���[�0�0r1�qualified_class_namec���|xstj�}|jd�}||dzd}|d|}t|||�\}}}t	t||�|�}	t
|	|�S)z@Given a qualified class name, return the associated class objectr�r�N)r`rg�rfindr�r�r�r�)
r�r�rT�idx�
class_name�pkg_namer�rar�r.s
          r/�
resolve_classr��su���&�2�9�9�;�H�
�
$�
$�S�
)�C�%�c�A�g�i�0�J�#�D�S�)�H�&2�8�[�(�&S�#�L�$��
�
�;��5�{�
C�F��6�:�&�&r1�valuesc
�l�|j�D��cic]\}}|t|||���c}}Scc}}w)z�Given a dictionary mapping command names to strings for qualified class
    names, apply :func:`resolve_class` to the dict values.
    )�itemsr�)r�r�rT�k�vs     r/�cmdclassr�s2��DJ�<�<�>�R�4�1�a�A�}�Q��X�6�6�R�R��Rs�0)�
namespaces�fill_package_dirrTr�c�P�
�ddlm}ddlm}m}|rddlm}nddlm}|xstj}|jddg�}g}	|�in|}t|||����
t�
�dk(r+t�
fd	�d|fD��r|jd
�
d��
D]�}
t||
�}|j|fi|��}|	j!|�|s�6|j#d
�|
k(r�Ktj$j'||�r�l|j)|||
����|	S)aWorks similarly to :func:`setuptools.find_packages`, but with all
    arguments given as keyword arguments. Moreover, ``where`` can be given
    as a list (the results will be simply concatenated).

    When the additional keyword argument ``namespaces`` is ``True``, it will
    behave like :func:`setuptools.find_namespace_packages`` (i.e. include
    implicit namespaces as per :pep:`420`).

    The ``where`` argument will be considered relative to ``root_dir`` (or the current
    working directory when ``root_dir`` is not given).

    If the ``fill_package_dir`` argument is passed, this function will consider it as a
    similar data structure to the ``package_dir`` configuration parameter add fill-in
    any missing package location.

    :rtype: list
    r)�construct_package_dir)�unique_everseenrt)�PEP420PackageFinder)�
PackageFinder�wherer�r�c3�>�K�|]}t�d|����y�w)rN)�
_same_path)r7r��searchs  �r/r:z find_packages.<locals>.<genexpr>?s�����V��J�v�a�y�!�$<� <�V�s�r�)�setuptools.discoveryr�rzr�rtr�r�r`�curdirr��listr��all�
setdefault�
_nest_path�findrk�getra�samefiler+)r�r�rT�kwargsr�r�rtr�r��packagesra�package_path�pkgsr�s             @r/�
find_packagesr�s���0;�Q��M�6��$�2�9�9�H��J�J�w���&�E��H�-�5�r�;K��
�/�/�%�"8�9�
:�F�
�6�{�a��C�V�s�H�o�V�V��#�#�B��q�	�2��G��!�(�D�1��!�}�!�!�,�9�&�9��������� � ��$��,����0@�0@��x�0X��#�#�$9�$��$E�F�G��Or1�parentrac��|dvr|ntjj||�}tjj|�S)N>r�r�)r`rarj�normpath)r�ras  r/r�r�Ns4���Y�&�6�B�G�G�L�L���,F�D�
�7�7���D�!�!r1r6c��t|�r|�}ttttt
f|�}t
|t�s2t|d�r!djtt|��}|Sd|z}|S)z`When getting the version directly from an attribute,
    it should be normalised to string.
    �__iter__r�z%s)
�callablerr
rrP�intr<�hasattrrj�mapr5s r/�versionr�Ssj����������%��S��/�*�E�2�E��e�S�!��5�*�%��H�H�S��e�_�-�E��L��5�L�E��Lr1�package_datac�6�d|vr|jd�|d<|S)NrVr�)r�)r�s r/�canonic_package_datar�es%��
�l��'�+�+�C�0��R���r1�
data_filesc	��t|t�r|S|j�D��cgc]\}}|t||�f��c}}Scc}}w)z�For compatibility with ``setup.py``, ``data_files`` should be a list
    of pairs instead of a dict.

    This function also expands glob patterns.
    )r<r�r�rq)r�rT�destrSs    r/�canonic_data_filesr�ksO���*�d�#���)�.�.�0���D�(�
�}�X�x�0�1����s�A�textc	��tdd��}t|_|j||�|j	�D��cic]\}}|t|j	����!}}}|j
|jd�|Scc}}w)a?Given the contents of entry-points file,
    process it into a 2-level dictionary (``dict[str, dict[str, str]]``).
    The first level keys are entry-point groups, the second level keys are
    entry-point names, and the second level values are references to objects
    (that correspond to the entry-point value).
    N)�=)�default_section�
delimiters)rrP�optionxform�read_stringr��dictr�r�)r��text_source�parserr�r��groupss      r/�entry_pointsr�|sr���$�6�
B�F��F��
���t�[�)�-3�\�\�^�
<�T�Q��a��a�g�g�i�� �
<�F�
<�
�J�J�v�%�%�t�,��M��=s�$Bc�`�eZdZdZd
d�Zd�Zd�Zd�Zdee	e	ffd�Z
edee	e	ffd��Zy	)�EnsurePackagesDiscovereda�Some expand functions require all the packages to already be discovered before
    they run, e.g. :func:`read_attr`, :func:`resolve_class`, :func:`cmdclass`.

    Therefore in some cases we will need to run autodiscovery during the evaluation of
    the configuration. However, it is better to postpone calling package discovery as
    much as possible, because some parameters can influence it (e.g. ``package_dir``),
    and those might not have been processed yet.
    c� �||_d|_y)NF)�_dist�_called)r-�distributions  r/r0z!EnsurePackagesDiscovered.__init__�s��!��
���r1c�d�|js$d|_|jjd��yy)zBTrigger the automatic package discovery, if it is still necessary.TF)r!N)r�r��set_defaults�r-s r/�__call__z!EnsurePackagesDiscovered.__call__�s*���|�|��D�L��J�J�#�#��#�/�r1c��|Sr$rRrs r/�	__enter__z"EnsurePackagesDiscovered.__enter__�s���r1c�f�|jr%|jjj�yyr$)r�r�r�analyse_name)r-�	_exc_type�
_exc_value�
_tracebacks    r/�__exit__z!EnsurePackagesDiscovered.__exit__�s$���<�<��J�J�#�#�0�0�2�r1r2c�H�|�|jj}|�iS|Sr$)r�r�)r-�pkg_dirs  r/�_get_package_dirz)EnsurePackagesDiscovered._get_package_dir�s%�����*�*�(�(���_�r�1�'�1r1c�,�t|j�S)zCProxy to ``package_dir`` that may trigger auto-discovery when used.)�LazyMappingProxyrrs r/r�z$EnsurePackagesDiscovered.package_dir�s�� �� 5� 5�6�6r1N)r�r)
rLrMrNrOr0rrrr
rPr�propertyr�rRr1r/r�r��sT����0��3�2�'�#�s�(�"3�2�
�7�W�S�#�X�.�7��7r1r�c�t�eZdZdZdegeeefffd�Zdeeeffd�Z	dedefd�Z
defd�Zde
efd	�Zy
)ra�Mapping proxy that delays resolving the target object, until really needed.

    >>> def obtain_mapping():
    ...     print("Running expensive function!")
    ...     return {"key": "value", "other key": "other value"}
    >>> mapping = LazyMappingProxy(obtain_mapping)
    >>> mapping["key"]
    Running expensive function!
    'value'
    >>> mapping["other key"]
    'other value'
    �obtain_mapping_valuec� �||_d|_yr$)�_obtain�_value)r-rs  r/r0zLazyMappingProxy.__init__�s��+���15��r1r2c�\�|j�|j�|_|jSr$)rrrs r/�_targetzLazyMappingProxy._target�s#���;�;���,�,�.�D�K��{�{�r1�keyc�(�|j�|Sr$)r)r-rs  r/�__getitem__zLazyMappingProxy.__getitem__�s���|�|�~�c�"�"r1c�4�t|j��Sr$)r�rrs r/�__len__zLazyMappingProxy.__len__�s���4�<�<�>�"�"r1c�4�t|j��Sr$)�iterrrs r/r�zLazyMappingProxy.__iter__�s���D�L�L�N�#�#r1N)rLrMrNrOrr
rrr0rrr�rrr�rRr1r/rr�sh���6�X�b�'�"�b�&�/�6I�-J�6����R����
#�r�#�b�#�#��#�$�(�2�,�$r1rr$)NN)zentry-points)KrOr%r�r�r`r'r��globr�configparserr�importlib.machineryr�	itertoolsr�typingrrr	r
rrr
rrrrrr�typesr�distutils.errorsr�_pathrr��warningsr�setuptools.distrr�r�distutils.distr�
from_iterable�
chain_iterrP�PathLike�_Pathrrr rq�bytesr}r{ryrxr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrRr1r/�<module>r0s����&��	�	��
��%�*��
�
�
�
���1�+�(��,�4�3�
�
 �
 �
�
�c�2�;�;�����T�]���T�T�"��P�P�8:>���s�m��'/����	�#�Y��B�%��U�H�U�O� ;�<��PS��$E�h�u�o�E�(�5�/�E���u�e�|�,����
�E��S��04� $�#*��#*��'�#�s�(�+�,�#*��u�o�#*�L�C��h�u�o��*���Z��c��j��1��1�#+�G�C��H�,=�#>�1�JO�1�
�5�(�3�-��$�%�1�H04� $�
'��
'��'�#�s�(�+�,�
'��u�o�
'��	
'�$04� $�S���c��N�S��'�#�s�(�+�,�S��u�o�S�
�#�x�-��	S��15� $�	2��t�C��H�~�.�2��u�o�	2�
�#�Y�
2�j"�u�"�E�"�c�"�
�5��8�E�#�s�(�O�#<�c�A�B��s��$�t����@D���d�D�j�!��-5�e�_��	�%��T�#�Y��
� ��"�s��4��T�	�?��#7�#7�L$�w�r�2�v��$r1

Zerion Mini Shell 1.0