abc@@sqdZddlmZddlZddlZddlZddlZddlZyddlZWn e k rddl jZnXddl Z ddl mZddlZejeZejdZdZdZdZd Zd Zeed Zd Zd ZdZdZ dZ!de#ddddZ$e$Z%e$deZ&eZ'dS(s2Generate and work with PEP 425 Compatibility Tags.i(tabsolute_importN(t OrderedDicts(.+)_(\d+)_(\d+)_(.+)cC@sEytj|SWn-tk r@}tjdj|tdSXdS(Ns{0}(t sysconfigtget_config_vartIOErrortwarningstwarntformattRuntimeWarningtNone(tvarte((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyRs cC@sUttdrd}n9tjjdr3d}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"tdkr@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@sKtdkr/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@sdjttS(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| rdkrttdrd}d}d}tddddkrpd }ntd fd ddkrd }ntd dddddkotjdkrtjdkrd}ndt|||f}n\|r6|jdr6d|jdd}n-|r]|j ddj dd}nd}|S(sXReturn the ABI tag based on SOABI (if available) or emulate SOABI (CPython 2, PyPy).tSOABIRR t maxunicodeRtPy_DEBUGcS@s ttdS(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@stjdkrtj\}}}|jd}|dkrQtrQd}n|dkrotrod}ndj|d|d |Stjjj dd j d d }|d krtrd }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`tdkrtSyddl}t|jSWnttfk rInXtjj j ddS(NRERFiii(RERF( RJtFalset _manylinuxtbooltmanylinux1_compatiblet ImportErrortAttributeErrortpiptutilstglibcthave_compatible_glibc(RP((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pytis_manylinux1_compatibles c@sg}fdtdd fdd fdd fd dfg|||rj|j|nx@D]8}||krq|||rq|j|qqqqW|jd |S(sReturn 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|krx+|D]}|||rtSqWntS( 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_archess$    " cC@sg}|dkrug}t}|d }xGt|dddD],}|jdjtt||fqBWn|pt}g} |pt}|r|g| dd+nt } ddl } xK| j D]=} | dj dr| j | djdddqqW| jtt| | jd |s0|pMt} | j d rtj| }|r|j\}}}}d j||}g}xjttt|dD]@}x7tt|||D]}|j|||fqWqWqM| g}n9|dkrDtrD| jd d | g}n | g}xC| D];}x2|D]*} |jd||df|| fqaWqTWxd|dD]X}|dkrPnx?| D]7}x.|D]&} |jd||f|| fqWqWqWx3|D](} |jd|ddd | fqWn|jd||dfd df|jd||ddfd dfxdt|D]V\}}|jd|fd df|dkr|jd|dd dfqqW|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. iRiNs.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_supportedsh   -  ( #"    ,   , )$( %R|((t__doc__t __future__RtreRRRtloggingRRStdistutils.sysconfigtdistutils.utilRHt pip.compatRtpip.utils.glibcRUt getLoggert__name__R%tcompileRvRRR RR$RZR*R=R?RJRYRfR RORtsupported_tagstsupported_tags_noarchtimplementation_tag(((s2/usr/lib/python2.7/site-packages/pip/pep425tags.pyts>            "    = ^