ó ÿ¾v]c@sdZddlZddlZddlZddlZddlmZejdƒZ d„Z d„Z d„Z d „Z d „Zd „ZdS( s2 Tools for converting old- to new-style metadata. iÿÿÿÿNi(t read_pkg_infosF^(?P.*?)(;\s*(?P.*?)(extra == '(?P.*?)')?)$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(t requirementt requires_disttoptver((s//tmp/pip-install-vZZv26/wheel/wheel/metadata.pytrequires_to_requires_dists ccsnxg|D]_}tjj|ƒ}t|ƒ}djt|jƒƒ}|rVd|}n|j||VqWdS(s=Yield Requires-Dist: strings for parsed requirements strings.Rs[%s]N(t pkg_resourcest RequirementtparseRRR textrast project_name(t requirementstreqtparsed_requirementtspecR((s//tmp/pip-install-vZZv26/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-vZZv26/wheel/wheel/metadata.pytgenerate_requirements+s    c Cs$t|ƒ}|jddƒ|d=|d=tjj|dƒ}tjj|ƒrót|ƒ}|jƒ}WdQXtt j |ƒdd„ƒ}x`|D]U\}}xFt i||6ƒD]1\} } | | f|j ƒkr·| || VRt Description(Rtreplace_headertostpathRtexiststopentreadR Rtsplit_sectionsR#Rt set_payloadtdedent_description( t egg_info_patht pkginfo_pathtpkg_infot requires_patht requires_filetrequirestparsed_requirementsRtreqsR$tvaluet description((s//tmp/pip-install-vZZv26/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-vZZv26/wheel/wheel/metadata.pytpkginfo_unicodeds     cCs£|d}t}t|tƒs7t}t|dƒ}n|jƒ}dj|djƒtj dj|dƒƒdfƒ}|rŸ|j dƒj ddƒ}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-vZZv26/wheel/wheel/metadata.pyR0ts     (t__doc__tos.pathR)treRNRtpkginfoRtcompiletEXTRA_RERRR#R;RHR0(((s//tmp/pip-install-vZZv26/wheel/wheel/metadata.pyts