U
    @vg                     @   sh   d dl Z d dlmZmZ d dlmZ d dlmZ erTd dlm	Z	m
Z
mZ d dlmZ G dd deZdS )	    N)get_supportedversion_info_to_nodot)normalize_version_info)MYPY_CHECK_RUNNING)ListOptionalTuple)Tagc                   @   s*   e Zd ZdZd	ddZdd Zdd ZdS )
TargetPythonzx
    Encapsulates the properties of a Python interpreter one is targeting
    for a package install, download, etc.
    Nc                 C   sf   || _ |dkrtjdd }nt|}dtt|dd }|| _|| _|| _	|| _
|| _d| _dS )a  
        :param platform: A string or None. If None, searches for packages
            that are supported by the current system. Otherwise, will find
            packages that can be built on the platform passed in. These
            packages will only be downloaded for distribution: they will
            not be built locally.
        :param py_version_info: An optional tuple of ints representing the
            Python version information to use (e.g. `sys.version_info[:3]`).
            This can have length 1, 2, or 3 when provided.
        :param abi: A string or None. This is passed to pep425tags.py's
            get_supported() function as is.
        :param implementation: A string or None. This is passed to
            pep425tags.py's get_supported() function as is.
        N   .   )_given_py_version_infosysversion_infor   joinmapstrabiimplementationplatform
py_versionpy_version_info_valid_tags)selfr   r   r   r   r    r   F/tmp/pip-unpacked-wheel-gw11q0wt/pip/_internal/models/target_python.py__init__   s    zTargetPython.__init__c                 C   sZ   d}| j dk	r$ddd | j D }d| jfd|fd| jfd| jfg}d	d
d |D S )zD
        Format the given, non-None attributes for display.
        Nr   c                 s   s   | ]}t |V  qd S )N)r   ).0partr   r   r   	<genexpr>D   s    z,TargetPython.format_given.<locals>.<genexpr>r   r   r   r    c                 s   s&   | ]\}}|d k	rd ||V  qd S )Nz{}={!r})format)r   keyvaluer   r   r   r    N   s   )r   r   r   r   r   )r   display_version
key_valuesr   r   r   format_given=   s    


zTargetPython.format_givenc                 C   sH   | j dkrB| j}|dkrd}nt|}t|| j| j| jd}|| _ | j S )z
        Return the supported PEP 425 tags to check wheel candidates against.

        The tags are returned in order of preference (most preferred first).
        N)versionr   r   impl)r   r   r   r   r   r   r   )r   r   r(   tagsr   r   r   get_tagsS   s    
zTargetPython.get_tags)NNNN)__name__
__module____qualname____doc__r   r'   r+   r   r   r   r   r
      s       
)r
   )r   pip._internal.pep425tagsr   r   pip._internal.utils.miscr   pip._internal.utils.typingr   typingr   r   r   pip._vendor.packaging.tagsr	   objectr
   r   r   r   r   <module>   s   