Your IP : 216.73.216.213


Current Path : /opt/alt/python38/lib/python3.8/site-packages/wheel/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib/python3.8/site-packages/wheel/__pycache__/metadata.cpython-38.pyc

U

c�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)�,)�getattrr�specs�append�join�sorted)�requirementZ
requires_dist�op�ver�r�?/opt/alt/python38/lib/python3.8/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_resources�Requirement�parserr
r�extras�project_name)�requirements�reqZparsed_requirement�specrrrr�convert_requirementssrccs�|��D]�\}}d}|pd}d|kr4|�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�splitr�
safe_extrar)�extras_require�extra�dependsZ	conditionZnew_reqrrr�generate_requirements%s

r%c	Cs�t|�}|�dd�|d=|d=tj�|d�}tj�|�r�t|��}|��}W5QRXtt	�
|�dd�d�}|D]6\}}t||i�D] \}	}
|	|
f|��kr�|
||	<q�qp|d	}|r�|�
t|��|d	=|S)
zN
    Convert .egg-info directory with PKG-INFO to the Metadata 2.1 format
    zMetadata-Versionz2.1rrzrequires.txtcSs|dp
dS)Nrrr)�xrrr�<lambda>P�z%pkginfo_to_metadata.<locals>.<lambda>)�key�Description)r�replace_header�os�pathr
�exists�open�readrr�split_sectionsr%r�set_payload�dedent_description)Z
egg_info_pathZpkginfo_path�pkg_infoZ
requires_pathZ
requires_file�requiresZparsed_requirementsr#�reqsr)�value�descriptionrrr�pkginfo_to_metadataAs(

�r9cCsV||}|��}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�str�	raw_items�encode�decode)r4�field�text�itemrrr�pkginfo_unicode^s
�rEc
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=r>rE�
splitlinesr
�lstrip�textwrap�dedentr@rA)r4r8Z
surrogatesZdescription_linesZdescription_dedentrrrr3ls(


����r3)
�__doc__�os.pathr,rJrZpkginforrrr%r9rEr3rrrr�<module>s