Your IP : 216.73.216.213


Current Path : /opt/alt/python310/lib/python3.10/site-packages/wheel/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib/python3.10/site-packages/wheel/__pycache__/metadata.cpython-310.pyc

o

��a��@s\dZddlZddlZddlZddlmZdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�ZdS)z2
Tools for converting old- to new-style metadata.
�N�)�
read_pkg_infocCsRt|dd�rd|jSg}|jD]\}}|�||�q|s dSdd�t|��S)zFReturn the version specifier for a requirement in PEP 345/566 fashion.�urlNz @ �z (%s)�,)�getattrr�specs�append�join�sorted)�requirementZ
requires_dist�op�ver�r�A/opt/alt/python310/lib/python3.10/site-packages/wheel/metadata.py�requires_to_requires_dist
s
rccsP�|D]"}tj�|�}t|�}d�t|j��}|rd|}|j||VqdS)z=Yield Requires-Dist: strings for parsed requirements strings.rz[%s]N)�
pkg_resources�Requirement�parserr
r�extras�project_name)�requirements�reqZparsed_requirement�specrrrr�convert_requirementss��rccs��|��D]D\}}d}|pd}d|vr|�dd�\}}t�|�}|r5d|fV|r/d|d}|d|7}|r;d|}t|�D]	}d	||fVq?qd
S)a,
    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.
    r�:r�Provides-Extra�(z) and z
extra == '%s'z ; �
Requires-DistN)�items�splitr�
safe_extrar)�extras_require�extra�depends�	conditionZnew_reqrrr�generate_requirements%s$�

��r&cCs�t|�}|�dd�|d=|d=tj�|d�}tj�|�r^t|��}|��}Wd�n1s0wYtt	�
|�dd�d	�}|D]\}}t||i�D]\}	}
|	|
f|��vr\|
||	<qLqB|d
}|rn|�
t|��|d
=|S)zN
    Convert .egg-info directory with PKG-INFO to the Metadata 2.1 format
    zMetadata-Versionz2.1rrzrequires.txtNcSs|dpdS)Nrrr)�xrrr�<lambda>Psz%pkginfo_to_metadata.<locals>.<lambda>)�key�Description)r�replace_header�os�pathr
�exists�open�readrr�split_sectionsr&r�set_payload�dedent_description)Z
egg_info_pathZpkginfo_path�pkg_infoZ
requires_pathZ
requires_file�requiresZparsed_requirementsr#�reqsr)�value�descriptionrrr�pkginfo_to_metadataAs.

�
���r9cCsX||}|��}t|t�s*|��D]}|d��|kr)|d�dd��d�}|Sq|S)z<Hack to coax Unicode out of an email Message() - Python 3.3+rr�ascii�surrogateescapezutf-8)�lower�
isinstance�str�	raw_items�encode�decode)r4�field�text�itemrrr�pkginfo_unicode^s
��rEc
Csr|d}d}t|t�sd}t|d�}|��}d�|d��t�d�|dd���df�}|r7|�d��	d	d
�}|S)z@
    Dedent and convert pkg_info['Description'] to Unicode.
    r*FT�
rrN�utf8r:r;)
r=r>rE�
splitlinesr
�lstrip�textwrap�dedentr@rA)r4r8Z
surrogatesZdescription_linesZdescription_dedentrrrr3ls$


���r3)
�__doc__�os.pathr,rJrZpkginforrrr&r9rEr3rrrr�<module>s