Skip to content

Commit

Permalink
Rename manylinux2 tag as manylinux2010
Browse files Browse the repository at this point in the history
This reflects the change in the tag name in PEP 571.
  • Loading branch information
wtolson committed May 15, 2018
1 parent 94f3318 commit 8d20689
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion news/5008.feature
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Implement manylinux2 platform tag support. manylinux2 is the successor
Implement manylinux2010 platform tag support. manylinux2010 is the successor
to manylinux1. It allows carefully compiled binary wheels to be installed
on compatible Linux platforms.
14 changes: 7 additions & 7 deletions src/pip/_internal/pep425tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ def is_manylinux1_compatible():
return pip._internal.utils.glibc.have_compatible_glibc(2, 5)


def is_manylinux2_compatible():
def is_manylinux2010_compatible():
# Only Linux, and only x86-64 / i686
if get_platform() not in {"linux_x86_64", "linux_i686"}:
return False

# Check for presence of _manylinux module
try:
import _manylinux
return bool(_manylinux.manylinux2_compatible)
return bool(_manylinux.manylinux2010_compatible)
except (ImportError, AttributeError):
# Fall through to heuristic check below
pass
Expand Down Expand Up @@ -293,13 +293,13 @@ def get_supported(versions=None, noarch=False, platform=None,
else:
# arch pattern didn't match (?!)
arches = [arch]
elif arch.startswith('manylinux2'):
# manylinux1 wheels run on manylinux2 systems.
arches = [arch, arch.replace('manylinux2', 'manylinux1')]
elif arch.startswith('manylinux2010'):
# manylinux1 wheels run on manylinux2010 systems.
arches = [arch, arch.replace('manylinux2010', 'manylinux1')]
elif platform is None:
arches = []
if is_manylinux2_compatible():
arches.append(arch.replace('linux', 'manylinux2'))
if is_manylinux2010_compatible():
arches.append(arch.replace('linux', 'manylinux2010'))
if is_manylinux1_compatible():
arches.append(arch.replace('linux', 'manylinux1'))
arches.append(arch)
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ class TestDownloadPlatformManylinuxes(object):
@pytest.mark.parametrize("platform", [
"linux_x86_64",
"manylinux1_x86_64",
"manylinux2_x86_64",
"manylinux2010_x86_64",
])
def test_download_universal(self, platform, script, data):
"""
Expand All @@ -352,8 +352,8 @@ def test_download_universal(self, platform, script, data):

@pytest.mark.parametrize("wheel_abi,platform", [
("manylinux1_x86_64", "manylinux1_x86_64"),
("manylinux1_x86_64", "manylinux2_x86_64"),
("manylinux2_x86_64", "manylinux2_x86_64"),
("manylinux1_x86_64", "manylinux2010_x86_64"),
("manylinux2010_x86_64", "manylinux2010_x86_64"),
])
def test_download_compatible_manylinuxes(
self, wheel_abi, platform, script, data,
Expand Down
32 changes: 17 additions & 15 deletions tests/unit/test_pep425tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ def test_manual_abi_dm_flags(self):

@pytest.mark.parametrize('is_manylinux_compatible', [
pep425tags.is_manylinux1_compatible,
pep425tags.is_manylinux2_compatible,
pep425tags.is_manylinux2010_compatible,
])
class TestManylinuxTags(object):
"""
Tests common to all manylinux tags (e.g. manylinux1, manylinux2,
Tests common to all manylinux tags (e.g. manylinux1, manylinux2010,
...)
"""
@patch('pip._internal.pep425tags.get_platform', lambda: 'linux_x86_64')
Expand Down Expand Up @@ -166,7 +166,8 @@ def test_manylinux1_3(self, is_manylinux_compatible):

class TestManylinux1Tags(object):

@patch('pip._internal.pep425tags.is_manylinux2_compatible', lambda: False)
@patch('pip._internal.pep425tags.is_manylinux2010_compatible',
lambda: False)
@patch('pip._internal.pep425tags.get_platform', lambda: 'linux_x86_64')
@patch('pip._internal.utils.glibc.have_compatible_glibc',
lambda major, minor: True)
Expand All @@ -189,15 +190,15 @@ def test_manylinux1_tag_is_first(self):
assert arches == ['manylinux1_x86_64', 'linux_x86_64']


class TestManylinux2Tags(object):
class TestManylinux2010Tags(object):

@patch('pip._internal.pep425tags.get_platform', lambda: 'linux_x86_64')
@patch('pip._internal.utils.glibc.have_compatible_glibc',
lambda major, minor: True)
@patch('sys.platform', 'linux2')
def test_manylinux2_tag_is_first(self):
def test_manylinux2010_tag_is_first(self):
"""
Test that the more specific tag manylinux2 comes first.
Test that the more specific tag manylinux2010 comes first.
"""
groups = {}
for pyimpl, abi, arch in pep425tags.get_supported():
Expand All @@ -208,28 +209,29 @@ def test_manylinux2_tag_is_first(self):
continue
# Expect the most specific arch first:
if len(arches) == 4:
assert arches == ['manylinux2_x86_64',
assert arches == ['manylinux2010_x86_64',
'manylinux1_x86_64',
'linux_x86_64',
'any']
else:
assert arches == ['manylinux2_x86_64',
assert arches == ['manylinux2010_x86_64',
'manylinux1_x86_64',
'linux_x86_64']

@pytest.mark.parametrize("manylinux2,manylinux1", [
("manylinux2_x86_64", "manylinux1_x86_64"),
("manylinux2_i686", "manylinux1_i686"),
@pytest.mark.parametrize("manylinux2010,manylinux1", [
("manylinux2010_x86_64", "manylinux1_x86_64"),
("manylinux2010_i686", "manylinux1_i686"),
])
def test_manylinux2_implies_manylinux1(self, manylinux2, manylinux1):
def test_manylinux2010_implies_manylinux1(self, manylinux2010, manylinux1):
"""
Specifying manylinux2 implies manylinux1.
Specifying manylinux2010 implies manylinux1.
"""
groups = {}
for pyimpl, abi, arch in pep425tags.get_supported(platform=manylinux2):
supported = pep425tags.get_supported(platform=manylinux2010)
for pyimpl, abi, arch in supported:
groups.setdefault((pyimpl, abi), []).append(arch)

for arches in groups.values():
if arches == ['any']:
continue
assert arches[:2] == [manylinux2, manylinux1]
assert arches[:2] == [manylinux2010, manylinux1]

0 comments on commit 8d20689

Please sign in to comment.