Ë
     täi&S  ã                  óÖ  — d Z ddlmZ ddlZddlZddlmZmZmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZmZ ddlZd	d
lmZ ddlmZ ddlmZ erddlmZ ej6                  j8                  Zd%d„Z G d„ d«      Z G d„ d«      Z  G d„ de «      Z! G d„ de!«      Z" G d„ de «      Z# G d„ de"«      Z$ G d„ de#«      Z%d&d„Z& G d„ d«      Z'd'd „Z(d'd!„Z)	 	 	 	 	 	 	 	 d(d"„Z*	 	 	 	 	 	 	 	 d)d#„Z+d*d$„Z,y)+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

é    )ÚannotationsN)ÚIterableÚIteratorÚMapping©Úfnmatchcase)Úglob)ÚPath)ÚTYPE_CHECKINGÚClassVaré   )ÚStrPath)Úlog)Úconvert_path)ÚDistributionc                ó\   — t         j                  j                  | «      j                  «       S ©N)ÚosÚpathÚbasenameÚisidentifier)r   s    úc/Volumes/fast/ai/experiments/MLX_z-image/.venv/lib/python3.12/site-packages/setuptools/discovery.pyÚ_valid_namer   ?   s    € ä�7‰7×Ñ˜DÓ!×.Ñ.Ó0Ð0ó    c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)Ú_Filterzƒ
    Given a list of patterns, create a callable that will be true only if
    the input matches at least one of the patterns.
    c                ó8   — t         j                  |«      | _        y r   )ÚdictÚfromkeysÚ	_patterns)ÚselfÚpatternss     r   Ú__init__z_Filter.__init__J   s   € ÜŸ™ xÓ0ˆ�r   c                ó@   ‡— t        ˆfd„| j                  D «       «      S )Nc              3  ó6   •K  — | ]  }t        ‰|«      –— Œ y ­wr   r   )Ú.0ÚpatÚitems     €r   Ú	<genexpr>z#_Filter.__call__.<locals>.<genexpr>N   s   øè ø€ ÐD±^¨c”;˜t S×)±^ùs   ƒ)Úanyr    ©r!   r(   s    `r   Ú__call__z_Filter.__call__M   s   ø€ ÜÓD°T·^²^ÓDÓDÐDr   c                ó   — || j                   v S r   )r    r+   s     r   Ú__contains__z_Filter.__contains__P   s   € Ø�t—~‘~Ð%Ð%r   N)r"   ÚstrÚreturnÚNone)r(   r/   r0   Úbool)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r#   r,   r.   © r   r   r   r   D   s   „ ñó
1óEô&r   r   c                  óx   — e Zd ZU dZdZded<   dZded<   e	 	 	 d		 	 	 	 	 	 	 d
d„«       Ze	 	 	 	 	 	 	 	 dd„«       Z	y)Ú_Finderz@Base class that exposes functionality for module/package findersr7   zClassVar[tuple[str, ...]]ÚALWAYS_EXCLUDEÚDEFAULT_EXCLUDEc           	     ó´   — |xs | j                   }t        | j                  t        t	        |«      «      t        g | j                  ¢|¢­Ž t        |Ž «      «      S )aZ  Return 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_iterr   r/   r   r:   ©ÚclsÚwhereÚexcludeÚincludes       r   Úfindz_Finder.findZ   sW   € ð4 Ò0˜S×0Ñ0ˆÜØ�N‰NÜœS ›ZÓ(ÜÐ6˜×+Ñ+Ð6¨gÒ6Ü˜Ð!óó
ð 	
r   c                ó   — t         ‚r   )ÚNotImplementedErrorr?   s       r   r>   z_Finder._find_iter}   s
   € ô "Ð!r   N)Ú.r7   )Ú*)rA   r   rB   úIterable[str]rC   rI   r0   ú	list[str]©rA   r   rB   r   rC   r   r0   zIterator[str])
r3   r4   r5   r6   r:   Ú__annotations__r;   ÚclassmethodrD   r>   r7   r   r   r9   r9   T   s“   … ÙJà02€NÐ-Ó2Ø13€OÐ.Ó3àð Ø!#Ø!'ð	 
àð 
ð ð 
ð ð	 
ð
 
ò 
ó ð 
ðD ð"Øð"Ø&-ð"Ø8?ð"à	ò"ó ñ"r   r9   c                  óH   — e Zd ZdZdZe	 	 	 	 	 	 	 	 dd„«       Zedd„«       Zy)ÚPackageFinderzI
    Generate a list of all Python packages found within a directory
    )Úez_setupz*__pycache__c              #  óê  K  — t        j                  t        |«      d¬«      D ]Ì  \  }}}|dd }g |dd |D ]·  }t         j                  j	                  ||«      }	t         j                  j                  |	|«      }
|
j                  t         j                  j                  d«      }d|v s| j                  |	|«      sŒ„ ||«      r ||«      s|–— |› d�|v s|› d�|v rŒ§|j                  |«       Œ¹ ŒÎ y­w)zy
        All the packages found in 'where' that pass the 'include' filter, but
        not the 'exclude' filter.
        T)ÚfollowlinksNrG   rH   ú.*)
r   Úwalkr/   r   ÚjoinÚrelpathÚreplaceÚsepÚ_looks_like_packageÚappend)r@   rA   rB   rC   ÚrootÚdirsÚfilesÚall_dirsÚdirÚ	full_pathÚrel_pathÚpackages               r   r>   zPackageFinder._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Õ ñ'  ñ "Gùs   ‚C1C3c                ó|   — t         j                  j                  t         j                  j                  | d«      «      S )z%Does a directory look like a package?ú__init__.py)r   r   ÚisfilerU   )r   Ú_package_names     r   rY   z!PackageFinder._looks_like_package­   s&   € ô �w‰w�~‰~œbŸg™gŸl™l¨4°Ó?Ó@Ð@r   NrK   )r   r   rf   r/   r0   r2   )	r3   r4   r5   r6   r:   rM   r>   ÚstaticmethodrY   r7   r   r   rO   rO   „   sW   „ ñð 2€Nàð!Øð!Ø&-ð!Ø8?ð!à	ò!ó ð!ðB òAó ñAr   rO   c                  ó   — e Zd Zedd„«       Zy)ÚPEP420PackageFinderc                 ó   — y)NTr7   )Ú_pathrf   s     r   rY   z'PEP420PackageFinder._looks_like_package´   s   € àr   N)rk   r   rf   r/   r0   r2   )r3   r4   r5   rg   rY   r7   r   r   ri   ri   ³   s   „ Øòó ñr   ri   c                  óB   — e Zd ZdZe	 	 	 	 	 	 	 	 dd„«       Z ee«      Zy)ÚModuleFinderzYFind isolated Python modules.
    This function will **not** recurse subdirectories.
    c              #  ó6  K  — t        t        j                  j                  |d«      «      D ]i  }t        j                  j	                  t        j                  j                  |«      «      \  }}| j                  |«      sŒT ||«      sŒ] ||«      rŒf|–— Œk y ­w)Nz*.py)r	   r   r   rU   Úsplitextr   Ú_looks_like_module)r@   rA   rB   rC   ÚfileÚmoduleÚ_exts          r   r>   zModuleFinder._find_iter¾   sp   è ø€ ô œŸ™Ÿ™ e¨VÓ4Ö5ˆDÜŸ7™7×+Ñ+¬B¯G©G×,<Ñ,<¸TÓ,BÓC‰LˆF�Dà×)Ñ)¨&Ô1Øá�v�¡w¨v¥Ø“ñ 6ùs   ‚BBÂ	BÂBNrK   )	r3   r4   r5   r6   rM   r>   rg   r   rp   r7   r   r   rm   rm   ¹   sH   „ ñð ð
Øð
Ø&-ð
Ø8?ð
à	ò
ó ð
ñ & kÓ2Ñr   rm   c                  óN   — e Zd ZdZ e ed„ eD «       «      «      Z	 edd„«       Zy)Ú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)rS   Nr7   )r&   Úps     r   r)   z!FlatLayoutPackageFinder.<genexpr>ü   s   è ø€ Ð&G¹h¸¨¨a¨S°¨8¤}¹hùs   ‚c                ó¨   — |j                  d«      }|d   j                  «       xs |d   j                  d«      }|xr t        d„ |dd  D «       «      S )NrG   r   ú-stubsc              3  ó<   K  — | ]  }|j                  «       –— Œ y ­wr   )r   )r&   Únames     r   r)   z>FlatLayoutPackageFinder._looks_like_package.<locals>.<genexpr>  s   è ø€ Ð(SÉÀ¨×):Ñ):×)<Éùs   ‚r   )Úsplitr   ÚendswithÚall)rk   Úpackage_nameÚnamesÚroot_pkg_is_valids       r   rY   z+FlatLayoutPackageFinder._looks_like_packageÿ   sU   € à×"Ñ" 3Ó'ˆà! !™H×1Ñ1Ó3ÒR°u¸Q±x×7HÑ7HÈÓ7RÐØ ÒS¤SÑ(SÈÈqÈrÉÓ(SÓ%SÐSr   N)rk   r   r¢   r/   r0   r2   )	r3   r4   r5   Ú_EXCLUDEÚtupleÚ
chain_iterr;   rg   rY   r7   r   r   ru   ru   Ò   s8   „ ð'€HñR ™JÑ&G¹hÓ&GÓGÓH€OØ àòTó ñTr   ru   c                  ó   — e Zd ZdZy)ÚFlatLayoutModuleFinder)ÚsetupÚconftestr€   r�   r„   r…   r‹   ÚtoxfileÚnoxfileÚpavementÚdodor�   r‘   z[Ss][Cc]onstructÚ	conanfileÚmanager“   r”   r•   r–   r˜   N)r3   r4   r5   r;   r7   r   r   r©   r©     s   „ ð€Oð4 *r   r©   c                ó€   — t         j                  |«      }| g|D �cg c]  }dj                  | |f«      ‘Œ c}z   S c c}w )NrG   )ri   rD   rU   )Úroot_pkgÚpkg_dirÚnestedÚns       r   Ú_find_packages_withinr·   %  s>   € Ü ×%Ñ% gÓ.€FØˆ:¹&ÓA¹&°Q˜Ÿ™ 8¨Q -Õ0¸&ÑAÑAÐAùÒAs   œ;c                  óº   — e Zd ZdZdd„Zd„ Zd„ Zedd„«       Zedd„«       Z		 d	 	 	 	 	 	 	 dd„Z
dd„Zdd	„Zdd
„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zy)Ú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     r   r#   zConfigDiscovery.__init__/  s   € Ø ˆŒ	ØˆŒØˆŒØ!&ˆÕr   c                ó   — d| _         y)z+Internal API to disable automatic discoveryTN)r¼   ©r!   s    r   Ú_disablezConfigDiscovery._disable5  s	   € àˆ�r   c                ó   — 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_modules9  s   € ð "&ˆÕr   c                óR   — | j                   j                  xs t        j                  S r   )rŒ   Úsrc_rootr   ÚcurdirrÀ   s    r   Ú	_root_dirzConfigDiscovery._root_dirE  s   € ð �y‰y×!Ñ!Ò.¤R§Y¡YÐ.r   c                ó^   — | j                   j                  €i S | j                   j                  S r   )rŒ   Úpackage_dirrÀ   s    r   Ú_package_dirzConfigDiscovery._package_dirJ  s'   € à�9‰9× Ñ Ð(ØˆIØ�y‰y×$Ñ$Ð$r   c                ó’   — |du r| j                   s| j                  ry| 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       r   r,   zConfigDiscovery.__call__P  s?   € ð �E‰>˜tŸ|š|¨t¯~ª~àà×$Ñ$Ð%7Ô8ÙØ×ÑÔàˆ�r   c                ó(  — |xs | j                   }| j                  j                  du xs | }| j                  j                  duxsL | j                  j                  duxs2 |xs. t        | j                  d«      xr | j                  j                  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_specifiedg  s�   € à/ÒI°4×3IÑ3IÐØŸ9™9×0Ñ0°DÐ8ÒNÐ<NÐOˆà�I‰I×Ñ dÐ*ò (Ø�y‰y×#Ñ#¨4Ð/ò(àò(ô �t—y‘y /Ó2ò (Ø—	‘	×'Ñ'ð	
r   c                ó¸   — | j                  |«      ryt        j                  d«       | j                  «       xs" | j	                  «       xs | 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     r   rÌ   z'ConfigDiscovery._analyse_package_layoutt  s^   € Ø×%Ñ%Ð&8Ô9ð ä�	‰	ð#ô	
ð ×)Ñ)Ó+ò +Ø×'Ñ'Ó)ò+ð ×(Ñ(Ó*ð		
r   c                ó|  ‡— | j                   j                  «       }|j                  dd«       | j                  Š|syt	        j
                  d|› �«       t        ˆfd„|j                  «       D «       «      }t        |«      | j                  _
        t	        j
                  d| j                  j                  › �«       y)zAThe user can explicitly give a package layout via ``package_dir``Ú NFz(`explicit-layout` detected -- analysing c              3  óx   •K  — | ]1  \  }}t        |t        j                  j                  ‰|«      «      –— Œ3 y ­wr   )r·   r   r   rU   )r&   ÚpkgÚ
parent_dirÚroot_dirs      €r   r)   z;ConfigDiscovery._analyse_explicit_layout.<locals>.<genexpr>�  s3   øè ø€ ð 
á#6‘��Zô " #¤r§w¡w§|¡|°H¸jÓ'I×JÙ#6ùs   ƒ7:údiscovered packages -- T)rÊ   ÚcopyÚpoprÇ   r   rØ   r§   Úitemsr=   rŒ   rÓ   )r!   rÉ   Úpkgsrá   s      @r   rÙ   z(ConfigDiscovery._analyse_explicit_layout†  sœ   ø€ à×'Ñ'×,Ñ,Ó.ˆØ�‰˜˜DÔ!Ø—>‘>ˆáØä�	‰	Ð<¸[¸MÐJÔKÜó 
à#.×#4Ñ#4Ô#6ó
ó 
ˆô " $›Zˆ�	‰	ÔÜ�	‰	Ð+¨D¯I©I×,>Ñ,>Ð+?Ð@ÔAØr   c                óÀ  — | j                   }t        j                  j                  | j                  |j                  dd«      «      }t        j                  j                  |«      syt        j                  d|› �«       |j                  dt        j                  j                  |«      «       || j                  _        t        j                  |«      | j                  _        t         j                  |«      | j                  _        t        j                  d| j                  j                  › �«       t        j                  d| j                  j"                  › �«       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Ê   r   r   rU   rÇ   ÚgetÚisdirr   rØ   Ú
setdefaultr   rŒ   rÉ   ri   rD   rÓ   rm   rÔ   )r!   rÉ   Úsrc_dirs      r   rÚ   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Ør   c                óŠ   — t        j                  d| j                  › �«       | j                  «       xs | 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 )r   rØ   rÇ   Ú_analyse_flat_packagesÚ_analyse_flat_modulesrÀ   s    r   rÛ   z$ConfigDiscovery._analyse_flat_layout±  s:   € ô 	�	‰	Ð8¸¿¹Ð8HÐIÔJØ×*Ñ*Ó,ÒL°×0JÑ0JÓ0LÐLr   c                ó@  — t         j                  | j                  «      | j                  _        t        t        | j                  j                  «      «      }t        j                  d| j                  j                  › �«       | j                  |d«       t        |«      S )Nrâ   rÓ   )ru   rD   rÇ   rŒ   rÓ   Úremove_nested_packagesÚremove_stubsr   rØ   Ú_ensure_no_accidental_inclusionr2   )r!   Ú	top_levels     r   rï   z&ConfigDiscovery._analyse_flat_packages¾  so   € Ü4×9Ñ9¸$¿.¹.ÓIˆ�	‰	ÔÜ*¬<¸¿	¹	×8JÑ8JÓ+KÓLˆ	Ü�	‰	Ð+¨D¯I©I×,>Ñ,>Ð+?Ð@ÔAØ×,Ñ,¨Y¸
ÔCÜ�I‹Ðr   c                ó@  — t         j                  | j                  «      | j                  _        t        j                  d| j                  j                  › �«       | j                  | j                  j                  d«       t        | j                  j                  «      S )Nré   Úmodules)	r©   rD   rÇ   rŒ   rÔ   r   rØ   rô   r2   rÀ   s    r   rð   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   c                ól   — t        |«      dkD  r&ddlm} ddlm} d|› d|› d|› d�} | ||«      «      ‚y )	Nr   r   )Úcleandoc)ÚPackageDiscoveryErrorzMultiple 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!   ÚdetectedÚkindrù   rú   Úmsgs         r   rô   z/ConfigDiscovery._ensure_no_accidental_inclusionË  sU   € Üˆx‹=˜1ÒÝ(å?à)¨$¨Ð/MÈhÈZð XMð
 NRÈFð 	SðˆCñ (©°«Ó6Ð6ð) r   c                ó  — | j                   j                  j                  s| j                   j                  ryt        j                  d«       | j                  «       xs | j                  «       }|r|| j                   j                  _        yy)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ž   r   rØ   Ú#_find_name_single_package_or_moduleÚ_find_name_from_packages)r!   rž   s     r   rÍ   zConfigDiscovery.analyse_nameâ  sq   € ð �9‰9×Ñ×"Ò" d§i¡i§n¢nàä�	‰	ÐKÔLð ×4Ñ4Ó6ò /Ø×,Ñ,Ó.ð 	ñ Ø&*ˆD�I‰I×ÑÕ#ð r   c                ó®   — dD ]P  }t        | j                  |d«      xs g }|sŒ!t        |«      dk(  sŒ0t        j                  d|d   › �«       |d   c S  y)zExactly one module or package)rÓ   rÔ   Nr   z&Single module/package detected, name: r   )ÚgetattrrŒ   rû   r   rØ   )r!   Úfieldrå   s      r   r  z3ConfigDiscovery._find_name_single_package_or_moduleó  sV   € ã/ˆEÜ˜DŸI™I u¨dÓ3Ò9°rˆEÚœ˜U› q›Ü—	‘	ÐBÀ5ÈÁ8À*ÐMÔNØ˜Q‘x’ð	 0ð r   c                óR  — | j                   j                  syt        t        | j                   j                  t        ¬«      «      }| j                   j
                  xs i }t        ||| j                  «      }|rt        j                  d|› �«       |S t        j                  d«       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Ç   r   rØ   Úwarn)r!   rÓ   rÉ   Ú
parent_pkgs       r   r  z(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Ør   N)r¾   r   r0   r1   )r0   r   )r0   údict[str, str])FTF)rÎ   r2   rž   r2   rÏ   r2   r0   r1   )rÏ   r2   r0   r2   )r0   r2   )rþ   rJ   rÿ   r/   )r0   r1   )r0   ú
str | None)r3   r4   r5   r6   r#   rÁ   rÃ   ÚpropertyrÇ   rÊ   r,   rÖ   rÌ   rÙ   rÚ   rÛ   rï   rð   rô   rÍ   r  r  r7   r   r   r¹   r¹   *  s¢   „ ñó'òò
&ð ò/ó ð/ð ò%ó ð%ð RWðØðØ)-ðØJNðà	óó.
ó
ó$ó$ó2Móó*ó7ó.+ó"ôr   r¹   c                óÚ   ‡— t        | t        ¬«      }|dd }t        |«      }t        t        |«      «      D ]1  \  }Št	        ˆfd„|D «       «      sŒ|j                  ||z
  dz
  «       Œ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	  Nc              3  óF   •K  — | ]  }‰j                  |› d �«      –— Œ y­w©rG   N©Ú
startswith)r&   Úotherrž   s     €r   r)   z)remove_nested_packages.<locals>.<genexpr>  s!   øè ø€ ÐC¹°ˆt�‰ % ¨˜{×+¹ùó   ƒ!r   )r  rû   Ú	enumerateÚreversedr*   rä   )rÓ   ræ   rõ   ÚsizeÚirž   s        @r   rò   rò     sd   ø€ ô �(¤Ô$€DØ‘Q�€IÜˆt‹9€DÜœX d›^Ö,‰ˆˆ4ÜÓC¹ÓCÕCØ�M‰M˜$ ™( Q™,Õ'ð -ð Ðr   c                ót   — | D �cg c](  }|j                  d«      d   j                  d«      rŒ'|‘Œ* c}S c c}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']
    rG   r   rœ   )rŸ   r    )rÓ   rß   s     r   ró   ró      s6   € ñ $ÓP™8�C¨3¯9©9°S«>¸!Ñ+<×+EÑ+EÀhÕ+OŠC˜8ÑPÐPùÒPs   …(5®5c                óZ  ‡— t        | t        ¬«      } g }t        | «      D ]2  \  }Št        ˆfd„| |dz   d D «       «      s n|j	                  ‰«       Œ4 |D ]R  Št        ‰||«      }t        j                  j                  |d«      }t        j                  j                  |«      sŒP‰c S  y)z0Find the parent package that is not a namespace.r	  c              3  óF   •K  — | ]  }|j                  ‰› d �«      –— Œ y­wr  r  )r&   r¶   rž   s     €r   r)   z&find_parent_package.<locals>.<genexpr>0  s#   øè ø€ ÐGÑ5F°�1—<‘< 4 &¨ 
×+Ñ5Fùr  r   Nrd   )
r  rû   r  r¡   rZ   Úfind_package_pathr   r   rU   re   )rÓ   rÉ   rá   Úcommon_ancestorsr  Úpkg_pathÚinitrž   s          @r   r  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ð	 !ð r   c                ól  — | j                  d«      }t        t        |«      dd«      D ]E  }dj                  |d| «      }||v sŒ||   }t	        j
                  j                  ||g||d ¢­Ž c S  |j                  d«      xs d}t	        j
                  j                  |g|j                  d«      ¢|¢­Ž 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'
    rG   r   éÿÿÿÿNrÝ   Ú/)rŸ   Úrangerû   rU   r   r   rê   )rž   rÉ   rá   Úpartsr  Úpartial_nameÚparents          r   r   r   A  s©   € ð, �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   c           
     ó²   — t        | «      }t        |«      j                  }|D �ci c]'  }|dj                  g |¢|j	                  d«      ¢«      “Œ) c}S c c}w )Nr&  rG   )rò   r
   r(  rU   rŸ   )rÓ   Úpackage_pathÚparent_pkgsÚprefixrß   s        r   Úconstruct_package_dirr/  c  sU   € Ü(¨Ó2€KÜ�,Ó×%Ñ%€FÙALÓMÁ¸#ˆC�—‘Ð4˜FÐ4 S§Y¡Y¨s£^Ð4Ó5Ñ5ÀÑMÐMùÒMs   ¥,A)r   r   r0   r2   )r³   r/   r´   r   r0   rJ   )rÓ   rJ   r0   rJ   )rÓ   rJ   rÉ   úMapping[str, str]rá   r   r0   r  )rž   r/   rÉ   r0  rá   r   r0   r/   )rÓ   rJ   r,  r   r0   r  )-r6   Ú
__future__r   Ú	itertoolsr   Úcollections.abcr   r   r   Úfnmatchr   r	   Úpathlibr
   Útypingr   r   Ú_distutils_hack.overrideÚ_distutils_hackrk   r   Ú	distutilsr   Údistutils.utilr   Ú
setuptoolsr   ÚchainÚfrom_iterabler§   r   r   r9   rO   ri   rm   ru   r©   r·   r¹   rò   ró   r  r   r/  r7   r   r   Ú<module>r>     s  ðñ%õN #ã Û 	ß 7Ñ 7Ý Ý Ý ß *ã å å Ý 'áÝ'à�_‰_×*Ñ*€
ó1÷
&ñ &÷ -"ñ -"ô`,A�Gô ,Aô^˜-ô ô3�7ô 3ô22TÐ1ô 2Tôj*˜\ô *ó<B÷
añ aóHó$QðØðØ&7ðØCJðàóð0>Ø
ð>Ø-ð>Ø9@ð>àó>ôDNr   