Your IP : 216.73.216.196


Current Path : /opt/alt/python39/lib/python3.9/site-packages/wheel/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib/python3.9/site-packages/wheel/__pycache__/metadata.cpython-39.opt-1.pyc

a

��a��@s\dZddlZddlZddlZddlmZdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�ZdS)z2
Tools for converting old- to new-style metadata.
�N�)�
read_pkg_infocCsRt|dd�rd|jSg}|jD]\}}|�||�q |s@dSdd�t|��S)zFReturn the version specifier for a requirement in PEP 345/566 fashion.�urlNz @ �z (%s)�,)�getattrrZspecs�append�join�sorted)ZrequirementZ
requires_dist�op�ver�r
�?/opt/alt/python39/lib/python3.9/site-packages/wheel/metadata.py�requires_to_requires_dist
s
rccsN|D]D}tj�|�}t|�}d�t|j��}|r8d|}|j||VqdS)z=Yield Requires-Dist: strings for parsed requirements strings.rz[%s]N)�
pkg_resourcesZRequirement�parserr	r
�extrasZproject_name)ZrequirementsZreqZparsed_requirement�specrr
r
r�convert_requirementssrccs�|��D]�\}}d}|pd}d|vr4|�dd�\}}t�|�}|rhd|fV|r\d|d}|d|7}|rtd|}t|�D]}d	||fVq|qd
S)a,
    Convert requirements from a setup()-style dictionary to ('Requires-Dist', 'requirement')
    and ('Provides-Extra', 'extra') tuples.

    extras_require is a dictionary of {extra: [requirements]} as passed to setup(),
    using the empty extra {'': [requirements]} to hold install_requires.
    r�:r�Provides-Extra�(z) and z
extra == '%s'z ; �
Requires-DistN)�items�splitrZ
safe_extrar)Zextras_require�extraZdependsZ	conditionZnew_reqr
r
r�generate_requirements%s

rcCs�t|�}|�dd�|d=|d=tj�|d�}tj�|�r�t|��}|��}Wd�n1s`0Ytt	�
|�dd�d	�}|D]6\}}t||i�D] \}	}
|	|
f|��vr�|
||	<q�q�|d
}|r�|�
t|��|d
=|S)zN
    Convert .egg-info directory with PKG-INFO to the Metadata 2.1 format
    zMetadata-Versionz2.1rrzrequires.txtNcSs|dp
dS)Nrrr
)�xr
r
r�<lambda>P�z%pkginfo_to_metadata.<locals>.<lambda>)�key�Description)rZreplace_header�os�pathr	�exists�open�readr
rZsplit_sectionsrrZset_payload�dedent_description)Z
egg_info_pathZpkginfo_path�pkg_infoZ
requires_pathZ
requires_fileZrequiresZparsed_requirementsrZreqsr �value�descriptionr
r
r�pkginfo_to_metadataAs(
&
�r+cCsV||}|��}t|t�sR|��D].}|d��|kr"|d�dd��d�}qRq"|S)z<Hack to coax Unicode out of an email Message() - Python 3.3+rr�ascii�surrogateescapezutf-8)�lower�
isinstance�strZ	raw_items�encode�decode)r(Zfield�text�itemr
r
r�pkginfo_unicode^s
�r5c
Csr|d}d}t|t�s$d}t|d�}|��}d�|d��t�d�|dd���df�}|rn|�d��	d	d
�}|S)z@
    Dedent and convert pkg_info['Description'] to Unicode.
    r!FT�
rrN�utf8r,r-)
r/r0r5�
splitlinesr	�lstrip�textwrap�dedentr1r2)r(r*Z
surrogatesZdescription_linesZdescription_dedentr
r
rr'ls&


����r')
�__doc__Zos.pathr"r:rZpkginforrrrr+r5r'r
r
r
r�<module>s