From 0b1e5fdd1b6f33bd7ab1828c986c40e384dbb9e9 Mon Sep 17 00:00:00 2001 From: Eric Wang Date: Thu, 10 Mar 2016 19:17:03 -0800 Subject: [PATCH] Add python 2.x abi tag support --- pex/pep425.py | 10 +++++++--- tests/test_pep425.py | 14 +++++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/pex/pep425.py b/pex/pep425.py index 6689f6ec7..a859b13d0 100644 --- a/pex/pep425.py +++ b/pex/pep425.py @@ -99,15 +99,19 @@ def _iter_supported_tags(cls, impl, version, platform): """ # Predict soabi for reasonable interpreters. This is technically wrong but essentially right. abis = [] - if impl == 'cp' and version.startswith('3'): + if impl == 'cp' and (version.startswith('2') or version.startswith('3')): abis.extend([ 'cp%s' % version, 'cp%sdmu' % version, 'cp%sdm' % version, 'cp%sdu' % version, 'cp%sd' % version, 'cp%smu' % version, 'cp%sm' % version, - 'cp%su' % version, - 'abi3' + 'cp%su' % version ]) + if version.startswith('3'): + abis.extend([ + 'abi3' + ]) + major_version = int(version[0]) minor_versions = [] for minor in range(int(version[1]), -1, -1): diff --git a/tests/test_pep425.py b/tests/test_pep425.py index 87caedde7..1b8ca36fb 100644 --- a/tests/test_pep425.py +++ b/tests/test_pep425.py @@ -46,6 +46,18 @@ def iter_solutions(): for interp in ('cp', 'py'): for interp_suffix in ('2', '20', '21', '22', '23', '24', '25', '26'): for platform in ('linux_x86_64', 'any'): - yield (interp + interp_suffix, 'none', platform) + abis = ['none'] + + if interp == 'cp' and interp_suffix == '26' and platform == 'linux_x86_64': + abis.extend([ + 'cp%s' % interp_suffix, + 'cp%sdmu' % interp_suffix, 'cp%sdm' % interp_suffix, + 'cp%sdu' % interp_suffix, 'cp%sd' % interp_suffix, + 'cp%smu' % interp_suffix, 'cp%sm' % interp_suffix, + 'cp%su' % interp_suffix + ]) + + for abi in abis: + yield (interp + interp_suffix, abi, platform) assert set(PEP425.iter_supported_tags(identity, platform)) == set(iter_solutions())