Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3ada01f
Convert return values in pep425tags.get_supported
chrahunt Nov 23, 2019
d386bb2
Copy get_supported into packaging.tags-like functions
chrahunt Nov 23, 2019
54db17c
Use _cpython_tags, _generic_tags, and _compatible_tags
chrahunt Nov 23, 2019
1c8c481
Only calculate py-compatible tags in one place
chrahunt Nov 23, 2019
480911b
Remove unused abi arg from _compatible_tags
chrahunt Nov 23, 2019
4659a78
Use packaging.tags.compatible_tags
chrahunt Nov 23, 2019
750abca
Customize python_version for packaging.tags.compatible_tags
chrahunt Nov 23, 2019
72d00dd
Customize interpreter for packaging.tags.compatible_tags
chrahunt Nov 23, 2019
2de0b7c
Customize platforms for packaging.tags.compatible_tags
chrahunt Nov 23, 2019
c514c6b
Make packaging.tags.compatible_tags unconditional
chrahunt Nov 23, 2019
b91286c
Inline packaging.tags.compatible_tags
chrahunt Nov 23, 2019
8f1c60e
Only use _cpython_tags for CPython
chrahunt Nov 23, 2019
e388df6
Remove impl from _cpython_tags
chrahunt Nov 23, 2019
5dbef5d
Use packaging.tags.cpython_tags
chrahunt Nov 23, 2019
147680a
Customize python_version for packaging.tags.cpython_tags
chrahunt Nov 23, 2019
05045e7
Customize abis for packaging.tags.cpython_tags
chrahunt Nov 23, 2019
fecfadb
Customize platforms for packaging.tags.cpython_tags
chrahunt Nov 23, 2019
56840c3
Make packaging.tags.cpython_tags unconditional
chrahunt Nov 23, 2019
1574872
Inline packaging.tags.cpython_tags
chrahunt Nov 23, 2019
fa1ec40
Remove unused abi3 branch in _generic_tags
chrahunt Nov 23, 2019
281273d
Use packaging.tags.generic_tags
chrahunt Nov 23, 2019
77dbd27
Customize interpreter for packaging.tags.generic_tags
chrahunt Nov 23, 2019
0bebeb6
Customize abis for packaging.tags.generic_tags
chrahunt Nov 23, 2019
293b778
Customize platforms for packaging.tags.generic_tags
chrahunt Nov 23, 2019
72dcd34
Make packaging.tags.generic_tags unconditional
chrahunt Nov 23, 2019
3e66ab0
Inline packaging.tags.generic_tags
chrahunt Nov 23, 2019
ad546b5
Remove unnecessary conversion in get_supported
chrahunt Nov 23, 2019
9b34435
Simplify _get_custom_platforms
chrahunt Nov 23, 2019
2455977
Remove unused manylinux auto-deduction functions
chrahunt Nov 23, 2019
7aaa705
Remove unused glibc functions
chrahunt Nov 23, 2019
896317d
Remove unused abi functions
chrahunt Nov 23, 2019
2b1b60f
Remove unused get_platform function
chrahunt Nov 23, 2019
ae21af7
Remove unused version functions
chrahunt Nov 23, 2019
d7fda71
Add news
chrahunt Nov 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use packaging.tags.cpython_tags
We assume this function improves the status quo over the current
`_cpython_tags`, so we use it when no arguments need to be customized.

Since `packaging.tags` has its own tests and derives defaults
differently than pep425tags, we also remove the applicable tests that
were testing against the result of a plain call to
`pep425tags.get_supported()`.
  • Loading branch information
chrahunt committed Jan 7, 2020
commit 5dbef5debecc1677472dcbfa26f76f2db1896af2
6 changes: 5 additions & 1 deletion src/pip/_internal/pep425tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from pip._vendor.packaging.tags import (
Tag,
compatible_tags,
cpython_tags,
interpreter_name,
interpreter_version,
mac_platforms,
Expand Down Expand Up @@ -319,7 +320,10 @@ def _cpython_tags(
platform=None, # type: Optional[str]
abi=None, # type: Optional[str]
):
# type: (...) -> List[Tuple[str, str, str]]
# type: (...) -> Union[Iterator[Tag], List[Tuple[str, str, str]]]
if version is None and platform is None and abi is None:
return cpython_tags()

supported = [] # type: List[Tuple[str, str, str]]

# Versions must be given with respect to the preference
Expand Down
93 changes: 0 additions & 93 deletions tests/unit/test_pep425tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,70 +168,8 @@ def test_manylinux_3(self, is_manylinux_compatible):
assert not is_manylinux_compatible()


class TestManylinux1Tags(object):

@pytest.mark.xfail
@patch('pip._internal.pep425tags.is_manylinux2010_compatible',
lambda: False)
@patch('pip._internal.pep425tags.is_manylinux2014_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)
@patch('sys.platform', 'linux2')
def test_manylinux1_tag_is_first(self):
"""
Test that the more specific tag manylinux1 comes first.
"""
groups = {}
for tag in pep425tags.get_supported():
groups.setdefault(
(tag.interpreter, tag.abi), []
).append(tag.platform)

for arches in groups.values():
if arches == ['any']:
continue
# Expect the most specific arch first:
if len(arches) == 3:
assert arches == ['manylinux1_x86_64', 'linux_x86_64', 'any']
else:
assert arches == ['manylinux1_x86_64', 'linux_x86_64']


class TestManylinux2010Tags(object):

@pytest.mark.xfail
@patch('pip._internal.pep425tags.is_manylinux2014_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)
@patch('sys.platform', 'linux2')
def test_manylinux2010_tag_is_first(self):
"""
Test that the more specific tag manylinux2010 comes first.
"""
groups = {}
for tag in pep425tags.get_supported():
groups.setdefault(
(tag.interpreter, tag.abi), []
).append(tag.platform)

for arches in groups.values():
if arches == ['any']:
continue
# Expect the most specific arch first:
if len(arches) == 4:
assert arches == ['manylinux2010_x86_64',
'manylinux1_x86_64',
'linux_x86_64',
'any']
else:
assert arches == ['manylinux2010_x86_64',
'manylinux1_x86_64',
'linux_x86_64']

@pytest.mark.parametrize("manylinux2010,manylinux1", [
("manylinux2010_x86_64", "manylinux1_x86_64"),
("manylinux2010_i686", "manylinux1_i686"),
Expand All @@ -255,37 +193,6 @@ def test_manylinux2010_implies_manylinux1(self, manylinux2010, manylinux1):

class TestManylinux2014Tags(object):

@pytest.mark.xfail
@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_manylinux2014_tag_is_first(self):
"""
Test that the more specific tag manylinux2014 comes first.
"""
groups = {}
for tag in pep425tags.get_supported():
groups.setdefault(
(tag.interpreter, tag.abi), []
).append(tag.platform)

for arches in groups.values():
if arches == ['any']:
continue
# Expect the most specific arch first:
if len(arches) == 5:
assert arches == ['manylinux2014_x86_64',
'manylinux2010_x86_64',
'manylinux1_x86_64',
'linux_x86_64',
'any']
else:
assert arches == ['manylinux2014_x86_64',
'manylinux2010_x86_64',
'manylinux1_x86_64',
'linux_x86_64']

@pytest.mark.parametrize("manylinuxA,manylinuxB", [
("manylinux2014_x86_64", ["manylinux2010_x86_64",
"manylinux1_x86_64"]),
Expand Down