Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/wheel/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/wheel/__pycache__/metadata.cpython-37.opt-1.pyc

B

Dt�Zf�@s�dZddlZddlZddlZddlmZddlZddlm	Z	e�
d�Zedd�Zd	d
�Z
dd�Zd
d�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]\}}|�||�qW|s.dSdd�t|��S)zBCompose the version predicates for requirement in PEP 345 fashion.�z (%s)�,)Zspecs�append�join�sorted)ZrequirementZ
requires_dist�opZver�r�?/opt/alt/python37/lib/python3.7/site-packages/wheel/metadata.py�requires_to_requires_distsrccsNxH|D]@}tj�|�}t|�}d�|j�}|r6d|}|j||VqWdS)z=Yield Requires-Dist: strings for parsed requirements strings.r	z[%s]N)�
pkg_resourcesZRequirement�parserr�extrasZproject_name)ZrequirementsZreqZparsed_requirement�specrrrr�convert_requirementss
rccs�x�|��D]�\}}d}|r<d|kr<|�dd�\}}t�|�}|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�splitrZ
safe_extrar)Zextras_requirerZdependsrZnew_reqrrr�generate_requirements*s

rc
	Cs�t|�}|�dd�tj�|d�}tj�|�r�t|��}|��}WdQRXxHtt	�
|�dd�d�D].\}}x$t||i�D]}|d||d	<qxWqbW|d
}	|	r�|�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>M�z%pkginfo_to_metadata.<locals>.<lambda>)�keyrr�Description)rZreplace_header�os�pathr�exists�open�readrrZsplit_sectionsrZset_payload�dedent_description)
Z
egg_info_pathZpkginfo_path�pkg_infoZ
requires_pathZ
requires_fileZrequiresrZreqs�item�descriptionrrr�pkginfo_to_metadataBs
r)cCsj||}|��}t|t�sft|d�s,t|�Sx8|��D],}|d��|kr6|d�dd��d�}Pq6W|S)z<Hack to coax Unicode out of an email Message() - Python 3.3+�	raw_itemsrr�ascii�surrogateescapezutf-8)�lower�
isinstance�str�hasattrr*�encode�decode)r&Zfield�textr'rrr�pkginfo_unicodeYs

r4c
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.
    rFT�
rrN�utf8r+r,)
r.r/r4�
splitlinesr�lstrip�textwrap�dedentr1r2)r&r(Z
surrogatesZdescription_linesZdescription_dedentrrrr%is


r%)�__doc__Zos.pathr �rer9�collectionsrrZpkginfor�compileZEXTRA_RErrrrr)r4r%rrrr�<module>s