Your IP : 216.73.217.17


Current Path : /lib/python2.7/site-packages/wheel/
Upload File :
Current File : //lib/python2.7/site-packages/wheel/metadata.pyc

�
���]c@s�dZddlZddlZddlZddlZddlmZejd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�ZdS(s2
Tools for converting old- to new-style metadata.
i����Ni(t
read_pkg_infosF^(?P<package>.*?)(;\s*(?P<condition>.*?)(extra == '(?P<extra>.*?)')?)$cCsot|dd�rd|jSg}x(|jD]\}}|j||�q-W|sXdSddjt|��S(sFReturn the version specifier for a requirement in PEP 345/566 fashion.turls @ ts (%s)t,N(tgetattrtNoneRtspecstappendtjointsorted(trequirementt
requires_disttoptver((s//tmp/pip-install-NwWfNs/wheel/wheel/metadata.pytrequires_to_requires_distsccsnxg|D]_}tjj|�}t|�}djt|j��}|rVd|}n|j||VqWdS(s=Yield Requires-Dist: strings for parsed requirements strings.Rs[%s]N(t
pkg_resourcestRequirementtparseRRR	textrastproject_name(trequirementstreqtparsed_requirementtspecR((s//tmp/pip-install-NwWfNs/wheel/wheel/metadata.pytconvert_requirements s

ccs�x�|j�D]�\}}d}|p(d}d|krR|jdd�\}}ntj|�}|r�d|fV|r�d|d}n|d|7}n|r�d|}nx#t|�D]}d	||fVq�Wq
Wd
S(s,
    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.
    Rt:isProvides-Extrat(s) and s
extra == '%s's ; s
Requires-DistN(titemstsplitRt
safe_extraR(textras_requiretextratdependst	conditiontnew_req((s//tmp/pip-install-NwWfNs/wheel/wheel/metadata.pytgenerate_requirements+s
cCs$t|�}|jdd�|d=|d=tjj|d�}tjj|�r�t|��}|j�}WdQXtt	j
|�dd��}x`|D]U\}}xFti||6�D]1\}	}
|	|
f|j�kr�|
||	<q�q�Wq�Wn|d	}|r |j
t|��|d	=n|S(
sN
    Convert .egg-info directory with PKG-INFO to the Metadata 2.1 format
    sMetadata-Versions2.1sProvides-Extras
Requires-Distsrequires.txtNtkeycSs|dp
dS(NiR((tx((s//tmp/pip-install-NwWfNs/wheel/wheel/metadata.pyt<lambda>VstDescription(Rtreplace_headertostpathRtexiststopentreadR	Rtsplit_sectionsR#Rtset_payloadtdedent_description(t
egg_info_pathtpkginfo_pathtpkg_infot
requires_patht
requires_filetrequirestparsed_requirementsRtreqsR$tvaluetdescription((s//tmp/pip-install-NwWfNs/wheel/wheel/metadata.pytpkginfo_to_metadataGs& 

cCs�||}|j�}t|t�s�t|d�s>t|�SxP|j�D]?}|dj�|krK|djdd�jd�}PqKqKWn|S(s<Hack to coax Unicode out of an email Message() - Python 3.3+t	raw_itemsiitasciitsurrogateescapesutf-8(tlowert
isinstancetstrthasattrR<tencodetdecode(R3tfieldttexttitem((s//tmp/pip-install-NwWfNs/wheel/wheel/metadata.pytpkginfo_unicodeds

	cCs�|d}t}t|t�s7t}t|d�}n|j�}dj|dj�tj	dj|d��df�}|r�|j
d�jdd�}n|S(s@
    Dedent and convert pkg_info['Description'] to Unicode.
    R's
iitutf8R=R>(tFalseR@RAtTrueRHt
splitlinesRtlstripttextwraptdedentRCRD(R3R:t
surrogatestdescription_linestdescription_dedent((s//tmp/pip-install-NwWfNs/wheel/wheel/metadata.pyR0ts

	(t__doc__tos.pathR)treRNRtpkginfoRtcompiletEXTRA_RERRR#R;RHR0(((s//tmp/pip-install-NwWfNs/wheel/wheel/metadata.pyt<module>s