o
    5‘ði1%  ã                	   @  s´  d Z ddlmZ ddlZddlZddlZddlmZ ddlm	Z	 ddl
mZmZmZ ej ej ej ej e¡¡dd¡ Zejveg ¡ ej d	d¡ ddlZd
dlmZmZ d
dlmZ d
dlmZmZ d
dl m!Z! d
dl"m#Z# d
dl$m%Z% d
dl&m'Z' ddl(Z)g d¢Z*eddd�Z+dZ,ej-Z.ej-Z/dd„ Z0d(dd„Z1d)dd„Z2e)j3j2j e2_ er²ddl(m4Z5 ne 6e)j3j4¡Z5G d d!„ d!e5ƒZ4d"d#„ Z7ej8fd$d%„Z9G d&d'„ d'e:ƒZ;e <¡  dS )*z@Extensions to the 'distutils' for large or complex distributionsé    )ÚannotationsN)Úabstractmethod)ÚMapping)ÚTYPE_CHECKINGÚTypeVarÚoverloadÚ
setuptoolsÚ_vendorÚ	backportsé   )ÚloggingÚmonkey)ÚRequire)ÚPackageFinderÚPEP420PackageFinder)ÚDistribution)Ú	Extension)Ú__version__)ÚSetuptoolsDeprecationWarning)Úsetupr   ÚCommandr   r   r   Úfind_packagesÚfind_namespace_packagesÚ	_CommandTÚ_Command)Úboundc                 C  s>   G dd„ dt jjƒ}|| ƒ}|jdd� |jrt|ƒ d S d S )Nc                      s8   e Zd ZdZd‡ fdd„Zd‡ fd	d
„	Zdd„ Z‡  ZS )z4_install_setup_requires.<locals>.MinimalDistributionzl
        A minimal version of a distribution for supporting the
        fetch_build_eggs interface.
        ÚattrsúMapping[str, object]ÚreturnÚNonec                   s<   d}‡ fdd„t |ƒt ˆ ƒ@ D ƒ}tƒ  |¡ | j ¡  d S )N)Údependency_linksÚsetup_requiresc                   s   i | ]}|ˆ | “qS © r"   )Ú.0Úk©r   r"   úR/root/parts/websockify/install/lib/python3.10/site-packages/setuptools/__init__.pyÚ
<dictcomp>?   s    zQ_install_setup_requires.<locals>.MinimalDistribution.__init__.<locals>.<dictcomp>)ÚsetÚsuperÚ__init__Úset_defaultsÚ_disable)Úselfr   Ú_inclÚfiltered©Ú	__class__r%   r&   r*   =   s   z=_install_setup_requires.<locals>.MinimalDistribution.__init__Nc                   s6   zt ƒ  |¡\}}W |dfS  ty   |df Y S w )zAIgnore ``pyproject.toml``, they are not related to setup_requiresr"   )r)   Ú _split_standard_project_metadataÚ	Exception)r-   Ú	filenamesÚcfgÚ_tomlr0   r"   r&   Ú_get_project_config_filesD   s   þÿzN_install_setup_requires.<locals>.MinimalDistribution._get_project_config_filesc                 S  s   dS )zl
            Disable finalize_options to avoid building the working set.
            Ref #2158.
            Nr"   ©r-   r"   r"   r&   Úfinalize_optionsL   s    zE_install_setup_requires.<locals>.MinimalDistribution.finalize_options)r   r   r   r   ©N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r*   r7   r9   Ú__classcell__r"   r"   r0   r&   ÚMinimalDistribution7   s
    r@   T)Úignore_option_errors)Ú	distutilsÚcorer   Úparse_config_filesr!   Ú_fetch_build_eggs)r   r@   Údistr"   r"   r&   Ú_install_setup_requires4   s   ÿrG   rF   r   c              
   C  sf   z	|   | j¡ W d S  ty2 } zd}d|jjv r-t|dƒr$| |¡ ‚ |  d|› d�¡ ‚ d }~ww )Na–  
        It is possible a package already installed in your system
        contains an version that is invalid according to PEP 440.
        You can try `pip install --use-pep517` as a workaround for this problem,
        or rely on a new virtual environment.

        If the problem refers to a package that is not installed yet,
        please contact that package's maintainers or distributors.
        ÚInvalidVersionÚadd_noteÚ
)Úfetch_build_eggsr!   r3   r1   r;   ÚhasattrrI   Úannounce)rF   ÚexÚmsgr"   r"   r&   rE   Z   s   	

ÿ€ñrE   r   c                  K  s"   t  ¡  t| ƒ tjjdi | ¤ŽS )Nr"   )r   Ú	configurerG   rB   rC   r   r%   r"   r"   r&   r   o   s   r   )r   c                      s’   e Zd ZU dZdZded< dZ	 d‡ fdd	„Ze	dddd„ƒZ	e	dddd„ƒZ		dddd„Z	e
d dd„ƒZe
d dd„ƒZe
d dd„ƒZ‡  ZS )!r   a#  
    Setuptools internal actions are organized using a *command design pattern*.
    This means that each action (or group of closely related actions) executed during
    the build should be implemented as a ``Command`` subclass.

    These commands are abstractions and do not necessarily correspond to a command that
    can (or should) be executed via a terminal, in a CLI fashion (although historically
    they would).

    When creating a new command from scratch, custom defined classes **SHOULD** inherit
    from ``setuptools.Command`` and implement a few mandatory methods.
    Between these mandatory methods, are listed:
    :meth:`initialize_options`, :meth:`finalize_options` and :meth:`run`.

    A useful analogy for command classes is to think of them as subroutines with local
    variables called "options".  The options are "declared" in :meth:`initialize_options`
    and "defined" (given their final values, aka "finalized") in :meth:`finalize_options`,
    both of which must be defined by every command class. The "body" of the subroutine,
    (where it does all the work) is the :meth:`run` method.
    Between :meth:`initialize_options` and :meth:`finalize_options`, ``setuptools`` may set
    the values for options/attributes based on user's input (or circumstance),
    which means that the implementation should be careful to not overwrite values in
    :meth:`finalize_options` unless necessary.

    Please note that other commands (or other parts of setuptools) may also overwrite
    the values of the command's options/attributes multiple times during the build
    process.
    Therefore it is important to consistently implement :meth:`initialize_options` and
    :meth:`finalize_options`. For example, all derived attributes (or attributes that
    depend on the value of other attributes) **SHOULD** be recomputed in
    :meth:`finalize_options`.

    When overwriting existing commands, custom defined classes **MUST** abide by the
    same APIs implemented by the original class. They also **SHOULD** inherit from the
    original class.
    Fr   ÚdistributionrF   r   r   c                   s   t ƒ  |¡ t| ƒ |¡ dS )zj
        Construct the command for dist, updating
        vars(self) with any keyword parameters.
        N)r)   r*   ÚvarsÚupdate)r-   rF   Úkwr0   r"   r&   r*   °   s   zCommand.__init__ÚcommandÚstrÚreinit_subcommandsÚboolc                 K  ó   d S r:   r"   ©r-   rU   rW   rT   r"   r"   r&   Úreinitialize_command¸   ó   zCommand.reinitialize_commandr   c                 K  rY   r:   r"   rZ   r"   r"   r&   r[   ¼   r\   ústr | _CommandúCommand | _Commandc                 K  s    t  | ||¡}t|ƒ |¡ |S r:   )r   r[   rR   rS   )r-   rU   rW   rT   Úcmdr"   r"   r&   r[   À   s   c                 C  ó   t ‚)z·
        Set or (reset) all options/attributes/caches used by the command
        to their default values. Note that these values may be overwritten during
        the build.
        ©ÚNotImplementedErrorr8   r"   r"   r&   Úinitialize_optionsÇ   ó   zCommand.initialize_optionsc                 C  r`   )z÷
        Set final values for all options/attributes used by the command.
        Most of the time, each option/attribute/cache should only be set if it does not
        have any value yet (e.g. ``if self.attr is None: self.attr = val``).
        ra   r8   r"   r"   r&   r9   Ð   rd   zCommand.finalize_optionsc                 C  r`   )zÙ
        Execute the actions intended by the command.
        (Side effects **SHOULD** only take place when :meth:`run` is executed,
        for example, creating new files or writing to the terminal output).
        ra   r8   r"   r"   r&   ÚrunÙ   rd   zCommand.run)rF   r   r   r   )F)rU   rV   rW   rX   r   r   )rU   r   rW   rX   r   r   )rU   r]   rW   rX   r   r^   )r   r   )r;   r<   r=   r>   Úcommand_consumes_argumentsÚ__annotations__Údry_runr*   r   r[   r   rc   r9   re   r?   r"   r"   r0   r&   r   �   s*   
 %ÿÿÿr   c                 C  s&   dd„ t j| dd�D ƒ}tt jj|ƒS )z%
    Find all files under 'path'
    c                 s  s.   � | ]\}}}|D ]
}t j ||¡V  q	qd S r:   )ÚosÚpathÚjoin)r#   ÚbaseÚdirsÚfilesÚfiler"   r"   r&   Ú	<genexpr>ç   s   € ýþÿz#_find_all_simple.<locals>.<genexpr>T)Úfollowlinks)ri   ÚwalkÚfilterrj   Úisfile)rj   Úresultsr"   r"   r&   Ú_find_all_simpleã   s   þrv   c                 C  s6   t | ƒ}| tjkrtjtjj| d�}t||ƒ}t|ƒS )zŒ
    Find all files under 'dir' and return the list of full filenames.
    Unless dir is '.', return full filenames with dir prepended.
    )Ústart)	rv   ri   ÚcurdirÚ	functoolsÚpartialrj   ÚrelpathÚmapÚlist)Údirrn   Úmake_relr"   r"   r&   Úfindallï   s
   

r€   c                   @  s   e Zd ZdZdS )Úsicz;Treat this string as-is (https://en.wikipedia.org/wiki/Sic)N)r;   r<   r=   r>   r"   r"   r"   r&   r�   û   s    r�   )rF   r   )r   r   )=r>   Ú
__future__r   ry   ri   ÚsysÚabcr   Úcollections.abcr   Útypingr   r   r   rj   Úextendrk   ÚdirnameÚ__file__Úvendor_pathÚmodulesÚpopÚ_distutils_hack.overrideÚ_distutils_hackÚ r   r   Údependsr   Ú	discoveryr   r   rF   r   Ú	extensionr   Úversionr   Úwarningsr   Údistutils.corerB   Ú__all__r   Úbootstrap_install_fromÚfindr   r   rG   rE   r   rC   r   r   Úget_unpatchedrv   rx   r€   rV   r�   Ú	patch_allr"   r"   r"   r&   Ú<module>   sH    8
&
	b