Skip to content

Commit

Permalink
Add python 2.x abi tag support
Browse files Browse the repository at this point in the history
  • Loading branch information
ewang committed Mar 11, 2016
1 parent 9e4e0c1 commit 0b1e5fd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
10 changes: 7 additions & 3 deletions pex/pep425.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
14 changes: 13 additions & 1 deletion tests/test_pep425.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

0 comments on commit 0b1e5fd

Please sign in to comment.