Current File : //lib/python3.9/site-packages/pip/_internal/utils/__pycache__/packaging.cpython-39.pyc
a

[��f��@s�ddlZddlZddlmZddlmZddlmZmZddl	m
Z
ddlmZm
Z
ddlmZddlmZdd	lmZdd
lmZe�e�Zeeeedfed�d
d�Zeed�dd�Zeed�dd�Zejdd�eed�dd��Z dS)�N)�Message)�
FeedParser)�Optional�Tuple)�
pkg_resources)�
specifiers�version��Requirement)�Distribution)�NoneMetadataError)�display_path.)�requires_python�version_info�returncCs4|durdSt�|�}t�d�tt|���}||vS)a�
    Check if the given Python version matches a "Requires-Python" specifier.

    :param version_info: A 3-tuple of ints representing a Python
        major-minor-micro version to check (e.g. `sys.version_info[:3]`).

    :return: `True` if the given Python version satisfies the requirement.
        Otherwise, return `False`.

    :raises InvalidSpecifier: If `requires_python` has an invalid format.
    NT�.)rZSpecifierSetr�parse�join�map�str)rrZrequires_python_specifierZpython_version�r�A/usr/lib/python3.9/site-packages/pip/_internal/utils/packaging.py�check_requires_pythons

r)�distrcCs�d}t|tj�r&|�|�r&|�|�}n0|�d�r@d}|�|�}nt�dt|j��d}|durht	||��t
�}|�|�|��S)z�
    :raises NoneMetadataError: if the distribution reports `has_metadata()`
        True but `get_metadata()` returns None.
    ZMETADATAzPKG-INFOzNo metadata found in %s�N)
�
isinstancerZDistInfoDistribution�has_metadata�get_metadata�loggerZwarningr
�locationrrZfeed�close)rZ
metadata_name�metadataZfeed_parserrrrr)s�


rcCs2|�d�r.|�d�D]}|��r|��SqdS)NZ	INSTALLERr)rZget_metadata_lines�strip)r�linerrr�
get_installerDs

r$i)�maxsize)�
req_stringrcCst|�S)z5Construct a packaging.Requirement object with cachingr	)r&rrr�get_requirementLsr')!�	functoolsZloggingZ
email.messagerZemail.parserr�typingrrZpip._vendorrZpip._vendor.packagingrrZ"pip._vendor.packaging.requirementsr
Zpip._vendor.pkg_resourcesrZpip._internal.exceptionsrZpip._internal.utils.miscr
Z	getLogger�__name__rr�int�boolrrr$�	lru_cacher'rrrr�<module>s$
�