o
    5‘ðiòK  ã                   @  sò  U d Z ddlm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 ddlmZ ddlmZ dd	lmZ dd
lmZmZmZmZmZ ddlmZ ddlmZ ddlmZmZ ddlm Z  ddl!m"Z"m#Z# er�ddl$m%Z% ddl&m'Z' ddl(m)Z) ddl*m+Z+ ei ƒZ,de-d< ee.e/e.e.f f Z0de-d< edeeedf gdf Z1de-d< edƒZ2e 3e4¡Z5d·d"d#„Z6d¸d%d&„Z7d¹d'd(„Z8dºd*d+„Z9d»d.d/„Z:d¼d3d4„Z;d5d6d7d8œZ<d½d;d<„Z=d¾d?d@„Z>d¿dBdC„Z?dÀdGdH„Z@dÁdIdJ„ZAdÂdKdL„ZBdÃdNdO„ZCdÁdPdQ„ZDdÄdSdT„ZEdÅdVdW„ZFdÆdYdZ„ZGdÇd[d\„ZHdÈd]d^„ZIdÉd`da„ZJe,fdÊddde„ZKdËdidj„ZLdÌdldm„ZMdÍdqdr„ZNdÎdtdu„ZOdÏdwdx„ZPdÏdydz„ZQdÐd}d~„ZRdd€„ ZSd�d‚„ ZTe>e?e
e@dƒd„�e
e@d…d„�eAeCeDeBd†œZUd‡e-dˆ< d‰dŠiZVd‹dŒiZWe
eRd�ƒe
eRdŽƒe
eRd�ƒd�œZXh d‘£ZYd’eEiZZi dkeSd“ƒ“d”eSd•ƒ“d–eSd—ƒ“d˜eSd™ƒ“dšeTd›dœƒ“d�eTdždŸƒ“d eTd¡d¢ƒ“d£eTd¤d¥ƒ“d¦eSd§ƒ“d¨eSd©ƒ“dªeSd«ƒ“d¬eO“dŠeP“d­eQ“d®eSd¯ƒ“d°eSd±ƒ“Z[d²ej\ej\ej\ej\ej]ej]ej]ej]ej\ej]d³œZ^de-d´< G dµd¶„ d¶e#ƒZ_dS )Ñak  Translation layer between pyproject config and setuptools distribution and
metadata objects.

The distribution and metadata objects are modeled after (an old version of)
core metadata, therefore configs in the format specified for ``pyproject.toml``
need to be processed before being applied.

**PRIVATE MODULE**: API reserved for setuptools internal usage only.
é    )ÚannotationsN)ÚMapping)ÚAddress)ÚpartialÚreduce)Úcleandoc)Úchain)ÚMappingProxyType)ÚTYPE_CHECKINGÚAnyÚCallableÚTypeVarÚUnioné   )Ú_static)ÚStrPath)ÚInvalidConfigErrorÚRemovedConfigError)Ú	Extension)ÚSetuptoolsDeprecationWarningÚSetuptoolsWarning)Ú	TypeAlias©Úmetadata©ÚDistribution)Ú_OptionsListr   ÚEMPTYr   Ú_ProjectReadmeValuer   Ú_CorrespondenceÚ_TÚdistÚconfigÚdictÚfilenamer   Úreturnc              	   C  sx   |s| S t j |¡pd}t| ||ƒ t| ||ƒ t  ¡ }t  |¡ z|  ¡  |  ¡  |  	¡  W t  |¡ | S t  |¡ w )z=Apply configuration dict read with :func:`read_configuration`Ú.)
ÚosÚpathÚdirnameÚ_apply_project_tableÚ_apply_tool_tableÚgetcwdÚchdirÚ_finalize_requiresÚ_finalize_license_expressionÚ_finalize_license_files)r!   r"   r$   Úroot_dirÚcurrent_directory© r3   úe/root/parts/websockify/install/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.pyÚapply.   s   


þr5   r1   c           	      C  s„   |  di ¡}|s
d S dd„ | ¡ D ƒ}t| |ƒ t|ƒ | ¡ D ]\}}t|ƒ}t  ||¡}t|ƒr9|| ||ƒ q t| ||ƒ q d S )NÚprojectc                 S  s   i | ]
\}}|t  |¡“qS r3   )r   Úattempt_conversion©Ú.0ÚkÚvr3   r3   r4   Ú
<dictcomp>J   s    z(_apply_project_table.<locals>.<dictcomp>)ÚgetÚitemsÚ_handle_missing_dynamicÚ_unify_entry_pointsÚjson_compatible_keyÚPYPROJECT_CORRESPONDENCEÚcallableÚ_set_config)	r!   r"   r1   Úorig_configÚproject_tableÚfieldÚvalueÚnorm_keyÚcorrespr3   r3   r4   r*   E   s   
úr*   c                 C  sî   |  di ¡  di ¡}|sd S d|v r+d|  di ¡v rtdƒ‚d}tjdd|› �d	d
� | ¡ D ]?\}}t|ƒ}|tv rRtt| ƒ}d|› d�}	td 	t|	ƒ|g¡ƒ‚t
  ||¡}t  ||¡}
t|
ƒrh|
| |ƒ q/t| |
|ƒ q/t|| |ƒ d S )NÚtoolÚ
setuptoolszlicense-filesr6   zS'project.license-files' is defined already. Remove 'tool.setuptools.license-files'.z,guides/writing-pyproject-toml/#license-fileszt'tool.setuptools.license-files' is deprecated in favor of 'project.license-files' (available on setuptools>=77.0.0).ú'https://packaging.python.org/en/latest/©ië  r   é   ©Úsee_urlÚdue_datez,
            The parameter `tool.setuptools.zZ` was long deprecated
            and has been removed from `pyproject.toml`.
            Ú
)r=   r   r   Úemitr>   rA   ÚTOOL_TABLE_REMOVALSr   r   ÚjoinÚTOOL_TABLE_RENAMESÚTOOL_TABLE_CORRESPONDENCErC   rD   Ú_copy_command_options)r!   r"   r$   Ú
tool_tableÚpypa_guidesrG   rH   rI   Ú
suggestionÚmsgrJ   r3   r3   r4   r+   W   s8   ÿüÿr+   rF   c                 C  s^   t | dg ¡ƒ}t ¡ D ] \}}||v s,||v s,|| ƒ}|r,tj||d� t |¡||< qdS )zJBe temporarily forgiving with ``dynamic`` fields not listed in ``dynamic``Údynamic©rG   rH   N)Úsetr=   Ú_PREVIOUSLY_DEFINEDr>   Ú_MissingDynamicrT   Ú_RESET_PREVIOUSLY_DEFINED)r!   rF   r^   rG   ÚgetterrH   r3   r3   r4   r?   �   s   €ûr?   ÚkeyÚstrc                 C  s   |   ¡  dd¡S )z1As defined in :pep:`566#json-compatible-metadata`ú-Ú_)ÚlowerÚreplace)re   r3   r3   r4   rA   Œ   ó   rA   rG   rH   r   c                 C  sl   t  |t¡| |ƒ}t| jd|› �d ƒ}|r||ƒ d S t| j|ƒs%|tv r.t| j||ƒ d S t| ||ƒ d S )NÚset_)Ú_PREPROCESSr=   Ú_noopÚgetattrr   ÚhasattrÚSETUPTOOLS_PATCHESÚsetattr)r!   rG   rH   ÚvalÚsetterr3   r3   r4   rD   ‘   s   rD   ztext/markdownz
text/x-rstz
text/plain)z.mdz.rstz.txtÚfileú
str | Nonec                 C  sj   t j |  ¡ ¡\}}|sd S |tv rt t| ¡S d dd„ t ¡ D ƒ¡}d|› d�}t	d| › d|› �ƒ‚)Nú, c                 s  s$   � | ]\}}|› d |› d�V  qdS )z (ú)Nr3   r8   r3   r3   r4   Ú	<genexpr>«   s   €" z&_guess_content_type.<locals>.<genexpr>z3only the following file extensions are recognized: r&   zUndefined content type for )
r'   r(   Úsplitextri   Ú_CONTENT_TYPESr   ÚStrrV   r>   Ú
ValueError)ru   rh   ÚextÚvalidr]   r3   r3   r4   Ú_guess_content_type£   s   r€   rs   úStrPath | Nonec                 C  sœ   ddl m} t|tƒr|}| ||¡}t|ƒ}n| d¡pd}| d¡p)| ||¡}|d }t| dt 	|¡ƒ |rBt| dt 	|¡ƒ |rL| j
 |¡ d S d S )	Nr   ©Úexpandru   r3   Útextzcontent-typeÚlong_descriptionÚlong_description_content_type)Úsetuptools.configrƒ   Ú
isinstancerf   Ú
read_filesr€   r=   rD   r   r|   Ú_referenced_filesÚadd)r!   rs   r1   rƒ   ru   r„   Úctyper3   r3   r4   Ú_long_description°   s   

ÿr�   ú
str | dictc                 C  sÂ   ddl m} t|tƒr&t| jdd ƒrt d¡ d | j_t	| dt
 |¡ƒ d S d}tjddd	|› �d
d� d|v rT| |d g|¡}t	| dt
 |¡ƒ | j |d ¡ d S t	| dt
 |d ¡ƒ d S )Nr   r‚   Úlicensez)`license` overwritten by `pyproject.toml`Úlicense_expressionz&guides/writing-pyproject-toml/#licensez/`project.license` as a TOML table is deprecatedz¨Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`. (Both options available on setuptools>=77.0.0).rM   rN   rP   ru   r„   )r‡   rƒ   rˆ   rf   ro   r   r   rT   r�   rD   r   r|   r   r‰   rŠ   r‹   )r!   rs   r1   rƒ   r[   rH   r3   r3   r4   Ú_licenseÉ   s$   

úr‘   ú
list[dict]Ú	_root_dirÚkindc                 C  sª   g }g }|D ]+}d|vr|  |d ¡ qd|vr |  |d ¡ qt|d |d d�}|  t|ƒ¡ q|r@t| |t d |¡¡ƒ |rSt| |› d�t d |¡¡ƒ d S d S )NÚnameÚemail)Údisplay_nameÚ	addr_specrw   Ú_email)Úappendr   rf   rD   r   r|   rV   )r!   rs   r“   r”   rG   Úemail_fieldÚpersonÚaddrr3   r3   r4   Ú_peopleä   s   "ÿrž   c                 C  s   t | d|ƒ d S )NÚproject_urls)rD   ©r!   rs   r“   r3   r3   r4   Ú_project_urlsö   s   r¡   c                 C  s   t | dt |¡ƒ d S )NÚpython_requires)rD   r   ÚSpecifierSetr    r3   r3   r4   Ú_python_requiresú   s   r¤   Úlistc                 C  s$   t | dg ƒrd}t |¡ || _d S )NÚinstall_requireszA`install_requires` overwritten in `pyproject.toml` (dependencies))ro   r   rT   r¦   ©r!   rs   r“   r]   r3   r3   r4   Ú_dependenciesþ   ó   

r¨   c                 C  s$   t | dd ƒrd}t |¡ || _d S )NÚextras_requirezH`extras_require` overwritten in `pyproject.toml` (optional-dependencies))ro   r   rT   rª   r§   r3   r3   r4   Ú_optional_dependencies  r©   r«   úlist[Extension]c                 C  s2   | j pg }dd„ |D ƒ}dd„ |D ƒ}g |¢|¢S )Nc                 s  s"   � | ]}d d„ |  ¡ D ƒV  qdS )c                 S  s   i | ]\}}|  d d¡|“qS )rg   rh   )rj   r8   r3   r3   r4   r<     ó    z*_ext_modules.<locals>.<genexpr>.<dictcomp>N©r>   )r9   Úxr3   r3   r4   ry     ó   €  z_ext_modules.<locals>.<genexpr>c                 s  s"   � | ]}t di t|ƒ¤ŽV  qd S )Nr3   )r   Ú_adjust_ext_attrs)r9   Úkwr3   r3   r4   ry     r°   )Úext_modules)r!   rs   ÚexistingÚargsÚnewr3   r3   r4   Ú_ext_modules  s   
r·   Úattrsc                 C  s    t tt|  d¡p	g ƒƒ| d< | S )NÚdefine_macros)r¥   ÚmapÚtupler=   )r¸   r3   r3   r4   r±     s   r±   Ú_distc                 C  s   |S ©Nr3   )r¼   rs   r3   r3   r4   rn     ó   rn   c                 C  s   | S r½   r3   )rs   r3   r3   r4   Ú	_identity  r¾   r¿   c                 C  s„   | }|  d|  di ¡¡}t|ƒ}dddœ}t| ¡ ƒD ]\}}t|ƒ}||v r0|  |¡||| < q|r@dd„ | ¡ D ƒ|d< d S d S )Núentry-pointsÚentry_pointsÚconsole_scriptsÚgui_scripts)ÚscriptsrÃ   c                 S  s(   i | ]\}}|r|d d„ |  ¡ D ƒ“qS )c                 S  s   g | ]\}}|› d |› �‘qS )z = r3   r8   r3   r3   r4   Ú
<listcomp>0  r­   z2_unify_entry_points.<locals>.<dictcomp>.<listcomp>r®   )r9   r•   Úgroupr3   r3   r4   r<   /  s    ýÿz'_unify_entry_points.<locals>.<dictcomp>)Úpopr#   r¥   r>   rA   )rF   r6   ÚgivenrÁ   Úrenamingre   rH   rI   r3   r3   r4   r@   #  s   
€þÿr@   Ú	pyprojectc              	   C  sÄ   |   di ¡}|  di ¡  di ¡}t|ƒ}|j}|   di ¡  di ¡ ¡ D ]<\}}t|ƒ}|  |tƒ ¡}	| |i ¡ | ¡ D ]"\}
}t|
ƒ}
t|ƒ|f|| |
< |
|	vr^t 	d|› d|
› d�¡ q<q#d S )NrK   rL   ÚcmdclassÚ	distutilszCommand option r&   z is not defined)
r=   Ú_valid_command_optionsÚcommand_optionsr>   rA   r`   Ú
setdefaultrf   Ú_loggerÚwarning)rÊ   r!   r$   rZ   rË   Úvalid_optionsÚcmd_optsÚcmdr"   r   re   rH   r3   r3   r4   rY   8  s     €úürY   rË   údict[str, set[str]]c           
      C  s”   ddl m} ddlm} dt|jƒi}|jdd�}dd	„ |D ƒ}d
d	„ |D ƒ}t||  ¡ ƒD ]\}}| 	|t
ƒ ¡}	|	tt|dg ƒƒB }	|	||< q.|S )Nr   r   r   r   Úglobalzdistutils.commands)rÆ   c                 s  s   � | ]}t |ƒV  qd S r½   )Ú_load_ep©r9   Úepr3   r3   r4   ry   S  ó   € z)_valid_command_options.<locals>.<genexpr>c                 s  s   � | ]}|r|V  qd S r½   r3   rØ   r3   r3   r4   ry   T  rÚ   Úuser_options)Úsetuptools.distr   Ú
_importlibr   Ú_normalise_cmd_optionsÚglobal_optionsrÁ   r   r>   r=   r`   ro   )
rË   r   r   rÒ   Úunloaded_entry_pointsÚloaded_entry_pointsrÁ   rÔ   Ú	cmd_classÚoptsr3   r3   r4   rÍ   K  s   
rÍ   rÙ   úmetadata.EntryPointútuple[str, type] | Nonec              
   C  sp   | j  d¡rd S z| j|  ¡ fW S  ty7 } z|jj› d| j› �}t |› d|› �¡ W Y d }~d S d }~ww )Nzwheel.bdist_wheelz" while trying to load entry-point z: )	rH   Ú
startswithr•   ÚloadÚ	ExceptionÚ	__class__Ú__name__rÐ   rÑ   )rÙ   Úexr]   r3   r3   r4   r×   ]  s   €ýr×   r•   c                 C  s   t | ƒ d¡S )Nz_=)rA   Ústrip)r•   r3   r3   r4   Ú_normalise_cmd_option_keyl  ó   rí   Údescr   úset[str]c                 C  s   dd„ | D ƒS )Nc                 S  s   h | ]}t |d  ƒ’qS )r   )rí   )r9   Úfancy_optionr3   r3   r4   Ú	<setcomp>q  s    z)_normalise_cmd_options.<locals>.<setcomp>r3   )rï   r3   r3   r4   rÞ   p  rî   rÞ   údict[str, list]c                   s*   d‰ t | dd ƒp	i }‡ fdd„| ¡ D ƒS )N)rÂ   rÃ   rÁ   c                   s   i | ]\}}|ˆ vr||“qS r3   r3   r8   ©Úignorer3   r4   r<   w  r­   z-_get_previous_entrypoints.<locals>.<dictcomp>)ro   r>   ©r!   rH   r3   rô   r4   Ú_get_previous_entrypointst  s   r÷   úlist | Nonec                 C  ó   t | dd ƒpi }| d¡S )NrÁ   rÂ   ©ro   r=   rö   r3   r3   r4   Ú_get_previous_scriptsz  ó   
rû   c                 C  rù   )NrÁ   rÃ   rú   rö   r3   r3   r4   Ú_get_previous_gui_scripts  rü   rý   ÚattrÚNonec                 C  sH   |j }t|d| › �ƒt|d| › �ƒ}}||ƒ t|| t |ƒ ¡ƒ dS )zCApply distutils metadata validation but preserve "static" behaviourrl   Úget_N)r   ro   rr   r   ÚList)rþ   r!   rs   Úmetart   rd   r3   r3   r4   Ú_set_static_list_metadata„  s   "r  c                 C  s   t tdd„ |  d¡ƒS )a8  
    Similar to ``operator.attrgetter`` but returns None if ``attr`` is not found
    >>> from types import SimpleNamespace
    >>> obj = SimpleNamespace(a=42, b=SimpleNamespace(c=13))
    >>> _attrgetter("a")(obj)
    42
    >>> _attrgetter("b.c")(obj)
    13
    >>> _attrgetter("d")(obj) is None
    True
    c                 S  s   t | |d ƒS r½   )ro   )Úaccr¯   r3   r3   r4   Ú<lambda>˜  s    z_attrgetter.<locals>.<lambda>r&   )r   r   Úsplit)rþ   r3   r3   r4   Ú_attrgetterŒ  s   r  c                    s   ‡ fdd„}|S )aL  
    Return the first "truth-y" attribute or None
    >>> from types import SimpleNamespace
    >>> obj = SimpleNamespace(a=42, b=SimpleNamespace(c=13))
    >>> _some_attrgetter("d", "a", "b.c")(obj)
    42
    >>> _some_attrgetter("d", "e", "b.c", "a")(obj)
    13
    >>> _some_attrgetter("d", "e", "f")(obj) is None
    True
    c                   s&   ‡ fdd„ˆD ƒ}t dd„ |D ƒd ƒS )Nc                 3  s   � | ]	}t |ƒˆ ƒV  qd S r½   )r  ©r9   Úi©Úobjr3   r4   ry   ©  ó   € z5_some_attrgetter.<locals>._acessor.<locals>.<genexpr>c                 s  s   � | ]	}|d ur|V  qd S r½   r3   r  r3   r3   r4   ry   ª  r  )Únext)r  Úvaluesr®   r
  r4   Ú_acessor¨  s   z"_some_attrgetter.<locals>._acessorr3   )r>   r  r3   r®   r4   Ú_some_attrgetter›  s   r  Úauthor)r”   Ú
maintainer)Úreadmer�   ÚauthorsÚmaintainersÚurlsÚdependenciesÚoptional_dependenciesÚrequires_pythonzdict[str, _Correspondence]rB   Úscript_filesrÄ   Únamespace_packagesz 
        Please migrate to implicit native namespaces instead.
        See https://packaging.python.org/en/latest/guides/packaging-namespace-packages/.
        Ú	obsoletesÚprovidesÚ	platforms)r  r  r  >   Úlicense_filerŸ   Úlicense_filesÚprovides_extrasr�   r†   r³   zmetadata.nameÚversionzmetadata.versionÚdescriptionzmetadata.descriptionr  zmetadata.long_descriptionzrequires-pythonr¢   zmetadata.python_requiresr�   zmetadata.license_expressionzmetadata.licenser  zmetadata.authorzmetadata.author_emailr  zmetadata.maintainerzmetadata.maintainer_emailÚkeywordszmetadata.keywordsÚclassifierszmetadata.classifiersr  zmetadata.project_urlsrÀ   úgui-scriptsr  r¦   úoptional-dependenciesrª   Ú )r�   r  r  r$  r%  r  rÀ   rÄ   r&  r  r'  rc   c                   @  s"   e Zd ZdZdZeddd	„ƒZd
S )rb   z9`{field}` defined outside of `pyproject.toml` is ignored.a%  
    The following seems to be defined outside of `pyproject.toml`:

    `{field} = {value!r}`

    According to the spec (see the link below), however, setuptools CANNOT
    consider this value unless `{field}` is listed as `dynamic`.

    https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table

    To prevent this problem, you can list `{field}` under `dynamic` or alternatively
    remove the `[project]` table from your file and rely entirely on other means of
    configuration.
    rG   rf   rH   r   r%   c                 C  s   | j j||d�S )Nr_   )Ú_DETAILSÚformat)ÚclsrG   rH   r3   r3   r4   Údetails  rk   z_MissingDynamic.detailsN)rG   rf   rH   r   r%   rf   )rê   Ú
__module__Ú__qualname__Ú_SUMMARYr)  Úclassmethodr,  r3   r3   r3   r4   rb   ÿ  s
    rb   )r!   r   r"   r#   r$   r   r%   r   )r!   r   r"   r#   r1   r   )r!   r   r"   r#   r$   r   )r!   r   rF   r#   )re   rf   r%   rf   )r!   r   rG   rf   rH   r   )ru   rf   r%   rv   )r!   r   rs   r   r1   r�   )r!   r   rs   rŽ   r1   r�   )r!   r   rs   r’   r“   r�   r”   rf   )r!   r   rs   r#   r“   r�   )r!   r   rs   rf   r“   r�   )r!   r   rs   r¥   r“   r�   )r!   r   rs   r’   r%   r¬   )r¸   r#   r%   r#   )r¼   r   rs   r    r%   r    )rs   r    r%   r    )rF   r#   )rÊ   r#   r!   r   r$   r   )rË   r   r%   rÕ   )rÙ   rä   r%   rå   )r•   rf   r%   rf   )rï   r   r%   rð   )r!   r   r%   ró   )r!   r   r%   rø   )rþ   rf   r!   r   rs   r¥   r%   rÿ   )`Ú__doc__Ú
__future__r   Úloggingr'   Úcollections.abcr   Úemail.headerregistryr   Ú	functoolsr   r   Úinspectr   Ú	itertoolsr   Útypesr	   Útypingr
   r   r   r   r   r(  r   Ú_pathr   Úerrorsr   r   Ú	extensionr   Úwarningsr   r   Útyping_extensionsr   Úsetuptools._importlibr   rÜ   r   Údistutils.distr   r   Ú__annotations__rf   r#   r   r   r    Ú	getLoggerrê   rÐ   r5   r*   r+   r?   rA   rD   r{   r€   r�   r‘   rž   r¡   r¤   r¨   r«   r·   r±   rn   r¿   r@   rY   rÍ   r×   rí   rÞ   r÷   rû   rý   r  r  r  rB   rW   rU   rX   rq   rm   ra   Ú
EMPTY_LISTÚ
EMPTY_DICTrc   rb   r3   r3   r3   r4   Ú<module>   sú    
"




*

ý






















øÿü
ÿÿþýü
û
ú
	÷

öõôóòñðïîð