a
    SicV4                     @   sv  U d 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
 ddlmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZmZ dd	lmZ erdd
lmZ ddlmZ ei Z ee!d< eej"e#f Z$ee%e#f Z&edee$gdf Z'ee#e'f Z(e)e*Z+de%e$ddddZ,de%e$dddZ-de%e$dddZ.de%dddZ/e#e#dddZ0de#edddZ1d d!d"d#Z2e#ee# d$d%d&Z3de&e$d'd(d)Z4de%e$d'd*d+Z5dee% e$e#d,d-d.Z6de%d/d0d1Z7de%d/d2d3Z8de9d/d4d5Z:de%d/d6d7Z;e%d8d9d:Z<e%de$d;d<d=Z=e feee#ee# f d>d?d@Z>dAeee#ef  dBdCdDZ?e#e#dEdFdGZ@eee#ee# e#f  ee# dHdIdJZAdKdL ZBdMdN ZCe4e5e	e6dOdPe	e6dQdPe7e:e;e8dRZDee#e(f e!dS< dTdUiZEdVdWiZFh dXZGeBdYeBdZeBd[eBd\eCd]d^eBd_eCd`daeCdbdceBddeBdeeBdfeBdgeCdhdieCdjdkdlZHG dmdn dneIZJdS )oak  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.
    N)Mapping)Address)partialreduce)chain)MappingProxyType)
TYPE_CHECKINGAnyCallableDictListOptionalSetTupleTypeUnion)SetuptoolsDeprecationWarningmetadataDistributionEMPTYr   )distconfigfilenamereturnc              	   C   sr   |s| S t j|pd}t| || t| || t  }t | z|   |   W t | nt | 0 | S )z=Apply configuration dict read with :func:`read_configuration`.)	ospathdirname_apply_project_table_apply_tool_tablegetcwdchdir_finalize_requires_finalize_license_files)r   r   r   root_dircurrent_directory r(   b/var/www/html/django/DPS/env/lib/python3.9/site-packages/setuptools/config/_apply_pyprojecttoml.pyapply$   s    

r*   )r   r   r&   c                 C   sv   | di  }|sd S t| | t| | D ]>\}}t|}t ||}t|rd|| || q2t| || q2d S )Nproject)	getcopy_handle_missing_dynamic_unify_entry_pointsitemsjson_compatible_keyPYPROJECT_CORRESPONDENCEcallable_set_config)r   r   r&   project_tablefieldvaluenorm_keyZcorrespr(   r(   r)   r    :   s    
r    )r   r   r   c           	      C   s   | di  di }|sd S | D ]T\}}t|}|tv r`t| }d| d| }t|t t ||}t| || q$t	|| | d S )Ntool
setuptoolszThe parameter `z` is deprecated, )
r,   r0   r1   TOOL_TABLE_DEPRECATIONSwarningswarnr   TOOL_TABLE_RENAMESr4   _copy_command_options)	r   r   r   
tool_tabler6   r7   r8   
suggestionmsgr(   r(   r)   r!   K   s    r!   )r   r5   c                 C   sZ   t |dg }t D ]<\}}||v s||v s|| }|rt||}t|t qdS )zJBe temporarily forgiving with ``dynamic`` fields not listed in ``dynamic``dynamicN)setr,   _PREVIOUSLY_DEFINEDr0   _WouldIgnoreFieldmessager<   r=   )r   r5   rC   r6   getterr7   rB   r(   r(   r)   r.   ^   s    r.   )keyr   c                 C   s   |   ddS )z1As defined in :pep:`566#json-compatible-metadata`-_)lowerreplace)rI   r(   r(   r)   r1   j   s    r1   )r   r6   r7   c                 C   sV   t | jd| d }|r"|| n0t| j|s6|tv rFt| j|| nt| || d S )Nset_)getattrr   hasattrSETUPTOOLS_PATCHESsetattr)r   r6   r7   setterr(   r(   r)   r4   o   s    
r4   ztext/markdownz
text/x-rstz
text/plain)z.mdz.rstz.txt)filer   c                 C   sh   t j|  \}}|sd S |tv r,t| S ddd t D }d| d}td|  d| d S )N, c                 s   s"   | ]\}}| d | dV  qdS )z ()Nr(   .0kvr(   r(   r)   	<genexpr>       z&_guess_content_type.<locals>.<genexpr>z3only the following file extensions are recognized: r   zUndefined content type for )r   r   splitextrL   _CONTENT_TYPESjoinr0   
ValueError)rT   rK   extvalidrB   r(   r(   r)   _guess_content_type   s    rc   )r   valr&   c                 C   sr   ddl m} t|tr,|||}t|}n&|dpH||dg |}|d }t| d| |rnt| d| d S )Nr   expandtextrT   zcontent-typelong_descriptionlong_description_content_type)setuptools.configrf   
isinstancestr
read_filesrc   r,   r4   )r   rd   r&   rf   rg   ctyper(   r(   r)   _long_description   s    

ro   c                 C   sD   ddl m} d|v r0t| d||d g| nt| d|d  d S )Nr   re   rT   licenserg   )rj   rf   r4   rm   )r   rd   r&   rf   r(   r(   r)   _license   s    rq   )r   rd   	_root_dirkindc                 C   s   g }g }|D ]V}d|vr(| |d  qd|vr@| |d  qt|d |d d}| t| q|rzt| |d| |rt| | dd| d S )Nnameemail)display_name	addr_specrU   Z_email)appendr   rl   r4   r_   )r   rd   rr   rs   r6   email_fieldZpersonaddrr(   r(   r)   _people   s    r{   )r   rd   c                 C   s   t | d| d S )Nproject_urls)r4   )r   rd   rr   r(   r(   r)   _project_urls   s    r}   c                 C   s    ddl m} t| d|| d S )Nr   )SpecifierSetpython_requires)Z&setuptools.extern.packaging.specifiersr~   r4   )r   rd   rr   r~   r(   r(   r)   _python_requires   s    r   c                 C   s*   t | dg rd}t| t| d| d S )Ninstall_requireszA`install_requires` overwritten in `pyproject.toml` (dependencies))rO   r<   r=   r4   )r   rd   rr   rB   r(   r(   r)   _dependencies   s    
r   c                 C   s$   t | di }t| di || d S )Nextras_require)rO   r4   )r   rd   rr   existingr(   r(   r)   _optional_dependencies   s    r   )r5   c                 C   s|   | }| d| di }ddd}t| D ].\}}t|}||v r.|r.| |||| < q.|rxdd | D |d< d S )Nentry-pointsentry_pointsconsole_scriptsgui_scripts)scriptsr   c                 S   s$   i | ]\}}|d d |  D qS )c                 S   s   g | ]\}}| d | qS )z = r(   rW   r(   r(   r)   
<listcomp>   r\   z2_unify_entry_points.<locals>.<dictcomp>.<listcomp>r0   )rX   rt   groupr(   r(   r)   
<dictcomp>   s   z'_unify_entry_points.<locals>.<dictcomp>)poplistr0   r1   )r5   r+   r   ZrenamingrI   r7   r8   r(   r(   r)   r/      s    
r/   )	pyprojectr   r   c              	   C   s   |  di }| di  di }t|}|j}|  di  di  D ]x\}}t|}| |t }	||i  | D ]D\}
}t|
}
t||f|| |
< |
|	vrxt	d| d|
 d qxqFd S )Nr9   r:   cmdclass	distutilszCommand option r   z is not defined)
r,   _valid_command_optionscommand_optionsr0   r1   rD   
setdefaultrl   _loggerwarning)r   r   r   r@   r   valid_optionsZcmd_optscmdr   rb   rI   r7   r(   r(   r)   r?      s     r?   )r   r   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 ]2\}}|	|t
 }	|	tt|dg B }	|	||< q\|S )N   r   r   r   globalzdistutils.commands)r   c                 s   s   | ]}t |V  qd S N)_load_eprX   epr(   r(   r)   r[      r\   z)_valid_command_options.<locals>.<genexpr>c                 s   s   | ]}|r|V  qd S r   r(   r   r(   r(   r)   r[      r\   user_options)
_importlibr   setuptools.distr   _normalise_cmd_optionsglobal_optionsr   r   r0   r,   rD   rO   )
r   r   r   r   Zunloaded_entry_pointsZloaded_entry_pointsr   r   	cmd_classoptsr(   r(   r)   r      s    
r   zmetadata.EntryPoint)r   r   c              
   C   sd   z| j |  fW S  ty^ } z6|jj d| j  }t| d|  W Y d }~d S d }~0 0 d S )Nz" while trying to load entry-point z: )rt   load	Exception	__class____name__r   r   )r   exrB   r(   r(   r)   r     s    r   )rt   r   c                 C   s   t | dS )Nz_=)r1   strip)rt   r(   r(   r)   _normalise_cmd_option_key  s    r   )descr   c                 C   s   dd | D S )Nc                 S   s   h | ]}t |d  qS )r   )r   )rX   Zfancy_optionr(   r(   r)   	<setcomp>  r\   z)_normalise_cmd_options.<locals>.<setcomp>r(   )r   r(   r(   r)   r     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   )accxr(   r(   r)   <lambda>  r\   z_attrgetter.<locals>.<lambda>r   )r   r   split)attrr(   r(   r)   _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   rX   iobjr(   r)   r[   /  r\   z5_some_attrgetter.<locals>._acessor.<locals>.<genexpr>c                 s   s   | ]}|d ur|V  qd S r   r(   r   r(   r(   r)   r[   0  r\   )next)r   valuesr   r   r)   _acessor.  s    z"_some_attrgetter.<locals>._acessorr(   )r0   r   r(   r   r)   _some_attrgetter"  s    r   author)rs   
maintainer)readmerp   authorsmaintainersurlsdependenciesoptional_dependenciesZrequires_pythonr2   Zscript_filesr   namespace_packagesz5consider using implicit namespaces instead (PEP 420).>   r|   ri   license_filesprovides_extraslicense_filezmetadata.namezmetadata.versionzmetadata.descriptionzmetadata.long_descriptionr   zmetadata.python_requireszmetadata.licensezmetadata.authorzmetadata.author_emailzmetadata.maintainerzmetadata.maintainer_emailzmetadata.keywordszmetadata.classifierszmetadata.project_urlsr   _orig_install_requiresr   _orig_extras_requirer   )rt   versiondescriptionr   zrequires-pythonrp   r   r   keywordsclassifiersr   r   r   zoptional-dependenciesc                   @   s    e Zd ZdZdZedd ZdS )rF   zGInform users that ``pyproject.toml`` would overwrite previous metadata.a      {field!r} defined outside of `pyproject.toml` would be ignored.
    !!


    ##########################################################################
    # configuration would be ignored/result in error due to `pyproject.toml` #
    ##########################################################################

    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!r} is listed as `dynamic`.

    https://packaging.python.org/en/latest/specifications/declaring-project-metadata/

    For the time being, `setuptools` will still consider the given value (as a
    **transitional** measure), but please note that future releases of setuptools will
    follow strictly the standard.

    To prevent this warning, you can list {field!r} under `dynamic` or alternatively
    remove the `[project]` table from your file and rely entirely on other means of
    configuration.
    

!!
    c                 C   s    ddl m} || jj||dS )Nr   )cleandoc)r6   r7   )inspectr   MESSAGEformat)clsr6   r7   r   r(   r(   r)   rG   v  s    z_WouldIgnoreField.messageN)r   
__module____qualname____doc__r   classmethodrG   r(   r(   r(   r)   rF   Y  s   rF   )Kr   loggingr   r<   collections.abcr   email.headerregistryr   	functoolsr   r   	itertoolsr   typesr   typingr   r	   r
   r   r   r   r   r   r   r   Zsetuptools._deprecation_warningr   Zsetuptools._importlibr   r   r   r   __annotations__PathLikerl   _PathdictZ
_DictOrStrZ
_CorrespFnZ_Correspondence	getLoggerr   r   r*   r    r!   r.   r1   r4   r^   rc   ro   rq   r{   r}   r   r   r   r   r/   r?   r   r   r   r   r   r   r2   r>   r;   rQ   rE   UserWarningrF   r(   r(   r(   r)   <module>   s   	0
	 
&

