Your IP : 216.73.216.213


Current Path : /opt/alt/python36/lib/python3.6/site-packages/wheel/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib/python3.6/site-packages/wheel/__pycache__/metadata.cpython-36.pyc

3

Dt�Zf�@s�dZddlZddlZddlZddlmZddlZddlm	Z	ej
d�Zedd�Zd
d�Z
dd
�Zdd�Zdd�Zdd�Zdd�ZdS)z2
Tools for converting old- to new-style metadata.
�N)�
namedtuple�)�
read_pkg_infozF^(?P<package>.*?)(;\s*(?P<condition>.*?)(extra == '(?P<extra>.*?)')?)$�MayRequiresKey�	condition�extracCs@g}x |jD]\}}|j||�qW|s.dSddjt|��S)zBCompose the version predicates for requirement in PEP 345 fashion.�z (%s)�,)�specs�append�join�sorted)�requirementZ
requires_dist�op�ver�r�?/opt/alt/python36/lib/python3.6/site-packages/wheel/metadata.py�requires_to_requires_distsrccsNxH|D]@}tjj|�}t|�}dj|j�}|r6d|}|j||VqWdS)z=Yield Requires-Dist: strings for parsed requirements strings.r	z[%s]N)�
pkg_resources�Requirement�parserr�extras�project_name)�requirements�reqZparsed_requirement�specrrrr�convert_requirementss
rccs�x�|j�D]�\}}d}|r<d|kr<|jdd�\}}tj|�}|rfd|fV|rZd|d}|d|7}|rrd|}xt|�D]}d	||fVq|Wq
Wd
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�:rzProvides-Extra�(z) and z
extra == '%s'z; z
Requires-DistN)�items�splitr�
safe_extrar)�extras_requirer�dependsrZnew_reqrrr�generate_requirements*s

r$c

Cs�t|�}|jdd�tjj|d�}tjj|�r�t|��}|j�}WdQRXxHtt	j
|�dd�d�D].\}}x$t||i�D]}|d||d	<qxWqbW|d
}	|	r�|jt
|��|d
=|S)zN
    Convert .egg-info directory with PKG-INFO to the Metadata 2.1 format
    zMetadata-Versionz2.1zrequires.txtNcSs|dp
dS)Nrrr)�xrrr�<lambda>Msz%pkginfo_to_metadata.<locals>.<lambda>)�keyrr�Description)rZreplace_header�os�pathr�exists�open�readr
r�split_sectionsr$�set_payload�dedent_description)
Z
egg_info_pathZpkginfo_path�pkg_infoZ
requires_pathZ
requires_file�requiresr�reqs�item�descriptionrrr�pkginfo_to_metadataBs
r6cCsj||}|j�}t|t�sft|d�s,t|�Sx8|j�D],}|dj�|kr6|djdd�jd�}Pq6W|S)z<Hack to coax Unicode out of an email Message() - Python 3.3+�	raw_itemsrr�ascii�surrogateescapezutf-8)�lower�
isinstance�str�hasattrr7�encode�decode)r1�field�textr4rrr�pkginfo_unicodeYs

rBcCsr|d}d}t|t�s$d}t|d�}|j�}dj|dj�tjdj|dd���df�}|rn|jd�j	d	d
�}|S)z@
    Dedent and convert pkg_info['Description'] to Unicode.
    r(FT�
rrN�utf8r8r9)
r;r<rB�
splitlinesr�lstrip�textwrap�dedentr>r?)r1r5Z
surrogatesZdescription_linesZdescription_dedentrrrr0is


r0)rr)�__doc__�os.pathr)�rerG�collectionsrrZpkginfor�compileZEXTRA_RErrrr$r6rBr0rrrr�<module>s