%PDF- %PDF-
Mini Shell

Mini Shell

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

�


_�d�R�	�p�dZddlZddlZddlmZddlmZddlmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZddlZddlmZddlmZeeej2fZeeZej8j:Ze	rdd	lm Z d
ede!fd�Z"Gd
�d�Z#Gd�d�Z$Gd�de$�Z%Gd�de%�Z&Gd�de$�Z'Gd�de&�Z(Gd�de'�Z)dedede
efd�Z*Gd�d�Z+d e
ede
efd!�Z,d e
ede
efd"�Z-d e
ed#eeefd$edeefd%�Z.d&ed#eeefd$edefd'�Z/d e
ed(ede
eeffd)�Z0y)*u_Automatic discovery of Python modules and packages (for inclusion in the
distribution) and other config values.

For the purposes of this module, the following nomenclature is used:

- "src-layout": a directory representing a Python project that contains a "src"
  folder. Everything under the "src" folder is meant to be included in the
  distribution when packaging the project. Example::

    .
    ├── tox.ini
    ├── pyproject.toml
    └── src/
        └── mypkg/
            ├── __init__.py
            ├── mymodule.py
            └── my_data_file.txt

- "flat-layout": a Python project that does not use "src-layout" but instead
  have a directory under the project root for each package::

    .
    ├── tox.ini
    ├── pyproject.toml
    └── mypkg/
        ├── __init__.py
        ├── mymodule.py
        └── my_data_file.txt

- "single-module": a project that contains a single Python script direct under
  the project root (no directory used)::

    .
    ├── tox.ini
    ├── pyproject.toml
    └── mymodule.py

�N��fnmatchcase)�glob)�Path)	�
TYPE_CHECKING�Dict�Iterable�Iterator�List�Mapping�Optional�Tuple�Union)�log)�convert_path)�Distribution�path�returnc�\�tjj|�j�S�N)�osr�basename�isidentifier)rs �6/usr/lib/python3/dist-packages/setuptools/discovery.py�_valid_namerGs ��
�7�7���D�!�.�.�0�0�c�<�eZdZdZdefd�Zdedefd�Zdedefd�Zy)	�_Filterz�
    Given a list of patterns, create a callable that will be true only if
    the input matches at least one of the patterns.
    �patternsc�8�tj|�|_yr)�dict�fromkeys�	_patterns)�selfrs  r�__init__z_Filter.__init__Rs�����x�0��r�itemrc�@��t�fd�|jD��S)Nc3�6�K�|]}t�|����y�wrr)�.0�patr&s  �r�	<genexpr>z#_Filter.__call__.<locals>.<genexpr>Vs�����D�c�;�t�S�)�D�s�)�anyr#�r$r&s `r�__call__z_Filter.__call__Us����D�T�^�^�D�D�Drc��||jvSr)r#r-s  r�__contains__z_Filter.__contains__Xs���t�~�~�%�%rN)	�__name__�
__module__�__qualname__�__doc__�strr%�boolr.r0�rrrrLs<���
1�#�1�E�S�E�T�E�&��&��&rrc��eZdZUdZdZeedfed<dZeedfed<e				d
de
deedeed	eefd
��Z
e	de
deded	efd��Zy)�_Finderz@Base class that exposes functionality for module/package findersr7.�ALWAYS_EXCLUDE�DEFAULT_EXCLUDE�where�exclude�includerc	��|xs|j}t|jtt	|��tg|j�|���t|���S)aFReturn a list of all Python items (packages or modules, depending on
        the finder implementation) found within directory 'where'.

        'where' is the root directory which will be searched.
        It should be supplied as a "cross-platform" (i.e. URL-style) path;
        it will be converted to the appropriate local path syntax.

        'exclude' is a sequence of names to exclude; '*' can be used
        as a wildcard in the names.
        When finding packages, 'foo.*' will exclude all subpackages of 'foo'
        (but not 'foo' itself).

        'include' is a sequence of names to include.
        If it's specified, only the named items will be included.
        If it's not specified, all found items will be included.
        'include' can contain shell style wildcard patterns just like
        'exclude'.
        )r;�list�
_find_iterrr5rr:��clsr<r=r>s    r�findz_Finder.findbsW��4�0�S�0�0����N�N��S��Z�(��6��+�+�6�g�6���!�
�
�	
rc��t�r)�NotImplementedErrorrBs    rrAz_Finder._find_iter�s��!�!rN)�.r7)�*)r1r2r3r4r:rr5�__annotations__r;�classmethod�_Pathr	rrDr�StrIterrAr7rrr9r9\s���J�&(�N�E�#�s�(�O�(�')�O�U�3��8�_�)���!#�!'�	 
�� 
��#�� 
��#��	 
�

�c�� 
�� 
�D�"�u�"�w�"��"�W�"��"rr9c	�T�eZdZdZdZededededefd��Z	e
ded	edefd
��Z
y)�
PackageFinderzI
    Generate a list of all Python packages found within a directory
    )�ez_setupz*__pycache__r<r=r>rc#��K�tjt|�d��D]�\}}}|dd}g|dd|D]�}tjj	||�}	tjj|	|�}
|
j
tjjd�}d|vs|j|	|�s��||�r||�s|��|�d�|vs|�d�|vr��|j|�����y�w)zy
        All the packages found in 'where' that pass the 'include' filter, but
        not the 'exclude' filter.
        T)�followlinksNrGrH�.*)
r�walkr5r�join�relpath�replace�sep�_looks_like_package�append)rCr<r=r>�root�dirs�files�all_dirs�dir�	full_path�rel_path�packages            rrAzPackageFinder._find_iter�s�����"$����U���!F�	!��D�$���A�w�H��D��G��
!���G�G�L�L��s�3�	��7�7�?�?�9�e�<��"�*�*�2�7�7�;�;��<���#�:�S�%<�%<�Y��%P���7�#�G�G�,<�!�M��Y�a�=�G�+�'��"�~��/H�����C� �'
!�	!�s�C1C3r�
_package_namec�|�tjjtjj|d��S)z%Does a directory look like a package?�__init__.py)rr�isfilerT)rrbs  rrXz!PackageFinder._looks_like_package�s&���w�w�~�~�b�g�g�l�l�4��?�@�@rN)r1r2r3r4r:rJrKrrLrA�staticmethodr5r6rXr7rrrNrN�sj���2�N��!�u�!�w�!��!�W�!��!�>�A�%�A��A��A��ArrNc�*�eZdZedededefd��Zy)�PEP420PackageFinder�_pathrbrc��y)NTr7)rirbs  rrXz'PEP420PackageFinder._looks_like_package�s��rN)r1r2r3rfrKr5r6rXr7rrrhrh�s)����5�������rrhc	�B�eZdZdZededededefd��Ze	e
�Zy)�ModuleFinderzYFind isolated Python modules.
    This function will **not** recurse subdirectories.
    r<r=r>rc#�6K�ttjj|d��D]i}tjj	tjj|��\}}|j
|�s�T||�s�]||�r�f|���ky�w)Nz*.py)rrrrT�splitextr�_looks_like_module)rCr<r=r>�file�module�_exts       rrAzModuleFinder._find_iter�ss����������e�V�4�5�	�D��7�7�+�+�B�G�G�,<�,<�T�,B�C�L�F�D��)�)�&�1���v��w�v����	�s�BB�	B�BN)r1r2r3r4rJrKrrLrArfrror7rrrlrl�sD�����u��w����W����&�k�2�rrlc�Z�eZdZdZeed�eD���Z	edede	de
fd��Zy)�FlatLayoutPackageFinder)#�ci�bin�debian�doc�docs�
documentation�manpages�news�
newsfragments�	changelog�test�tests�	unit_test�
unit_tests�example�examples�scripts�tools�util�utils�python�build�dist�venv�env�requirements�tasks�fabfile�
site_scons�	benchmark�
benchmarks�exercise�	exercises�htmlcov�[._]*c#�*K�|]}||�d�f���
y�w)rRNr7)r)�ps  rr+z!FlatLayoutPackageFinder.<genexpr>�s����&G���a�S��8�}�&G�s�ri�package_namerc��|jd�}|dj�xs|djd�}|xrtd�|ddD��S)NrGr�-stubsc3�<K�|]}|j����y�wr)r)r)�names  rr+z>FlatLayoutPackageFinder._looks_like_package.<locals>.<genexpr>s����(S���):�):�)<�(S�s��)�splitr�endswith�all)rir��names�root_pkg_is_valids    rrXz+FlatLayoutPackageFinder._looks_like_packagesU���"�"�3�'��!�!�H�1�1�3�R�u�Q�x�7H�7H��7R�� �S�S�(S��q�r��(S�%S�SrN)r1r2r3�_EXCLUDE�tuple�
chain_iterr;rfrKr5r6rXr7rrrtrt�sP��'�H�R�J�&G�h�&G�G�H�O� ��T�5�T��T��T��Trrtc��eZdZdZy)�FlatLayoutModuleFinder)�setup�conftestrr�r�r�r��toxfile�noxfile�pavement�dodor�r�z[Ss][Cc]onstruct�	conanfile�manager�r�r�r�r�N)r1r2r3r;r7rrr�r�	s���O�4*rr��root_pkg�pkg_dirc��tj|�}|g|D�cgc]}dj||f���c}zScc}w)NrG)rhrDrT)r�r��nested�ns    r�_find_packages_withinr�'s:��
 �
%�
%�g�
.�F��:�&�A�Q����8�Q�-�0�A�A�A��As�;c��eZdZdZdd�Zd�Zd�Zedefd��Z	ede
eeffd��Zdd�Z
d	edefd
�Zd	edefd�Zdefd�Zdefd
�Zdefd�Zdefd�Zdefd�Zdeedefd�Zd�Zdeefd�Zdeefd�Zy)�ConfigDiscoveryz�Fill-in metadata and options that can be automatically derived
    (from other metadata/options, the file system or conventions)
    c�<�||_d|_d|_d|_y)NF)r��_called�	_disabled�_skip_ext_modules)r$�distributions  rr%zConfigDiscovery.__init__1s�� ��	�������!&��rc��d|_y)z+Internal API to disable automatic discoveryTN)r��r$s r�_disablezConfigDiscovery._disable7s	����rc��d|_y)a�Internal API to disregard ext_modules.

        Normally auto-discovery would not be triggered if ``ext_modules`` are set
        (this is done for backward compatibility with existing packages relying on
        ``setup.py`` or ``setup.cfg``). However, ``setuptools`` can call this function
        to ignore given ``ext_modules`` and proceed with the auto-discovery if
        ``packages`` and ``py_modules`` are not given (e.g. when using pyproject.toml
        metadata).
        TN)r�r�s r�_ignore_ext_modulesz#ConfigDiscovery._ignore_ext_modules;s��"&��rrc�R�|jjxstjSr)r��src_rootr�curdirr�s r�	_root_dirzConfigDiscovery._root_dirGs���y�y�!�!�.�R�Y�Y�.rc�^�|jj�iS|jjSr)r��package_dirr�s r�_package_dirzConfigDiscovery._package_dirLs'���9�9� � �(��I��y�y�$�$�$rc��|dur|js|jry|j|�|r|j�d|_y)a�Automatically discover missing configuration fields
        and modifies the given ``distribution`` object in-place.

        Note that by default this will only have an effect the first time the
        ``ConfigDiscovery`` object is called.

        To repeatedly invoke automatic discovery (e.g. when the project
        directory changes), please use ``force=True`` (or create a new
        ``ConfigDiscovery`` instance).
        FNT)r�r��_analyse_package_layout�analyse_name)r$�forcer��ignore_ext_moduless    rr.zConfigDiscovery.__call__Rs?���E�>�t�|�|�t�~�~���$�$�%7�8��������rr�c�(�|xs|j}|jjduxs|}|jjduxsL|jjduxs2|xs.t|jd�xr|jjS)zF``True`` if the user has specified some form of package/module listingN�
configuration)r�r��ext_modules�packages�
py_modules�hasattrr�)r$r�r�s   r�_explicitly_specifiedz%ConfigDiscovery._explicitly_specifiedgs���/�I�4�3I�3I���9�9�0�0�D�8�N�<N�O���I�I���d�*�
(��y�y�#�#�4�/�
(��
(��t�y�y�/�2�(��	�	�'�'�	
rc��|j|�rytjd�|j�xs"|j	�xs|j�S)NTzLNo `packages` or `py_modules` configuration, performing automatic discovery.)r�r�debug�_analyse_explicit_layout�_analyse_src_layout�_analyse_flat_layout)r$r�s  rr�z'ConfigDiscovery._analyse_package_layoutts^���%�%�&8�9���	�	�
#�	
�
�)�)�+�
+��'�'�)�
+��(�(�*�		
rc�|��|jj�}|jdd�|j�|syt	j
d|���t
�fd�|j�D��}t|�|j_
t	j
d|jj���y)zAThe user can explicitly give a package layout via ``package_dir``�NFz(`explicit-layout` detected -- analysing c3�x�K�|]1\}}t|tjj�|�����3y�wr)r�rrrT)r)�pkg�
parent_dir�root_dirs   �rr+z;ConfigDiscovery._analyse_explicit_layout.<locals>.<genexpr>�s3�����
���Z�
"�#�r�w�w�|�|�H�j�'I�J�
�s�7:�discovered packages -- T)r��copy�popr�rr�r��itemsr@r�r�)r$r��pkgsr�s   @rr�z(ConfigDiscovery._analyse_explicit_layout�s�����'�'�,�,�.������D�!��>�>�����	�	�<�[�M�J�K��
�#.�#4�#4�#6�
�
��"�$�Z��	�	���	�	�+�D�I�I�,>�,>�+?�@�A�rc��|j}tjj|j|jdd��}tjj
|�sytjd|���|jdtjj|��||j_tj|�|j_t j|�|j_tjd|jj���tjd|jj"���y)a�Try to find all packages or modules under the ``src`` directory
        (or anything pointed by ``package_dir[""]``).

        The "src-layout" is relatively safe for automatic discovery.
        We assume that everything within is meant to be included in the
        distribution.

        If ``package_dir[""]`` is not given, but the ``src`` directory exists,
        this function will set ``package_dir[""] = "src"``.
        r��srcFz#`src-layout` detected -- analysing r��discovered py_modules -- T)r�rrrTr��get�isdirrr��
setdefaultrr�r�rhrDr�rlr�)r$r��src_dirs   rr�z#ConfigDiscovery._analyse_src_layout�s����'�'���'�'�,�,�t�~�~�{���r�5�/I�J���w�w�}�}�W�%���	�	�7��y�A�B����r�2�7�7�#3�#3�G�#<�=� +��	�	��0�5�5�g�>��	�	��+�0�0��9��	�	���	�	�+�D�I�I�,>�,>�+?�@�A��	�	�-�d�i�i�.B�.B�-C�D�E�rc��tjd|j���|j�xs|j	�S)a�Try to find all packages and modules under the project root.

        Since the ``flat-layout`` is more dangerous in terms of accidentally including
        extra files/directories, this function is more conservative and will raise an
        error if multiple packages or modules are found.

        This assumes that multi-package dists are uncommon and refuse to support that
        use case in order to be able to prevent unintended errors.
        z$`flat-layout` detected -- analysing )rr�r��_analyse_flat_packages�_analyse_flat_modulesr�s rr�z$ConfigDiscovery._analyse_flat_layout�s:��	�	�	�8����8H�I�J��*�*�,�L��0J�0J�0L�Lrc�@�tj|j�|j_tt
|jj��}tjd|jj���|j|d�t|�S)Nr�r�)rtrDr�r�r��remove_nested_packages�remove_stubsrr��_ensure_no_accidental_inclusionr6)r$�	top_levels  rr�z&ConfigDiscovery._analyse_flat_packages�so��4�9�9�$�.�.�I��	�	��*�<��	�	�8J�8J�+K�L�	��	�	�+�D�I�I�,>�,>�+?�@�A��,�,�Y�
�C��I��rc�@�tj|j�|j_tjd|jj���|j|jjd�t|jj�S)Nr��modules)	r�rDr�r�r�rr�r�r6r�s rr�z%ConfigDiscovery._analyse_flat_modules�sk��5�:�:�4�>�>�J��	�	���	�	�-�d�i�i�.B�.B�-C�D�E��,�,�T�Y�Y�-A�-A�9�M��D�I�I�(�(�)�)r�detected�kindc�l�t|�dkDr&ddlm}ddlm}d|�d|�d|�d�}|||���y)	Nr�r)�cleandoc)�PackageDiscoveryErrorzMultiple top-level z discovered in a flat-layout: z�.

            To avoid accidental inclusion of unwanted files or directories,
            setuptools will not proceed with this build.

            If you are trying to create a single distribution with multiple a�
            on purpose, you should not rely on automatic discovery.
            Instead, consider the following options:

            1. set up custom discovery (`find` directive with `include` or `exclude`)
            2. use a `src-layout`
            3. explicitly set `py_modules` or `packages` with a list of names

            To find more information, look for "package discovery" on setuptools docs.
            )�len�inspectr��setuptools.errorsr�)r$r�r�r�r��msgs      rr�z/ConfigDiscovery._ensure_no_accidental_inclusion�sU���x�=�1��(�?�)�$��/M�h�Z�XM�
NR�F�	S
��C�(���
�6�6�)rc��|jjjs|jjrytjd�|j�xs|j
�}|r||jj_yy)z�The packages/modules are the essential contribution of the author.
        Therefore the name of the distribution can be derived from them.
        Nz7No `name` configuration, performing automatic discovery)r��metadatar�rr��#_find_name_single_package_or_module�_find_name_from_packages)r$r�s  rr�zConfigDiscovery.analyse_name�sq���9�9���"�"�d�i�i�n�n���	�	�K�L�
�4�4�6�
/��,�,�.�	
��&*�D�I�I���#�rc��dD]P}t|j|d�xsg}|s�!t|�dk(s�0tjd|d���|dcSy)zExactly one module or package)r�r�Nr�z&Single module/package detected, name: r)�getattrr�r�rr�)r$�fieldr�s   rrz3ConfigDiscovery._find_name_single_package_or_module�s[��/�	 �E��D�I�I�u�d�3�9�r�E���U��q���	�	�B�5��8�*�M�N��Q�x��		 �rc�R�|jjsytt|jjt���}|jj
xsi}t
|||j�}|rtjd|���|Stjd�y)z<Try to find the root package that is not a PEP 420 namespaceN��keyz&Common parent package detected, name: z7No parent package detected, impossible to derive `name`)r�r�r��sortedr�r��find_parent_packager�rr��warn)r$r�r��
parent_pkgs    rrz(ConfigDiscovery._find_name_from_packages�s����y�y�!�!����t�y�y�'9�'9�s� C�D���i�i�+�+�1�r��(��;����O�
���I�I�>�z�l�K�L������J�K�rN)r�r)FTF)r1r2r3r4r%r�r��propertyrKr�rr5r�r.r6r�r�r�r�r�r�r�rr�r�r
rrr7rrr�r�,s����'��
&��/�5�/��/��%�d�3��8�n�%��%�
�*
��
��
�
�$�
�4�
�$�$��$�T��2M�d�M����*�t�*�7��S�	�7��7�.+�"�X�c�]���(�3�-�rr�r�c����t|t��}|dd}t|�}tt|��D]1\}�t	�fd�|D��s�|j||z
dz
��3|S)z�Remove nested packages from a list of packages.

    >>> remove_nested_packages(["a", "a.b1", "a.b2", "a.b1.c1"])
    ['a']
    >>> remove_nested_packages(["a", "b", "c.d", "c.d.e.f", "g.h", "a.a1"])
    ['a', 'b', 'c.d', 'g.h']
    r	Nc3�F�K�|]}�j|�d�����y�w�rGN��
startswith)r)�otherr�s  �rr+z)remove_nested_packages.<locals>.<genexpr>s �����C��t���%���{�+�C���!r�)rr��	enumerate�reversedr,r�)r�r�r��size�ir�s     @rr�r�si����(��$�D��Q��I��t�9�D��X�d�^�,�(���4��C��C�C��M�M�$��(�Q�,�'�(��rc�t�|D�cgc](}|jd�djd�r�'|��*c}Scc}w)z�Remove type stubs (:pep:`561`) from a list of packages.

    >>> remove_stubs(["a", "a.b", "a-stubs", "a-stubs.b.c", "b", "c-stubs"])
    ['a', 'a.b', 'b']
    rGrr�)r�r�)r�r�s  rr�r� s2��$�P�C�3�9�9�S�>�!�+<�+E�+E�h�+O�C�P�P��Ps�(5�5r�r�c�Z��t|t��}g}t|�D]2\}�t�fd�||dzdD��sn|j	���4|D]R�t�||�}tjj|d�}tjj|�s�P�cSy)z0Find the parent package that is not a namespace.r	c3�F�K�|]}|j��d�����y�wrr)r)r�r�s  �rr+z&find_parent_package.<locals>.<genexpr>0s �����G��1�<�<�4�&��
�+�G�rr�Nrd)
rr�rr�rY�find_package_pathrrrTre)r�r�r��common_ancestorsr�pkg_path�initr�s       @rrr)s�����h�C�(�H����X�&�&���4��G�X�a�!�e�g�5F�G�G�

�����%�&�!���$�T�;��A���w�w�|�|�H�m�4��
�7�7�>�>�$���K�	�rr�c�l�|jd�}tt|�dd�D]E}dj|d|�}||vs�||}t	j
j||g||d���cS|j
d�xsd}t	j
j|g|jd��|���S)a�Given a package name, return the path where it should be found on
    disk, considering the ``package_dir`` option.

    >>> path = find_package_path("my.pkg", {"": "root/is/nested"}, ".")
    >>> path.replace(os.sep, "/")
    './root/is/nested/my/pkg'

    >>> path = find_package_path("my.pkg", {"my": "root/is/nested"}, ".")
    >>> path.replace(os.sep, "/")
    './root/is/nested/pkg'

    >>> path = find_package_path("my.pkg", {"my.pkg": "root/is/nested"}, ".")
    >>> path.replace(os.sep, "/")
    './root/is/nested'

    >>> path = find_package_path("other.pkg", {"my.pkg": "root/is/nested"}, ".")
    >>> path.replace(os.sep, "/")
    './other/pkg'
    rGr���Nr��/)r��ranger�rTrrr�)r�r�r��partsr�partial_name�parents       rrrAs���,
�J�J�s�O�E�
�3�u�:�q�"�
%�>���x�x��b�q�	�*���;�&� ��.�F��7�7�<�<��&�=�5���9�=�=�>��_�_�R�
 �
&�B�F�
�7�7�<�<��=�6�<�<��#4�=�u�=�=r�package_pathc
��t|�}t|�j}|D�cic]'}|djg|�|j	d�����)c}Scc}w)Nr$rG)r�rr&rTr�)r�r)�parent_pkgs�prefixr�s     r�construct_package_dirr-csQ��(��2�K�
�,�
�
%�
%�F�AL�M�#�C����4�F�4�S�Y�Y�s�^�4�5�5�M�M��Ms�,A)1r4�	itertoolsr�fnmatchrr�pathlibr�typingrrr	r
rrr
rr�_distutils_hack.override�_distutils_hack�	distutilsr�distutils.utilrr5�PathLikerKrL�chain�
from_iterabler��
setuptoolsrr6rrr9rNrhrlrtr�r�r�r�r�rrr-r7rr�<module>r:s���%�N�	����
�
�
� ��'�
�c�2�;�;����
�3�-��
�_�_�
*�
*�
��'�1�e�1��1�

&�
&� +"�+"�\*A�G�*A�Z�-��3�7�3�.2T�1�2T�j*�\�*�<B�C�B�%�B�D��I�B�
_�_�D�T�#�Y��4��9��$Q�4��9�Q��c��Q���3�i��&-�c�3�h�&7��CH��
�c�]��0>�

�>�#�C��H�-�>�9>�>��>�DN�D��I�N�U�N�t�C�QT�H�~�Nr

Zerion Mini Shell 1.0