� ��abc@@sqdZddlmZddlZddlZddlZddlZddlZyddlZWn e k r�ddl jZnXddl Z ddl mZddlZeje�Zejd�Zd�Zd�Zd�Zd �Zd �Zeed �Zd �Zd �Zd�Zd�Z d�Z!de#dddd�Z$e$�Z%e$de�Z&e�Z'dS(s2Generate and work with PEP 425 Compatibility Tags.i(tabsolute_importN(t OrderedDicts(.+)_(\d+)_(\d+)_(.+)cC@sEytj|�SWn-tk r@}tjdj|�t�dSXdS(Ns{0}(t sysconfigtget_config_vartIOErrortwarningstwarntformattRuntimeWarningtNone(tvarte((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyRs cC@sUttd�rd}n9tjjd�r3d}ntjdkrKd}nd}|S(s'Return abbreviated implementation name.tpypy_version_infotpptjavatjytclitiptcp(thasattrtsystplatformt startswith(tpyimpl((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyt get_abbr_impl!s   cC@sDtd�}| s"t�dkr@djttt���}n|S(sReturn implementation version.tpy_version_nodotR t(RRtjointmaptstrtget_impl_version_info(timpl_ver((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyt get_impl_ver.s cC@sKt�dkr/tjdtjjtjjfStjdtjdfSdS(sQReturn sys.version_info-like tuple for use in decrementing the minor version.R iiN(RRt version_infoR tmajortminor(((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyR6s cC@sdjt�t��S(s; Returns the Tag for this specific implementation. s{0}{1}(RRR (((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyt get_impl_tagAscC@sBt|�}|dkr8|r1tjd|�n|�S||kS(sgUse a fallback method for determining SOABI flags if the needed config var is unset or unavailable.s>Config variable '%s' is unset, Python ABI tag may be incorrectN(RR tloggertdebug(R tfallbacktexpectedRtval((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pytget_flagHs    c @sgtd�}t��| r�dkrttd�rd}d}d}tdd�d�dk�rpd }ntd �fd �d�dk�r�d }ntd d�ddd�dko�tjdk�r�tjdkr�d}nd�t�|||f}n\|r6|jd�r6d|jd�d}n-|r]|j dd�j dd�}nd}|S(sXReturn the ABI tag based on SOABI (if available) or emulate SOABI (CPython 2, PyPy).tSOABIRR t maxunicodeRtPy_DEBUGcS@s ttd�S(Ntgettotalrefcount(RR(((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyt^RRtdt WITH_PYMALLOCc@s �dkS(NR(((timpl(s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyR/bRtmtPy_UNICODE_SIZEcS@s tjdkS(Ni��(RR,(((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyR/fRR(iitus %s%s%s%s%sscpython-t-it.t_(RR (ii(iiN( RRRRR*R!R RtsplittreplaceR (tsoabiR0R3R5tabi((R2s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyt get_abi_tagTs8  "      !cC@s tjdkS(Ni���(Rtmaxsize(((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyt_is_running_32bitvscC@s�tjdkr�tj�\}}}|jd�}|dkrQt�rQd}n|dkrot�rod}ndj|d|d |�Stjj�j dd �j d d �}|d kr�t�r�d }n|S(s0Return our platform name 'win32', 'linux_x86_64'tdarwinR7tx86_64ti386tppc64tppcsmacosx_{0}_{1}_{2}iiR8R6t linux_x86_64t linux_i686( RRtmac_verR9R?Rt distutilstutilt get_platformR:(treleaseR8tmachinet split_vertresult((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyRJzs  ' cC@s`t�dkrtSyddl}t|j�SWnttfk rInXtjj j dd�S(NRERFiii(RERF( RJtFalset _manylinuxtbooltmanylinux1_compatiblet ImportErrortAttributeErrortpiptutilstglibcthave_compatible_glibc(RP((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pytis_manylinux1_compatible�s c@s�g}��fd��tdd fdd fdd fd dfg���|||�rj|j|�nx@�D]8}|�|krq�|||�rq|j|�qqqqW|jd �|S(s�Return a list of supported arches (including group arches) for the given major, minor and machine architecture of an macOS machine. c@s�|dkr||fdkS|dkr8||fd kS|dkrT||fd kS|dkrp||fd kS|�kr�x+�|D]}�|||�r�tSq�WntS( NRDi iRCRBiRA(i i(i i(i i(i i(tTrueRO(R"R#tarchtgarch(t_supports_archtgroups(s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyR]�s      tfatRBRDtintelRAtfat64RCtfat32t universal(RBRD(RARB(RARC(RARBRD(Rtappend(R"R#RLtarchesR\((R]R^s2/usr/lib/python2.7/site-packages/pip/pep425tags.pytget_darwin_arches�s$    " cC@s�g}|dkrug}t�}|d }xGt|ddd�D],}|jdjtt||f���qBWn|p�t�}g} |p�t�}|r�|g| dd+nt �} ddl } xK| j �D]=} | dj d�r�| j | djdd�d�q�q�W| jtt| ���| jd �|s0|pMt�} | j d �rtj| �}|r|j�\}}}}d j||�}g}xjttt|�d��D]@}x7tt|�||�D]}|j|||f�q�Wq�WqM| g}n9|dkrDt�rD| jd d �| g}n | g}xC| D];}x2|D]*} |jd||df|| f�qaWqTWxd|dD]X}|dkr�Pnx?| D]7}x.|D]&} |jd||f|| f�q�Wq�Wq�Wx3|D](} |jd|ddd | f�qWn|jd||dfd df�|jd||ddfd df�xdt|�D]V\}}|jd|fd df�|dkr�|jd|dd df�q�q�W|S(scReturn a list of supported tags for each version specified in `versions`. :param versions: a list of string versions, of the form ["33", "32"], or None. The first version will be assumed to support our ABI. :param platform: specify the exact platform you want valid tags for, or None. If None, use the local system platform. :param impl: specify the exact implementation you want valid tags for, or None. If None, use the local interpreter impl. :param abi: specify the exact abi you want valid tags for, or None. If None, use the local interpreter abi. i����RiNs.abiR7iitnonetmacosxs {0}_{1}_%i_%stlinuxt manylinux1s%s%st31t30spy%stany(RkRl(R RtrangeRdRRRRR=tsettimpt get_suffixesRtaddR9textendtsortedtlistRJt _osx_arch_pattmatchR^RtreversedtintRfRYR:t enumerate(tversionstnoarchRR2R<t supportedR!R"R#tabistabi3sRptsuffixR[Rwtnamet actual_archttplReR3tatversionti((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyt get_supported�sh   -  ( #"    ,   , )$( %R|((t__doc__t __future__RtreRRRtloggingRRStdistutils.sysconfigtdistutils.utilRHt pip.compatRtpip.utils.glibcRUt getLoggert__name__R%tcompileRvRRR RR$RZR*R=R?RJRYRfR ROR�tsupported_tagstsupported_tags_noarchtimplementation_tag(((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyts>            "    = ^