Y*+@sdZddlmZddlmZddlmZyddlmZWnek rde ZYnXddl Z ddl Z ddl Z ddlZddlZddlZdZd d d d d diZeZddddidfddddidffZed.Ze jdZe jdZedd/ZddZdd Zdd!d"Zd#d$Zd%d&Z d'd(Z!d)d*Z"d+d,Z#e$d-krddl%Z%ddl&Z&e&j&ee%j'ddS)0z2 Tools for converting old- to new-style metadata. ) namedtuple) read_pkg_info)OrderedDefaultDict) OrderedDictNz2.0 classifier classifiersZ provides_distprovidesprovides_extraextrasemail author_emailnameauthormaintainer_email maintainerplatform home_pagelicensezF^(?P.*?)(;\s*(?P.*?)(extra == '(?P.*?)')?)$z[-,]+MayRequiresKey conditionextraccs<t}x,|D]$}||kr|j||VqWdS)z< Yield unique values in iterable, preserving order. N)setadd)iterableseenvaluer//tmp/pip-build-3puug3g5/wheel/wheel/metadata.pyunique,s     rc Cstt}xt|j|D]}tj|}|r|j}|d}|d}|d} |jdr|dd}nd\}}|} t||}||j | q"W|rg|d.sort_keyr$requires environmentr cSs"g|]}|jr|jqSr)r).0r$rrr ^s z#handle_requires..)NN)rlistsortedget_allEXTRA_REsearch groupdictendswithrappenditemsrrrextendkeys) metadatapkg_infor$Z may_requiresrZ extra_matchr0rrr r%Zmay_requirementrrrhandle_requires7s6        %      r8cCs tdd}dtjd|d\}}||dd%kr|dd%||dd*|lsz3pkginfo_to_dict....)rrrrrr9lsz!pkginfo_to_dict..z bdist_wheel () generatorrbzutf-8NZSummarysummary Description descriptioncss|]}|jVqdS)N)lower)r(krrr sz"pkginfo_to_dict..-_UNKNOWN requires_distr r rZHome extensionszpython.detailsZ project_urlskeywordsmetadata_version test_requires tests_requirer&rolecontactszentry_points.txtrz = rzpython.exportsconsole_scripts wrap_console gui_scriptswrap_guizpython.commandsrJrK)rSzconsole_scriptsrPz gui_scriptsrR)rTrU)5rwheel __version__unicoder NameErrorr parserParserparsestropenreaddecodepkginfo_unicodededent_description get_payload isinstancebytesr,rr5replace SKIP_FIELDSUNKNOWN_FIELDSget PLURAL_FIELDSr-r8r4 KEYWORDS_REsplitMETADATA_VERSIONrgetattrr+convert_requirementsAttributeErrorCONTACT_FIELDSrpopr2ospathjoindirname pkg_resources EntryPoint parse_mapr3mapstrvaluesIOError)rs distributionr6r7r?payloadr$Zlow_keyr&attr requirementsnew_requirementsrMZ contact_typerLcontactep_fileep_mapexportsgroupr3r#rexportZ ep_scriptZ wrap_scriptrrrpkginfo_to_dictas  5      , !            -  " "rcCsLg}x(|jD]\}}|j||qW|s;dSddj|S)zBCompose the version predicates for requirement in PEP 345 fashion.r"z (%s),)specsr2rt) requirementrFopverrrrrequires_to_requires_dists rccsex^|D]V}tjj|}t|}dj|j}|rMd|}|j||VqWdS)z=Yield Requires-Dist: strings for parsed requirements strings.rz[%s]N)rv Requirementparserrtr project_name)rreqZparsed_requirementspecr rrrrns   rnc CsTt|}|jddtjj|d}tjj|r&t|j}xtt j |dddD]\}}d}|rd|kr|j dd \}}|r||d <|r|d 7}|d t |7}|rd |}x(tt |D]}|||d.r":rzProvides-Extraz and z extra == %sz; z Requires-Distr>)rreplace_headerrrrsrtexistsr]r^r,rvsplit_sectionsrkreprrn set_payloadra) egg_info_pathZ pkginfo_pathr7Z requires_pathr&rreqsrZnew_reqr?rrrpkginfo_to_metadatas0     rcCs||}|j}t|tst|ds>t|SxJ|jD]<}|dj|krK|djddjd}PqKW|S)zFT rrNutf8rr) rcrzr` splitlinesrtlstriptextwrapdedentrr_)r7r?Z surrogatesZdescription_linesZdescription_dedentrrrras      ra__main__)zauthorz author_emailzplatformz home_pagezlicense)z conditionzextra)(__doc__ collectionsrZpkginforutilrr ImportErrordictreos.pathrrrrv email.parserr rVrlrirrfrprgcompiler.rjrrr8rrrnrr`ra__name__syspprintargvrrrrsL             *z !