Your IP : 18.116.24.238


Current Path : /opt/alt/python37/lib/python3.7/site-packages/distlib/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/distlib/__pycache__/metadata.cpython-37.pyc

B

:��a�@s�dZddlmZddlZddlmZddlZddlZddlZddl	m
Z
mZddlm
Z
mZmZddlmZdd	lmZmZdd
lmZmZe�e�ZGdd�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)�e/D�Z4d*d)�e4�5�D�Z6d+Z7d,Z8d-Z9d.Z:d/Z;d0Z<d1Z=e>�Z?e�"d2�Z@d<d4d5�ZAGd6d7�d7e>�ZBd8ZCd9ZDd:ZEGd;d�de>�ZFdS)=z�Implementation of the Metadata for Python packages PEPs.

Supports all metadata formats (1.0, 1.1, 1.2, 1.3/2.1 and withdrawn 2.0).
�)�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�A/opt/alt/python37/lib/python3.7/site-packages/distlib/metadata.pyrsrc@seZdZdZdS)�MetadataConflictErrorz>Attempt to read or write metadata fields that are conflictual.N)rrrrrrrrr src@seZdZdZdS)� MetadataUnrecognizedVersionErrorz Unknown metadata version number.N)rrrrrrrrr$src@seZdZdZdS)�MetadataInvalidErrorzA metadata value is invalidN)rrrrrrrrr(sr�Metadata�PKG_INFO_ENCODING�PKG_INFO_PREFERRED_VERSIONzutf-8z1.1z

       \|z	
        )zMetadata-Version�Name�Version�Platform�Summary�Description�Keywordsz	Home-page�AuthorzAuthor-email�License)zMetadata-VersionrrrzSupported-Platformrr r!z	Home-pager"zAuthor-emailr#�
ClassifierzDownload-URL�	Obsoletes�Provides�Requires)r%r&r'r$zDownload-URL)zMetadata-VersionrrrzSupported-Platformrr r!z	Home-pager"zAuthor-email�
MaintainerzMaintainer-emailr#r$zDownload-URLzObsoletes-DistzProject-URLz
Provides-Distz
Requires-DistzRequires-PythonzRequires-External)z
Provides-Distz
Requires-DistzRequires-PythonzObsoletes-DistzRequires-Externalr(zMaintainer-emailzProject-URL)zMetadata-VersionrrrzSupported-Platformrr r!z	Home-pager"zAuthor-emailr(zMaintainer-emailr#r$zDownload-URLzObsoletes-DistzProject-URLz
Provides-Distz
Requires-DistzRequires-PythonzRequires-ExternalzPrivate-VersionzObsoleted-ByzSetup-Requires-Dist�	ExtensionzProvides-Extra)zPrivate-VersionzProvides-ExtrazObsoleted-ByzSetup-Requires-Distr))zDescription-Content-Typer'r&r%)zDescription-Content-Typez"extra\s*==\s*("([^"]+)"|'([^']+)')cCsZ|dkrtS|dkrtS|dkr$tS|dkrBttdd�tD��S|dkrNtSt|��dS)Nz1.0z1.1z1.2)z1.3z2.1css|]}|tkr|VqdS)N)�_345_FIELDS)�.0�frrr�	<genexpr>zsz%_version2fieldlist.<locals>.<genexpr>z2.0)�_241_FIELDS�_314_FIELDSr*�tuple�_566_FIELDS�_426_FIELDSr)�versionrrr�_version2fieldlistqsr4c
CsLdd�}g}x.|��D]"\}}|gddfkr.q|�|�qWddddd	d
g}�x�|D]�}|tkr~d|kr~|�d�t�d|�|tkr�d|kr�|�d�t�d|�|tkr�d|kr�|�d�t�d
|�|tkr�d|kr�|�d�t�d|�|tk�r$d
|k�r$|dk�r$|�d
�t�d|�|t	krTd	|krT|�d	�t�d|�qTWt
|�dk�rd|dSt
|�dk�r�t�d|�td��d|k�o�||t�}d|k�o�||t
�}d
|k�o�||t�}d	|k�o�||t�}	t|�t|�t|�t|	�dk�rtd��|�s*|�s*|�s*|	�s*t|k�r*tS|�r4dS|�r>dS|�rHd
Sd	S)z5Detect the best version depending on the fields used.cSsx|D]}||krdSqWdS)NTFr)�keys�markers�markerrrr�_has_marker�s
z"_best_version.<locals>._has_marker�UNKNOWNNz1.0z1.1z1.2z1.3z2.0z2.1zRemoved 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�appendr.�remove�logger�debugr/r*r1r2�lenr�_314_MARKERS�_345_MARKERS�_566_MARKERS�_426_MARKERS�intr)
�fieldsr8r5�key�valueZpossible_versionsZis_1_1Zis_1_2Zis_2_1Zis_2_0rrr�
_best_version�s`






&
rHcCsi|]}||���dd��qS)�-�_)�lower�replace)r+�namerrr�
<dictcomp>�srNcCsi|]\}}||�qSrr)r+�attr�fieldrrrrN�s)z
Requires-DistzObsoletes-Distz
Provides-Dist)zRequires-Python)r)rr$r%r'r&zObsoletes-Distz
Provides-Distz
Requires-DistzRequires-ExternalzProject-URLzSupported-PlatformzSetup-Requires-DistzProvides-Extrar))zProject-URL)r!)r"r(rr 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.rI� �.z%s-%s)�	_FILESAFE�subrL)rMr3Zfor_filenamerrr�_get_name_and_version�srUc@s
eZdZdZd?dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�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�LegacyMetadataaoThe legacy metadata of a release.

    Supports versions 1.0, 1.1, 1.2, 2.0 and 1.3/2.1 (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�z'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)NzMetadata-Version)rHr[)rarrrr`
sz#LegacyMetadata.set_metadata_versioncCs|�d||f�dS)Nz%s: %s
)�write)rarcrMrGrrr�_write_field
szLegacyMetadata._write_fieldcCs
|�|�S)N)�get)rarMrrr�__getitem__szLegacyMetadata.__getitem__cCs|�||�S)N)�set)rarMrGrrr�__setitem__szLegacyMetadata.__setitem__cCs8|�|�}y|j|=Wntk
r2t|��YnXdS)N)�
_convert_namer[�KeyError)rarM�
field_namerrr�__delitem__s

zLegacyMetadata.__delitem__cCs||jkp|�|�|jkS)N)r[rl)rarMrrr�__contains__s
zLegacyMetadata.__contains__cCs(|tkr|S|�dd���}t�||�S)NrIrJ)�_ALL_FIELDSrLrK�_ATTR2FIELDrh)rarMrrrrl!szLegacyMetadata._convert_namecCs|tks|tkrgSdS)Nr9)�_LISTFIELDS�_ELEMENTSFIELD)rarMrrr�_default_value'szLegacyMetadata._default_valuecCs&|jdkrt�d|�St�d|�SdS)N)z1.0z1.1�
)�metadata_version�_LINE_PREFIX_PRE_1_2rT�_LINE_PREFIX_1_2)rarGrrr�_remove_line_prefix,s
z"LegacyMetadata._remove_line_prefixcCs|tkr||St|��dS)N)rr�AttributeError)rarMrrr�__getattr__2szLegacyMetadata.__getattr__FcCst|d|d|�S)zhReturn the distribution name with version.

        If filesafe is true, return a filename-escaped form.rr)rU)raZfilesaferrr�get_fullname=szLegacyMetadata.get_fullnamecCs|�|�}|tkS)z+return True if name is a valid metadata key)rlrq)rarMrrr�is_fieldCs
zLegacyMetadata.is_fieldcCs|�|�}|tkS)N)rlrs)rarMrrr�is_multi_fieldHs
zLegacyMetadata.is_multi_fieldcCs.tj|ddd�}z|�|�Wd|��XdS)z*Read the metadata values from a file path.�rzutf-8)�encodingN)�codecs�openr^�close)ra�filepath�fprrrr]LszLegacyMetadata.readcCs�t|�}|d|jd<xxtD]p}||kr*q|tkrh|�|�}|tkrZ|dk	rZdd�|D�}|�||�q||}|dk	r|dkr|�||�qW|��}|r�|n|d|d<dS)z,Read the metadata values from a file object.zmetadata-versionzMetadata-VersionNcSsg|]}t|�d���qS)�,)r0�split)r+rGrrr�
<listcomp>asz,LegacyMetadata.read_file.<locals>.<listcomp>r9r )rr[rqrs�get_all�_LISTTUPLEFIELDSrjZget_payload)raZfileob�msgrP�valuesrGZbodyrrrr^Ts

zLegacyMetadata.read_filecCs0tj|ddd�}z|�||�Wd|��XdS)z&Write the metadata fields to filepath.�wzutf-8)r�N)r�r��
write_filer�)rar��skip_unknownr�rrrrfpszLegacyMetadata.writecCs�|��x�t|d�D]�}|�|�}|r:|dgdgfkr:q|tkrX|�||d�|��q|tkr�|dkr�|jdkr�|�dd�}n|�dd�}|g}|t	kr�d	d
�|D�}x|D]}|�|||�q�WqWdS)z0Write the PKG-INFO format data to a file object.zMetadata-Versionr9r�r )z1.0z1.1rvz	
        z	
       |cSsg|]}d�|��qS)r�)�join)r+rGrrrr��sz-LegacyMetadata.write_file.<locals>.<listcomp>N)
r`r4rhrtrgr�rsrwrLr�)raZ
fileobjectr�rPr�rGrrrr�xs$


zLegacyMetadata.write_filecs��fdd�}|snHt|d�r>x<|��D]}||||�q&Wnx|D]\}}|||�qDW|r~x|��D]\}}|||�qhWdS)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����|�|�dS)N)rrrjrl)rFrG)rarr�_set�sz#LegacyMetadata.update.<locals>._setr5N)�hasattrr5r:)ra�other�kwargsr��k�vr)rarr_�s

zLegacyMetadata.updatecCsl|�|�}|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�x�|D](}|�|�d�d�s�t�d	|||�q�Wnb|tk�r|dk	�r|�|��s@t�d
|||�n0|tk�r@|dk	�r@|�|��s@t�d
|||�|tk�r^|dk�r^|�|�}||j|<dS)z"Control then set a metadata field.rcSsg|]}|���qSr)�strip)r+r�rrrr��sz&LegacyMetadata.set.<locals>.<listcomp>r�rN�;rz$'%s': '%s' is not valid (field '%s')z.'%s': '%s' is not a valid version (field '%s')r )rlrt�
isinstance�listr0rr�rsr=�isEnabledFor�logging�WARNINGr
r\�_PREDICATE_FIELDS�is_valid_matcher�warning�_VERSIONS_FIELDS�is_valid_constraint_list�_VERSION_FIELDS�is_valid_version�_UNICODEFIELDSrzr[)rarMrGZproject_namer\r�rrrrj�s@








zLegacyMetadata.setcCs�|�|�}||jkr*|tkr&|�|�}|S|tkr@|j|}|S|tkr�|j|}|dkr^gSg}x6|D].}|tkr�|�|�qh|�|d|df�qhW|S|tkr�|j|}t	|t
�r�|�d�S|j|S)zGet a metadata field.Nrrr�)rlr[�_MISSINGrur�rsr�r;rtr�rr�)rarMrWrG�res�valrrrrh�s.








zLegacyMetadata.getcs
|��gg}}xdD]}||kr|�|�qW|rT|gkrTdd�|�}t|��xdD]}||krZ|�|�qZW|ddkr�||fSt|j���fdd�}xbt|ft�jft	�j
ffD]D\}}x:|D]2}	|�|	d	�}
|
d	k	r�||
�s�|�d
|	|
f�q�Wq�W||fS)zkCheck if the metadata is compliant. If strict is True then raise if
        no Name or Version are provided)rrzmissing required metadata: %sz, )z	Home-pager"zMetadata-Versionz1.2cs*x$|D]}��|�d�d�sdSqWdS)Nr�rFT)r�r�)rGr�)r\rr�are_valid_constraintss
z3LegacyMetadata.check.<locals>.are_valid_constraintsNzWrong value for '%s': %s)r`r;r�rr
r\r�r�r�r�r�rh)ra�strict�missing�warningsrOr�r�rEZ
controllerrPrGr)r\r�check�s2




zLegacyMetadata.checkcCsl|��t|d�}i}xN|D]F}|r0||jkrt|}|dkrN||||<qdd�||D�||<qW|S)aReturn 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).
        This is as per https://www.python.org/dev/peps/pep-0566/#id17.
        zMetadata-VersionZproject_urlcSsg|]}d�|��qS)r�)r�)r+�urrrr�5sz)LegacyMetadata.todict.<locals>.<listcomp>)r`r4r[�_FIELD2ATTR)raZskip_missingrE�datarnrFrrr�todict"s
zLegacyMetadata.todictcCs<|ddkr(xdD]}||kr||=qW|d|7<dS)NzMetadata-Versionz1.1)r%r'r&z
Requires-Distr)ra�requirementsrPrrr�add_requirements9s


zLegacyMetadata.add_requirementscCstt|d��S)NzMetadata-Version)r�r4)rarrrr5DszLegacyMetadata.keysccsx|��D]
}|Vq
WdS)N)r5)rarFrrr�__iter__GszLegacyMetadata.__iter__cs�fdd����D�S)Ncsg|]}�|�qSrr)r+rF)rarrr�Lsz)LegacyMetadata.values.<locals>.<listcomp>)r5)rar)rarr�KszLegacyMetadata.valuescs�fdd����D�S)Ncsg|]}|�|f�qSrr)r+rF)rarrr�Osz(LegacyMetadata.items.<locals>.<listcomp>)r5)rar)rarr:NszLegacyMetadata.itemscCsd|jj|j|jfS)Nz
<%s %s %s>)�	__class__rrMr3)rarrr�__repr__QszLegacyMetadata.__repr__)NNNrW)F)F)F)N)F)F)"rrrrrer`rgrirkrorprlrurzr|r}r~rr]r^rfr�r_rjr�rhr�r�r�r5r�r�r:r�rrrrrV�s>	




,
,
rVzpydist.jsonz
metadata.jsonZMETADATAc@s�eZdZdZe�d�Ze�dej�Ze	Z
e�d�ZdZde
Zdddd	�Zd
ZdZedfedfe
dfedfd�Zd
ZdHdd�Zed�ZdefZdefZdefdefeeedefeeeedefddd�
Z[[dd�ZdIdd�Zdd�Zed d!��Z ed"d#��Z!e!j"d$d#��Z!dJd%d&�Z#ed'd(��Z$ed)d*��Z%e%j"d+d*��Z%d,d-�Z&d.d/�Z'd0d1�Z(d2d3�Z)d4d5d6d7d8d9d:d;d<dd=�
Z*d>d?�Z+dKdBdC�Z,dDdE�Z-dFdG�Z.dS)Lrz�
    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}z2.0zdistlib (%s)r)�legacy)rMr3�summaryzqname 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)rwrMr3r�)�_legacy�_datar\NrWc	Cs0|||g�d�dkrtd��d|_d|_||_|dk	rzy|�||�||_Wn*tk
rvt||d�|_|��YnXn�d}|r�t	|d��}|�
�}WdQRXn|r�|�
�}|dkr�|j|jd�|_ndt
|t�s�|�d�}yt�|�|_|�|j|�Wn0tk
�r*tt|�|d�|_|��YnXdS)NrXz'path, fileobj and mapping are exclusive)rdr\�rb)rw�	generatorzutf-8)rcr\)rYrZr�r�r\�_validate_mappingrrV�validater�r]�METADATA_VERSION�	GENERATORr�r	�decode�json�loads�
ValueErrorr)rarbrcrdr\r�r,rrrre�s<



zMetadata.__init__)rMr3�license�keywordsr�z
Requires-DistzSetup-Requires-DistzProvides-Extrar$)zDownload-URLN)zMetadata-VersionN)
�run_requires�build_requires�dev_requiresZ
test_requires�
meta_requires�extras�modules�
namespaces�exports�commands�classifiers�
source_urlrwc
CsXt�|d�}t�|d�}||k�r||\}}|jr^|dkrP|dkrHdn|�}n|j�|�}n�|dkrjdn|�}|dkr�|j�||�}n�t�}|}|j�d�}	|	�r
|dkr�|	�d|�}nP|dkr�|	�d�}	|	r�|	�||�}n,|	�d	�}	|	s�|j�d	�}	|	�r
|	�||�}||k�rT|}n:||k�r2t�||�}n"|j�rH|j�|�}n|j�|�}|S)
N�common_keys�mapped_keys)r�r�r�r�r��
extensionsr�zpython.commandsr�zpython.detailszpython.exports)�object�__getattribute__r�rhr�)
rarF�common�mapped�lkZmaker�resultrG�sentinel�drrrr��sD




zMetadata.__getattribute__cCsH||jkrD|j|\}}|p |j|krD|�|�}|sDtd||f��dS)Nz.'%s' is an invalid value for the '%s' property)�SYNTAX_VALIDATORSr\�matchr)rarFrGr\�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
k�rt|t	��r|�
�}|�r|��}ng}|j�r||j|<n
||j|<dS)Nr�r�)r�r�r�r�r�r�r�zpython.commandsr�zpython.detailszpython.exportsr�)r�r�r�r��NotImplementedErrorr��
setdefault�__setattr__r�rr�r�)rarFrGr�r�r�rJr�rrrr��s<




zMetadata.__setattr__cCst|j|jd�S)NT)rUrMr3)rarrr�name_and_version%szMetadata.name_and_versioncCsF|jr|jd}n|j�dg�}d|j|jf}||krB|�|�|S)Nz
Provides-Dist�providesz%s (%s))r�r�r�rMr3r;)rar��srrrr�)s
zMetadata.providescCs |jr||jd<n
||jd<dS)Nz
Provides-Distr�)r�r�)rarGrrrr�4sc
Cs�|jr|}n�g}t|pg|j�}xl|D]d}d|kr@d|kr@d}n8d|krNd}n|�d�|k}|rx|�d�}|rxt||�}|r&|�|d�q&WxNdD]F}d|}	|	|kr�|�|	�|j�d|g�}|�|j|||d��q�W|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�environmentT�requires)�build�dev�testz:%s:z%s_requires)r��env)	r�rr�rhr
�extendr<r��get_requirements)
ra�reqtsr�r�r�r��includer7rF�errrr�;s0	




zMetadata.get_requirementscCs|jr|��S|jS)N)r��_from_legacyr�)rarrr�
dictionaryeszMetadata.dictionarycCs|jrt�nt|j|j�SdS)N)r�r�rr��DEPENDENCY_KEYS)rarrr�dependencieskszMetadata.dependenciescCs|jrt�n|j�|�dS)N)r�r�r�r_)rarGrrrr�rsc	Cs�|�d�|jkrt��g}x0|j��D]"\}}||kr&||kr&|�|�q&W|rfdd�|�}t|��x"|��D]\}}|�|||�qpWdS)NrwzMissing metadata items: %sz, )	rhr�r�MANDATORY_KEYSr:r;r�rr�)	rardr\r�rFr�r�r�r�rrrr�yszMetadata._validate_mappingcCsB|jr.|j�d�\}}|s|r>t�d||�n|�|j|j�dS)NTz#Metadata: missing: %s, warnings: %s)r�r�r=r�r�r�r\)rar�r�rrrr��s
zMetadata.validatecCs(|jr|j�d�St|j|j�}|SdS)NT)r�r�rr��
INDEX_KEYS)rar�rrrr��szMetadata.todictc
Cs�|jr|jrt�|j|jd�}|j�d�}x2dD]*}||kr0|dkrJd}n|}||||<q0W|�dg�}|dgkrxg}||d<d	}x2|D]*\}}||kr�||r�d
||ig||<q�W|j|d<i}i}	|S)N)rwr�T)rMr3r�r��description�
classifierr�r�r!�r�))Z
requires_distr�)Zsetup_requires_distr�r�r�)r�r��AssertionErrorr�r�r�rhr�)
rar�Zlmdr��nk�kwr5�ok�author�
maintainerrrrr��s,



zMetadata._from_legacyrrr#rr z	Home-pager"zAuthor-emailzDownload-URL)
rMr3)r�zpython.detailsr�r�r�)r�zpython.projectZproject_urlsZHome)r�zpython.project�contactsrrM)r�zpython.projectrr�emailr�)r�zpython.detailsr�cCs�dd�}|jr|jrt�t�}|j}x�|j��D]v\}}t|t�sX||kr�||||<q0|}d}x8|D]0}y||}Wqftt	fk
r�d}PYqfXqfW|r0|||<q0W||j
|j�}	||j|j
�}
|jr�t|j�|d<t|	�|d<t|
�|d<|S)NcSs�t�}x�|D]�}|�d�}|�d�}|d}x^|D]V}|sJ|sJ|�|�q2d}|rZd|}|rt|rpd||f}n|}|�d�||f��q2WqW|S)Nr�r�r�r�z
extra == "%s"z(%s) and %sr�)rjrh�addr�)�entriesr�r�r�r�Zrlistr�r7rrr�process_entries�s"



z,Metadata._to_legacy.<locals>.process_entriesTFzProvides-Extraz
Requires-DistzSetup-Requires-Dist)r�r�r�rV�LEGACY_MAPPINGr:r�r0rm�
IndexErrorr�r�r�r�r��sorted)rar	r�Znmdrrr��foundr�Zr1Zr2rrr�
_to_legacy�s2

zMetadata._to_legacyFTc	Cs�||g�d�dkrtd��|��|r`|jr4|j}n|��}|rP|j||d�q�|j||d�n^|jrp|��}n|j}|r�t	j
||dddd�n.t�|dd��}t	j
||dddd�WdQRXdS)	Nrz)Exactly one of path and fileobj is needed)r�TrX)Zensure_ascii�indentZ	sort_keysr�zutf-8)
rYr�r�r�rrfr�r�r�r��dumpr�r�)rarbrcr�r�Z	legacy_mdr�r,rrrrf�s&

zMetadata.writecCs�|jr|j�|�nt|j�dg�}d}x"|D]}d|kr,d|kr,|}Pq,W|dkrhd|i}|�d|�n t|d�t|�B}t|�|d<dS)Nr�r�r�r�r)r�r�r�r��insertrjr)rar�r��always�entryZrsetrrrr�
s
zMetadata.add_requirementscCs*|jpd}|jpd}d|jj|j||fS)Nz	(no name)z
no versionz<%s %s %s (%s)>)rMr3r�rrw)rarMr3rrrr�s

zMetadata.__repr__)NNNrW)N)NN)NNFT)/rrrr�re�compileZMETADATA_VERSION_MATCHER�IZNAME_MATCHERrZVERSION_MATCHERZSUMMARY_MATCHERr�rr�r�r�r�r��	__slots__rerjr�r�Z	none_list�dictZ	none_dictr�r�r�r��propertyr�r��setterr�r�r�r�r�r�r�r
rrfr�r�rrrrr[s�


,+

'
*	2
)F)GrZ
__future__rr�rrr�r�rr�rr�compatrrr	r6r
�utilrrr3r
r�	getLoggerrr=rrrr�__all__rrrryrxr.r/r@r*rAr2rCr1rBrjrqr_ZEXTRA_REr4rHrrr:r�r�r�r�rsr�rtr�r�r�rSrUrVZMETADATA_FILENAMEZWHEEL_METADATA_FILENAMEZLEGACY_METADATA_FILENAMErrrrr�<module>	sv










I


j

?>