U ÀÒ.e*ã@sdZddlmZddlZddlmZddlZddlZddlZddl m Z m Z ddl m Z mZmZddlmZdd lmZmZdd lmZmZe e¡ZGd d „d e ƒZGd d„de ƒZGdd„de ƒZGdd„de ƒZdddgZdZ dZ!e "d¡Z#e "d¡Z$dZ%dZ&dZ'dZ(dZ)dZ*d Z+e*d!Z,d"Z-e.ƒZ/e/ 0e%¡e/ 0e&¡e/ 0e(¡e/ 0e*¡e/ 0e,¡e "d#¡Z1d$d%„Z2d&d'„Z3d(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFœZ4dGZ5dHZ6dIZ7dJZ8dKZ9dLZ:dMZ;e<ƒZ=e "dN¡Z>dXdPdQ„Z?GdRdS„dSe<ƒZ@dTZAdUZBdVZCGdWd„de<ƒZDdS)YzImplementation of the Metadata for Python packages PEPs. Supports all metadata formats (1.0, 1.1, 1.2, and 2.0 experimental). é)Úunicode_literalsN)Úmessage_from_fileé)ÚDistlibExceptionÚ __version__)ÚStringIOÚ string_typesÚ text_type)Ú interpret)Úextract_by_keyÚ get_extras)Ú get_schemeÚPEP440_VERSION_REc@seZdZdZdS)ÚMetadataMissingErrorzA required metadata is missingN©Ú__name__Ú __module__Ú __qualname__Ú__doc__©rrú@/usr/lib/python3.8/site-packages/pip/_vendor/distlib/metadata.pyrsrc@seZdZdZdS)ÚMetadataConflictErrorz>Attempt to read or write metadata fields that are conflictual.Nrrrrrr src@seZdZdZdS)Ú MetadataUnrecognizedVersionErrorz Unknown metadata version number.Nrrrrrr$src@seZdZdZdS)ÚMetadataInvalidErrorzA metadata value is invalidNrrrrrr(srÚMetadataÚPKG_INFO_ENCODINGÚPKG_INFO_PREFERRED_VERSIONúutf-8ú1.1z \|ú ) úMetadata-VersionÚNameÚVersionÚPlatformÚSummaryÚ DescriptionÚKeywordsú Home-pageÚAuthorú Author-emailÚLicense)r r!r"r#úSupported-Platformr$r%r&r'r(r)r*Ú Classifierú Download-URLÚ ObsoletesÚProvidesÚRequires)r.r/r0r,r-)r r!r"r#r+r$r%r&r'r(r)Ú MaintainerúMaintainer-emailr*r,r-úObsoletes-Distú Project-URLú Provides-Distú Requires-DistúRequires-PythonúRequires-External)r5r6r7r3r8r1r2r4)r r!r"r#r+r$r%r&r'r(r)r1r2r*r,r-r3r4r5r6r7r8úPrivate-Versionú Obsoleted-ByúSetup-Requires-DistÚ ExtensionúProvides-Extra)r9r=r:r;r<)úDescription-Content-Typer0r/)r>z"extra\s*==\s*("([^"]+)"|'([^']+)')cCsL|dkr tS|dkrtS|dkr$tS|dkr4ttS|dkr@tSt|ƒ‚dS)Nú1.0rú1.2)ú1.3ú2.1ú2.0)Ú _241_FIELDSÚ _314_FIELDSÚ _345_FIELDSÚ _566_FIELDSÚ _426_FIELDSr)ÚversionrrrÚ_version2fieldlistpsrJc CsBdd„}g}| ¡D]"\}}|gddfkr,q| |¡qddddd d g}|D]ö}|tkrvd|krv| d¡t d |¡|tkrœd|krœ| d¡t d |¡|tkrÂd|krÂ| d¡t d |¡|tkrèd|krè| d¡t d|¡|tkrd |kr|dkr| d ¡t d|¡|t krLd |krL| d ¡t d|¡qLt |ƒdkrZ|dSt |ƒdkr|t d|¡t dƒ‚d|koŽ||t ƒ}d|ko¢||t ƒ}d |ko¶||tƒ}d |koÊ||tƒ} t|ƒt|ƒt|ƒt| ƒdkrút dƒ‚|s |s |s | s t|kr tS|r*dS|r4dS|r>d Sd S)z5Detect the best version depending on the fields used.cSs|D]}||krdSqdS)NTFr)ÚkeysÚmarkersÚmarkerrrrÚ _has_marker€sz"_best_version.._has_markerÚUNKNOWNNr?rr@rArCrBzRemoved 1.0 due to %szRemoved 1.1 due to %szRemoved 1.2 due to %szRemoved 1.3 due to %sr%zRemoved 2.1 due to %szRemoved 2.0 due to %srrz)Out of options - unknown metadata set: %szUnknown metadata setz,You used incompatible 1.1/1.2/2.0/2.1 fields)ÚitemsÚappendrDÚremoveÚloggerÚdebugrErFrGrHÚlenrÚ _314_MARKERSÚ _345_MARKERSÚ _566_MARKERSÚ _426_MARKERSÚintr) ÚfieldsrNrKÚkeyÚvalueZpossible_versionsZis_1_1Zis_1_2Zis_2_1Zis_2_0rrrÚ _best_version~s`              & r^r r!r"r#r+r$r%r&r'r(r)r1r2r*r,r-r3r5r6r;r7r8r0r/r.r4r9r:r<r=)Úmetadata_versionÚnamerIÚplatformZsupported_platformÚsummaryÚ descriptionÚkeywordsÚ home_pageÚauthorÚ author_emailÚ maintainerÚmaintainer_emailÚlicenseÚ classifierÚ download_urlÚobsoletes_distÚ provides_distÚ requires_distÚsetup_requires_distÚrequires_pythonÚrequires_externalÚrequiresÚprovidesÚ obsoletesÚ project_urlZprivate_versionZ obsoleted_byÚ extensionZprovides_extra)r6r3r5)r7)r")r#r,r.r0r/r3r5r6r8r4r+r;r=r<)r4)r&)r(r1r$r%z[^A-Za-z0-9.]+FcCs0|r$t d|¡}t d| dd¡¡}d||fS)zhReturn the distribution name with version. If for_filename is true, return a filename-escaped form.ú-ú Ú.z%s-%s)Ú _FILESAFEÚsubÚreplace)r`rIZ for_filenamerrrÚ_get_name_and_versionùs r~c@s eZdZdZd?dd„Zdd„Zdd „Zd d „Zd d „Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„Zd@dd„Zdd„Zdd „Zd!d"„Zd#d$„ZdAd%d&„ZdBd'd(„ZdCd)d*„Zd+d,„Zefd-d.„ZdDd/d0„ZdEd1d2„Zd3d4„Zd5d6„Zd7d8„Zd9d:„Zd;d<„Z d=d>„Z!dS)FÚLegacyMetadataaaThe legacy metadata of a release. Supports versions 1.0, 1.1 and 1.2 (auto-detected). You can instantiate the class with one of these arguments (or none): - *path*, the path to a metadata file - *fileobj* give a file-like object with metadata as content - *mapping* is a dict-like object - *scheme* is a version scheme name NÚdefaultcCsz|||g d¡dkrtdƒ‚i|_g|_d|_||_|dk rH| |¡n.|dk r\| |¡n|dk rv| |¡|  ¡dS)Néú'path, fileobj and mapping are exclusive) ÚcountÚ TypeErrorÚ_fieldsZrequires_filesZ _dependenciesÚschemeÚreadÚ read_fileÚupdateÚset_metadata_version)ÚselfÚpathÚfileobjÚmappingr†rrrÚ__init__s   zLegacyMetadata.__init__cCst|jƒ|jd<dS©Nr )r^r…©r‹rrrrŠ"sz#LegacyMetadata.set_metadata_versioncCs| d||f¡dS)Nz%s: %s )Úwrite)r‹rr`r]rrrÚ _write_field%szLegacyMetadata._write_fieldcCs | |¡S©N)Úget©r‹r`rrrÚ __getitem__(szLegacyMetadata.__getitem__cCs | ||¡Sr”)Úset)r‹r`r]rrrÚ __setitem__+szLegacyMetadata.__setitem__cCs8| |¡}z |j|=Wntk r2t|ƒ‚YnXdSr”)Ú _convert_namer…ÚKeyError)r‹r`Ú field_namerrrÚ __delitem__.s   zLegacyMetadata.__delitem__cCs||jkp| |¡|jkSr”)r…ršr–rrrÚ __contains__5s ÿzLegacyMetadata.__contains__cCs(|tkr |S| dd¡ ¡}t ||¡S)NrxÚ_)Ú _ALL_FIELDSr}ÚlowerÚ _ATTR2FIELDr•r–rrrrš9szLegacyMetadata._convert_namecCs|tks|tkrgSdS)NrO)Ú _LISTFIELDSÚ_ELEMENTSFIELDr–rrrÚ_default_value?szLegacyMetadata._default_valuecCs&|jdkrt d|¡St d|¡SdS)N©r?rÚ )r_Ú_LINE_PREFIX_PRE_1_2r|Ú_LINE_PREFIX_1_2©r‹r]rrrÚ_remove_line_prefixDs  z"LegacyMetadata._remove_line_prefixcCs|tkr||St|ƒ‚dSr”)r¢ÚAttributeErrorr–rrrÚ __getattr__JszLegacyMetadata.__getattr__FcCst|d|d|ƒS)zhReturn the distribution name with version. If filesafe is true, return a filename-escaped form.r!r")r~)r‹ZfilesaferrrÚ get_fullnameUszLegacyMetadata.get_fullnamecCs| |¡}|tkS)z+return True if name is a valid metadata key)ršr r–rrrÚis_field[s zLegacyMetadata.is_fieldcCs| |¡}|tkSr”)ršr£r–rrrÚis_multi_field`s zLegacyMetadata.is_multi_fieldcCs.tj|ddd}z| |¡W5| ¡XdS)z*Read the metadata values from a file path.Úrr©ÚencodingN)ÚcodecsÚopenÚcloserˆ)r‹ÚfilepathÚfprrrr‡dszLegacyMetadata.readcCst|ƒ}|d|jd<tD]p}||kr(q|tkrf| |¡}|tkrX|dk rXdd„|Dƒ}| ||¡q||}|dk r|dkr| ||¡qdS)z,Read the metadata values from a file object.zmetadata-versionr NcSsg|]}t| d¡ƒ‘qS©ú,)ÚtupleÚsplit©Ú.0r]rrrÚ ysz,LegacyMetadata.read_file..rO)rr…r r£Zget_allÚ_LISTTUPLEFIELDSr˜)r‹ZfileobÚmsgÚfieldÚvaluesr]rrrrˆls zLegacyMetadata.read_filecCs0tj|ddd}z| ||¡W5| ¡XdS)z&Write the metadata fields to filepath.Úwrr²N)r´rµr¶Ú write_file)r‹r·Ú skip_unknownr¸rrrr’ƒszLegacyMetadata.writecCsÄ| ¡t|dƒD]ª}| |¡}|r8|dgdgfkr8q|tkrV| ||d |¡¡q|tkr|dkrŠ|jdkr~| dd¡}n | dd¡}|g}|t kr¦d d „|Dƒ}|D]}| |||¡qªqd S) z0Write the PKG-INFO format data to a file object.r rOrºr%r¦r§rz |cSsg|]}d |¡‘qSr¹©Újoinr½rrrr¿Ÿsz-LegacyMetadata.write_file..N) rŠrJr•r¤r“rÈr£r_r}rÀ)r‹Z fileobjectrÆrÂrÃr]rrrrÅ‹s$   zLegacyMetadata.write_filec sv‡fdd„}|sn@t|dƒr:| ¡D]}||||ƒq$n|D]\}}|||ƒq>|rr| ¡D]\}}|||ƒq^dS)a…Set metadata values from the given iterable `other` and kwargs. Behavior is like `dict.update`: If `other` has a ``keys`` method, they are looped over and ``self[key]`` is assigned ``other[key]``. Else, ``other`` is an iterable of ``(key, value)`` iterables. Keys that don't match a metadata field or that have an empty value are dropped. cs"|tkr|rˆ ˆ |¡|¡dSr”)r¢r˜rš)r\r]r‘rrÚ_set®s z#LegacyMetadata.update.._setrKN)ÚhasattrrKrP)r‹ÚotherÚkwargsrÉÚkÚvrr‘rr‰¤s     zLegacyMetadata.updatecCsh| |¡}|tks|dkrNt|ttfƒsNt|tƒrHdd„| d¡Dƒ}qzg}n,|tkrzt|ttfƒszt|tƒrv|g}ng}t  t j ¡r<|d}t |j ƒ}|tkrÚ|dk rÚ|D](}| | d¡d¡s®t d |||¡q®nb|tkr |dk r | |¡s.rºr!Nú;rz$'%s': '%s' is not valid (field '%s')z.'%s': '%s' is not a valid version (field '%s')r%)ršr¤Ú isinstanceÚlistr»rr¼r£rSZ isEnabledForÚloggingZWARNINGr r†Ú_PREDICATE_FIELDSÚis_valid_matcherÚwarningÚ_VERSIONS_FIELDSÚis_valid_constraint_listÚ_VERSION_FIELDSÚis_valid_versionÚ_UNICODEFIELDSr«r…)r‹r`r]Z project_namer†rÎrrrr˜ÀsV  ÿ  ÿ  þ ÿ ÿ   zLegacyMetadata.setcCsÊ| |¡}||jkr*|tkr&| |¡}|S|tkr@|j|}|S|tkrš|j|}|dkr^gSg}|D].}|tkr~| |¡qf| |d|df¡qf|S|tkrÀ|j|}t |t ƒrÀ|  d¡S|j|S)zGet a metadata field.Nrrrº) ršr…Ú_MISSINGr¥rÛr£rÀrQr¤rÑrr¼)r‹r`r€r]ÚresÚvalrrrr•ìs.         zLegacyMetadata.getc sú| ¡gg}}dD]}||kr| |¡q|rP|gkrPdd |¡}t|ƒ‚dD]}||krT| |¡qT|ddkr€||fSt|jƒ‰‡fdd„}t|ftˆjft ˆj ffD]@\}}|D]2} |  | d ¡} | d k r¼|| ƒs¼| d | | f¡q¼q°||fS) zkCheck if the metadata is compliant. If strict is True then raise if no Name or Version are provided)r!r"zmissing required metadata: %sú, )r'r(r r@cs(|D]}ˆ | d¡d¡sdSqdS)NrÐrFT)rÕr¼)r]rΩr†rrÚare_valid_constraints#sz3LegacyMetadata.check..are_valid_constraintsNzWrong value for '%s': %s) rŠrQrÈrr r†rÔr×rØrÙrÚr•) r‹ÚstrictÚmissingÚwarningsÚattrrÁrár[Z controllerrÂr]rràrÚcheck s8       ÿÿý  zLegacyMetadata.checkcCsÎ| ¡d}i}|D]"\}}|r*||jkr||||<q|ddkr’d}|D]B\}}|rb||jkrL|dkrx||||<qLdd„||Dƒ||<qLn8|ddkrÊd }|D]"\}}|r¼||jkr¦||||<q¦|S) zºReturn fields as a dict. Field names will be converted to use the underscore-lowercase style instead of hyphen-mixed case (i.e. home_page instead of Home-page). ) )r_r )r`r!)rIr")rbr$)rer')rfr()rgr))rjr*)rcr%)rdr&)rar#)Ú classifiersr,)rlr-r r@))ror6)rqr7)rrr8)rnr5)rmr3)rvr4)rhr1)rir2rvcSsg|]}d |¡‘qSr¹rÇ)r¾Úurrrr¿bsz)LegacyMetadata.todict..r))rtr/)rsr0)rur.)rŠr…)r‹Z skip_missingZ mapping_1_0Údatar\rœZ mapping_1_2Z mapping_1_1rrrÚtodict5s&     zLegacyMetadata.todictcCs8|ddkr$dD]}||kr||=q|d|7<dS)Nr r)r.r0r/r6r)r‹Ú requirementsrÂrrrÚadd_requirementsps  zLegacyMetadata.add_requirementscCstt|dƒƒSr)rÒrJr‘rrrrK{szLegacyMetadata.keysccs| ¡D] }|VqdSr”©rK)r‹r\rrrÚ__iter__~s zLegacyMetadata.__iter__cs‡fdd„ˆ ¡DƒS)Ncsg|] }ˆ|‘qSrr©r¾r\r‘rrr¿ƒsz)LegacyMetadata.values..rír‘rr‘rrÂszLegacyMetadata.valuescs‡fdd„ˆ ¡DƒS)Ncsg|]}|ˆ|f‘qSrrrïr‘rrr¿†sz(LegacyMetadata.items..rír‘rr‘rrP…szLegacyMetadata.itemscCsd|jj|j|jfS)Nz <%s %s %s>)Ú __class__rr`rIr‘rrrÚ__repr__ˆs ÿzLegacyMetadata.__repr__)NNNr€)F)F)F)N)F)F)"rrrrrrŠr“r—r™rržršr¥r«r­r®r¯r°r‡rˆr’rÅr‰r˜rÜr•rærêrìrKrîrÃrPrñrrrrrs@ ÿ     ,  , ; rz pydist.jsonz metadata.jsonZMETADATAc@s’eZdZdZe d¡Ze dej¡Ze Z e d¡Z dZ de Zdddd œZd Zd Zedfedfe dfe dfd œZd ZdDdd„ZedƒZdefZdefZdefdefeeedefeeeedefdddœ Z[[dd„ZdEdd„Zdd„Zed d!„ƒZ ed"d#„ƒZ!e!j"d$d#„ƒZ!dFd%d&„Z#ed'd(„ƒZ$ed)d*„ƒZ%e%j"d+d*„ƒZ%d,d-„Z&d.d/„Z'd0d1„Z(d2d3„Z)d4d5d6d7d8dd9œZ*d:d;„Z+dGd>d?„Z,d@dA„Z-dBdC„Z.dS)HrzÊ The metadata of a release. This implementation uses 2.0 (JSON) metadata where possible. If not possible, it wraps a LegacyMetadata instance which handles the key-value metadata format. z ^\d+(\.\d+)*$z!^[0-9A-Z]([0-9A-Z_.-]*[0-9A-Z])?$z .{1,2047}rCz distlib (%s)r)Úlegacy)r`rIrbzqname version license summary description author author_email keywords platform home_page classifiers download_urlzwextras run_requires test_requires build_requires dev_requires provides meta_requires obsoleted_by supports_environments)r_r`rIrb)Ú_legacyÚ_datar†Nr€c Cs0|||g d¡dkrtdƒ‚d|_d|_||_|dk rzz| ||¡||_Wn*tk rvt||d|_| ¡YnXn²d}|r¢t |dƒ}|  ¡}W5QRXn |r®|  ¡}|dkrÈ|j |j dœ|_ndt |tƒsÜ| d¡}zt |¡|_| |j|¡Wn0tk r*tt|ƒ|d|_| ¡YnXdS)Nrr‚)rŽr†Úrb©r_Ú generatorr)rr†)rƒr„rórôr†Ú_validate_mappingrrÚvalidaterµr‡ÚMETADATA_VERSIONÚ GENERATORrÑr ÚdecodeÚjsonÚloadsÚ ValueErrorr)r‹rŒrrŽr†réÚfrrrr¼s@   þ    ÿzMetadata.__init__)r`rIrjrdrbr6r;r=r,)r-N)r N) Ú run_requiresÚbuild_requiresÚ dev_requiresZ test_requiresÚ meta_requiresÚextrasÚmodulesÚ namespacesÚexportsÚcommandsrçZ source_urlr_c CsXt |d¡}t |d¡}||kr||\}}|jr^|dkrP|dkrHdn|ƒ}n |j |¡}nº|dkrjdn|ƒ}|dkrˆ|j ||¡}ntƒ}|}|j d¡} | r |dkrº|  d|¡}nP|dkrÞ|  d¡} | rÜ|  ||¡}n,|  d ¡} | sø|j d ¡} | r |  ||¡}||krT|}n:||kr2t ||¡}n"|jrH|j |¡}n |j |¡}|S) NÚ common_keysÚ mapped_keys©r rrrrçÚ extensionsr úpython.commandsrçúpython.detailsúpython.exports)ÚobjectÚ__getattribute__rór•rô) r‹r\ÚcommonÚmappedÚlkZmakerÚresultr]ÚsentinelÚdrrrrsD            zMetadata.__getattribute__cCsH||jkrD|j|\}}|p |j|krD| |¡}|sDtd||fƒ‚dS)Nz.'%s' is an invalid value for the '%s' property)ÚSYNTAX_VALIDATORSr†Úmatchr)r‹r\r]r†ÚpatternÚ exclusionsÚmrrrÚ_validate_value+s  ÿÿzMetadata._validate_valuecCs*| ||¡t |d¡}t |d¡}||kr¾||\}}|jrV|dkrJt‚||j|<nf|dkrj||j|<nR|j di¡}|dkrŠ||d<n2|dkr¨| di¡}|||<n| d i¡}|||<nh||krÖt |||¡nP|d krt|t ƒr|  ¡}|r|  ¡}ng}|jr||j|<n ||j|<dS) Nr r r r r rrçrrrd) rrrróÚNotImplementedErrorrôÚ setdefaultÚ __setattr__rÑrrÏr¼)r‹r\r]rrrrŸrrrrr!5s<               zMetadata.__setattr__cCst|j|jdƒS©NT)r~r`rIr‘rrrÚname_and_version\szMetadata.name_and_versioncCsF|jr|jd}n|j dg¡}d|j|jf}||krB| |¡|S)Nr5rtz%s (%s))rórôr r`rIrQ)r‹rÚsrrrrt`s  zMetadata.providescCs |jr||jd<n ||jd<dS)Nr5rt)rórôrªrrrrtks c CsÚ|jr |}nÊg}t|pg|jƒ}|D]d}d|kr>d|kr>d}n8d|krLd}n| d¡|k}|rv| d¡}|rvt||ƒ}|r$| |d¡q$dD]F}d|} | |krŽ| | ¡|j d|g¡}| |j|||d¡qŽ|S) a‹ Base method to get dependencies, given a set of extras to satisfy and an optional environment context. :param reqts: A list of sometimes-wanted dependencies, perhaps dependent on extras and environment. :param extras: A list of optional components being requested. :param env: An optional environment for marker evaluation. ÚextraÚ environmentTrs)ZbuildZdevZtestz:%s:z %s_requires)rÚenv) rór rr•r ÚextendrRrôÚget_requirements) r‹Úreqtsrr'rrZincluderMr\Úerrrr)rs2     ÿ zMetadata.get_requirementscCs|jr| ¡S|jSr”)róÚ _from_legacyrôr‘rrrÚ dictionaryœszMetadata.dictionarycCs|jr t‚nt|j|jƒSdSr”)rórr rôÚDEPENDENCY_KEYSr‘rrrÚ dependencies¢szMetadata.dependenciescCs|jr t‚n |j |¡dSr”)rórrôr‰rªrrrr/©sc Cs†| d¡|jkrtƒ‚g}|j ¡D]"\}}||kr$||kr$| |¡q$|rbdd |¡}t|ƒ‚| ¡D]\}}| |||¡qjdS)Nr_zMissing metadata items: %srß) r•rúrÚMANDATORY_KEYSrPrQrÈrr) r‹rŽr†rãr\rrÁrÍrÎrrrrø°s zMetadata._validate_mappingcCsB|jr.|j d¡\}}|s|r>t d||¡n| |j|j¡dS)NTz#Metadata: missing: %s, warnings: %s)rórærSrÖrørôr†)r‹rãrärrrrù¾sÿzMetadata.validatecCs(|jr|j d¡St|j|jƒ}|SdSr")rórêr rôÚ INDEX_KEYS)r‹rrrrrêÇs zMetadata.todictc CsÆ|jr |jrt‚|j|jdœ}|j d¡}dD]*}||kr.|dkrHd}n|}||||<q.| dg¡}|dgkrtg}||d<d }|D]*\}}||kr„||r„d ||ig||<q„|j|d <i}i} |S) NröT)r`rIrjrbrcrkrkrçr&Úrd))ror)rprrsrt)rórôÚAssertionErrorrúrûrêr•rt) r‹rZlmdrÍÚnkÚkwrKÚokrfrhrrrr,Îs.þ     zMetadata._from_legacyr!r"r*r$r%)r`rIrjrbrcrçcCsœdd„}|jr|jrt‚tƒ}|j}|j ¡D]\}}||kr.||||<q.||j|jƒ}||j|j ƒ}|j r€t |j ƒ|d<t |ƒ|d<t |ƒ|d<|S)NcSsŒtƒ}|D]|}| d¡}| d¡}|d}|D]V}|sF|sF| |¡q.d}|rVd|}|rp|rld||f}n|}| d ||f¡¡q.q |S)Nr%r&rsr2z extra == "%s"z (%s) and %srÐ)r˜r•ÚaddrÈ)Úentriesr*r+r%r'Zrlistr±rMrrrÚprocess_entriesõs"   z,Metadata._to_legacy..process_entriesr=r6r;) rôrór3rÚLEGACY_MAPPINGrPrrrrrÚsorted)r‹r9rZnmdr4r6Zr1Zr2rrrÚ _to_legacyôs  zMetadata._to_legacyFTc CsÂ||g d¡dkrtdƒ‚| ¡|r`|jr4|j}n| ¡}|rP|j||dq¾|j||dn^|jrp| ¡}n|j}|rt j ||ddddn.t   |dd¡}t j ||ddddW5QRXdS) Nrz)Exactly one of path and fileobj is needed)rÆTr)Z ensure_asciiÚindentZ sort_keysrÄr) rƒrÿrùrór<r’rÅr,rôrýÚdumpr´rµ)r‹rŒrròrÆZ legacy_mdrrrrrr’s*  ÿ ÿzMetadata.writecCsŠ|jr|j |¡nr|j dg¡}d}|D]}d|kr*d|kr*|}qHq*|dkrfd|i}| d|¡n t|dƒt|ƒB}t|ƒ|d<dS)Nrr&r%rsr)rórìrôr Úinsertr˜r;)r‹rërÚalwaysÚentryZrsetrrrrì3szMetadata.add_requirementscCs*|jpd}|jpd}d|jj|j||fS)Nz (no name)z no versionz<%s %s %s (%s)>)r`rIrðrr_)r‹r`rIrrrrñDs  ÿzMetadata.__repr__)NNNr€)N)NN)NNFT)/rrrrÚreÚcompileZMETADATA_VERSION_MATCHERÚIZ NAME_MATCHERrZVERSION_MATCHERZSUMMARY_MATCHERrúrrûr0r1r.rÚ __slots__rr˜r rÒZ none_listÚdictZ none_dictr rrr!Úpropertyr#rtÚsetterr)r-r/rørùrêr,r:r<r’rìrñrrrrr’sŽ  ýüÿ -ó+ '    *    ú % )F)ErZ __future__rr´ZemailrrýrÓrBr2rrÚcompatrrr rLr Úutilr r rIr rZ getLoggerrrSrrrrÚ__all__rrrCr©r¨rDrErVrFrWrHrYrGrXr˜r r‰ZEXTRA_RErJr^r¢rÔr×rÙr£rÀr¤rÛrrÜr{r~rZMETADATA_FILENAMEZWHEEL_METADATA_FILENAMEZLEGACY_METADATA_FILENAMErrrrrÚs°              Hâ!