o
    0gT                     @   s   d dl Z d dlmZ d dlmZ d dlmZmZ d dlm	Z	 d dl
mZmZ d dlmZ d dlmZ d d	lmZ e eZd
d Zdd Zdd Zdd ZdS )    N)Message)
FeedParser)OptionalTuple)pkg_resources)
specifiersversion)Distribution)NoneMetadataError)display_pathc                 C   s4   | du rdS t | }tdtt|}||v S )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.)r   SpecifierSetr   parsejoinmapstr)requires_pythonversion_inforequires_python_specifierpython_version r   d/home/www/bk.finsightngr.online/venv20/lib/python3.10/site-packages/pip/_internal/utils/packaging.pycheck_requires_python   s
   
r   c                 C   s   d}t | tjr| |r| |}n| dr d}| |}ntdt| j d}|du r4t	| |t
 }|| | S )z
    :raises NoneMetadataError: if the distribution reports `has_metadata()`
        True but `get_metadata()` returns None.
    METADATAzPKG-INFOzNo metadata found in %s N)
isinstancer   DistInfoDistributionhas_metadataget_metadataloggerwarningr   locationr
   r   feedclose)distmetadata_namemetadatafeed_parserr   r   r   r   &   s   


r   c                 C   s&   t | }|d}|durt|}|S )z_
    Return the "Requires-Python" metadata for a distribution, or None
    if not present.
    zRequires-PythonN)r   getr   )r$   pkg_info_dictr   r   r   r   get_requires_pythonB   s
   
r*   c                 C   s2   |  dr| dD ]}| r|   S q
dS )N	INSTALLERr   )r   get_metadata_linesstrip)r$   liner   r   r   get_installerS   s   
r/   )loggingemail.messager   email.parserr   typingr   r   pip._vendorr   Zpip._vendor.packagingr   r   pip._vendor.pkg_resourcesr	   pip._internal.exceptionsr
   pip._internal.utils.miscr   	getLogger__name__r   r   r   r*   r/   r   r   r   r   <module>   s    
