????

Your IP : 216.73.216.152


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

�
��]c@s�dZddlmZddlmZddlmZyddlmZWnek
rce	ZnXddl
Z
ddlZddl
Z
ddlZddlZddlZdZid	d
6dd6d
d6Ze�Zidd6dd6dfidd6dd6dffZed&�Ze
jd�Ze
jd�Zedd'�Zd�Zd�Zdd�Zd �Z d!�Z!d"�Z"d#�Z#d$�Z$e%d%kr�ddl&Z&ddl'Z'e'j'ee&j(d��ndS((s2
Tools for converting old- to new-style metadata.
i����(t
namedtuplei(t
read_pkg_info(tOrderedDefaultDict(tOrderedDictNs2.0tclassifierst
classifiertprovidest
provides_disttextrastprovides_extratauthor_emailtemailtauthortnametmaintainer_emailt
maintainertplatformt	home_pagetlicensesF^(?P<package>.*?)(;\s*(?P<condition>.*?)(extra == '(?P<extra>.*?)')?)$s[-,]+tMayRequiresKeyt	conditiontextraccs?t�}x/|D]'}||kr|j|�|VqqWdS(s<
    Yield unique values in iterable, preserving order.
    N(tsettadd(titerabletseentvalue((s-/tmp/pip-build-tmgNo5/wheel/wheel/metadata.pytunique,s
	

cCs�tt�}x�t|j|��D]�}tj|�}|r�|j�}|d}|d}|d}	|jd�r�|d }q�nd
\}}|}	t	||�}||j
|	�q"W|r�g|d<d�}
x~t|j�d|
�D]d\}}td	|ff�}|j
r(|j
|d<n|jrA|j|d
<n|dj
|�q�Wd|krog|d<n|djg|j�D]}|j
r�|j
^q��ndS(sE
    Place the runtime requirements from pkg_info into metadata.
    RRtpackages and i����trun_requirescSs&|\}}|jdkrdS|jS(Nt(RtNone(titemtkeyR((s-/tmp/pip-build-tmgNo5/wheel/wheel/metadata.pytsort_keyMsR!trequirestenvironmentRN(NN(Rtlisttsortedtget_alltEXTRA_REtsearcht	groupdicttendswithRRtappendtitemsRRRtextendtkeys(tmetadatatpkg_infoR!tmay_requiresRtextra_matchR*RRRR"tmay_requirement((s-/tmp/pip-build-tmgNo5/wheel/wheel/metadata.pythandle_requires7s6



	%		
cCs9td��}dtjd|d<ytt|�}WnAtk
r{tjj�j	t
|d�j�jd��}nXd }|dr�t|d�|d<|d=n|d	r�t|�}|d	=n<|j�}t|t�r�|jd�}n|r|}n|r||d
<nxbttd�|j�D���D]>}|jdd
�}|tkreq;n|tkr�|j|�dkr�q;n|tt�kr�|j|�|t|<q;|dkr�t|||�q;|dkrd|kr�g|d<n|dj|j|��q;|dkrEi||d6|ddd<q;|dkrktj||�|d<q;||||<q;Wt |d<d|kr�tt!|d��|d<n|r/xvd*D]k\}}	yKt"||	�}
t|
t#�rtt$|
��}i|d6g||<nWq�t%k
r'q�Xq�Wng}x~t&D]v\}
}t'�}x>t|
�D]0}|
||kr^|j(|
|�||<q^q^W|r<||d<|j)|�q<q<W|r�||ddd<ny�t
t*j+j,t*j+j-|�d�d��}t.j/j0|j��}Wd QXt'�}xyt|j1��D]e\}}t'�||<xItt2t3|j4���D],}|jd!d"�\}}||||<qpWq;W|r�||dd#<nWnt5k
r�nXd#|dkr5xRd+d,fD]A\}}||dd#kr�|dd#||dd(|<q�q�Wn|S(-s
    Convert PKG-INFO to a prototype Metadata 2.0 (PEP 426) dict.

    The description is included under the key ['description'] rather than
    being written to a separate file.

    path: path to PKG-INFO file
    distribution: optional distutils Distribution()
    cSs
td��S(NcSs
tt�S(N(RR(((s-/tmp/pip-build-tmgNo5/wheel/wheel/metadata.pyt<lambda>ls(R(((s-/tmp/pip-build-tmgNo5/wheel/wheel/metadata.pyR6lss
bdist_wheel (t)t	generatortrbsutf-8tSummarytsummarytDescriptiontdescriptioncss|]}|j�VqdS(N(tlower(t.0tk((s-/tmp/pip-build-tmgNo5/wheel/wheel/metadata.pys	<genexpr>�st-t_tUNKNOWNt
requires_distR	RRtHomet
extensionsspython.detailstproject_urlstkeywordstmetadata_versiont
test_requirest
tests_requireR#troletcontactssentry_points.txttrNs = ispython.exportstconsole_scriptstwrap_consoletgui_scriptstwrap_guispython.commands(RJs
tests_require((RJs
tests_require(sconsole_scriptsRP(sgui_scriptsRR(6Rtwheelt__version__tunicodeRt	NameErrorRtparsertParsertparsestrtopentreadtdecodeRtpkginfo_unicodetdedent_descriptiontget_payloadt
isinstancetbytesR&RR/treplacetSKIP_FIELDStUNKNOWN_FIELDStgett
PLURAL_FIELDSR'R5R.tKEYWORDS_REtsplittMETADATA_VERSIONRtgetattrR%tconvert_requirementstAttributeErrortCONTACT_FIELDSRtpopR,tostpathtjointdirnamet
pkg_resourcest
EntryPointt	parse_mapR-tmaptstrtvaluestIOError(RptdistributionR0R1R=tpayloadR!tlow_keyR#tattrtrequirementstnew_requirementsRMtcontact_typeRLtcontacttep_filetep_maptexportstgroupR-R R
texportt	ep_scripttwrap_script((s-/tmp/pip-build-tmgNo5/wheel/wheel/metadata.pytpkginfo_to_dictas�
4



	
)!
 

	
-	
"
(cCsLg}x(|jD]\}}|j||�qW|s;dSddj|�S(sBCompose the version predicates for requirement in PEP 345 fashion.Rs (%s)t,(tspecsR,Rq(trequirementRDtoptver((s-/tmp/pip-build-tmgNo5/wheel/wheel/metadata.pytrequires_to_requires_dist�sccshxa|D]Y}tjj|�}t|�}dj|j�}|rPd|}n|j||VqWdS(s=Yield Requires-Dist: strings for parsed requirements strings.R�s[%s]N(RstRequirementtparseR�RqRtproject_name(R~treqtparsed_requirementtspecR((s-/tmp/pip-build-tmgNo5/wheel/wheel/metadata.pyRk�s

c
Csct|�}|jdd�tjj|d�}tjj|�r2t|�j�}x�tt	j
|�dd��D]�\}}d}|r�d|kr�|jdd�\}}n|r�||d	<|r�|d
7}n|dt|�7}n|rd|}nx(tt
|��D]}|||d
<qWqtWn|d}	|	r_|jt|��|d=n|S(sn
    Convert .egg-info directory with PKG-INFO to the Metadata 1.3 aka
    old-draft Metadata 2.0 format.
    sMetadata-Versions2.0srequires.txtR!cSs|dp
dS(NiR((tx((s-/tmp/pip-build-tmgNo5/wheel/wheel/metadata.pyR6�sRt:isProvides-Extras and sextra == %ss; s
Requires-DistR<(Rtreplace_headerRoRpRqtexistsRZR[R&Rstsplit_sectionsRhtreprRktset_payloadR^(
t
egg_info_pathtpkginfo_pathR1t
requires_pathR#RtreqsRtnew_reqR=((s-/tmp/pip-build-tmgNo5/wheel/wheel/metadata.pytpkginfo_to_metadata�s0




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(R>R`RwthasattrR�tencodeR\(R1tfieldttextR ((s-/tmp/pip-build-tmgNo5/wheel/wheel/metadata.pyR]s

	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`RwtTrueR]t
splitlinesRqtlstripttextwraptdedentR�R\(R1R=t
surrogatestdescription_linestdescription_dedent((s-/tmp/pip-build-tmgNo5/wheel/wheel/metadata.pyR^s

	t__main__(sauthorsauthor_emailsplatforms	home_pageslicense(s	conditionsextra()t__doc__tcollectionsRtpkginfoRtutilRRtImportErrortdicttretos.pathRoR�Rstemail.parserRRSRiRfRRcRmRdtcompileR(RgRRR5RR�R�RkR�R]R^t__name__tsystpprinttargv(((s-/tmp/pip-build-tmgNo5/wheel/wheel/metadata.pyt<module>sL



				*z			
	!