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
Remove unused manylinux auto-deduction functions
  • Loading branch information
chrahunt committed Jan 8, 2020
commit 2455977bc86f1732024dfe19e2c72614f27327c9
89 changes: 0 additions & 89 deletions src/pip/_internal/pep425tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
mac_platforms,
)

import pip._internal.utils.glibc
from pip._internal.utils.typing import MYPY_CHECK_RUNNING

if MYPY_CHECK_RUNNING:
Expand Down Expand Up @@ -136,94 +135,6 @@ def get_platform():
return result


def is_linux_armhf():
# type: () -> bool
if get_platform() != "linux_armv7l":
return False
# hard-float ABI can be detected from the ELF header of the running
# process
try:
with open(sys.executable, 'rb') as f:
elf_header_raw = f.read(40) # read 40 first bytes of ELF header
except (IOError, OSError, TypeError):
return False
if elf_header_raw is None or len(elf_header_raw) < 40:
return False
if isinstance(elf_header_raw, str):
elf_header = [ord(c) for c in elf_header_raw]
else:
elf_header = [b for b in elf_header_raw]
result = elf_header[0:4] == [0x7f, 0x45, 0x4c, 0x46] # ELF magic number
result &= elf_header[4:5] == [1] # 32-bit ELF
result &= elf_header[5:6] == [1] # little-endian
result &= elf_header[18:20] == [0x28, 0] # ARM machine
result &= elf_header[39:40] == [5] # ARM EABIv5
result &= (elf_header[37:38][0] & 4) == 4 # EF_ARM_ABI_FLOAT_HARD
return result


def is_manylinux1_compatible():
# type: () -> bool
# 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.manylinux1_compatible)
except (ImportError, AttributeError):
# Fall through to heuristic check below
pass

# Check glibc version. CentOS 5 uses glibc 2.5.
return pip._internal.utils.glibc.have_compatible_glibc(2, 5)


def is_manylinux2010_compatible():
# type: () -> bool
# 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.manylinux2010_compatible)
except (ImportError, AttributeError):
# Fall through to heuristic check below
pass

# Check glibc version. CentOS 6 uses glibc 2.12.
return pip._internal.utils.glibc.have_compatible_glibc(2, 12)


def is_manylinux2014_compatible():
# type: () -> bool
# Only Linux, and only supported architectures
platform = get_platform()
if platform not in {"linux_x86_64", "linux_i686", "linux_aarch64",
"linux_armv7l", "linux_ppc64", "linux_ppc64le",
"linux_s390x"}:
return False

# check for hard-float ABI in case we're running linux_armv7l not to
# install hard-float ABI wheel in a soft-float ABI environment
if platform == "linux_armv7l" and not is_linux_armhf():
return False

# Check for presence of _manylinux module
try:
import _manylinux
return bool(_manylinux.manylinux2014_compatible)
except (ImportError, AttributeError):
# Fall through to heuristic check below
pass

# Check glibc version. CentOS 7 uses glibc 2.17.
return pip._internal.utils.glibc.have_compatible_glibc(2, 17)


def get_all_minor_versions_as_strings(version_info):
# type: (Tuple[int, ...]) -> List[str]
versions = []
Expand Down
49 changes: 0 additions & 49 deletions tests/unit/test_pep425tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,55 +119,6 @@ def test_manual_abi_dm_flags(self):
self.abi_tag_unicode('dm', {'Py_DEBUG': True, 'WITH_PYMALLOC': True})


@pytest.mark.parametrize('is_manylinux_compatible', [
pep425tags.is_manylinux1_compatible,
pep425tags.is_manylinux2010_compatible,
pep425tags.is_manylinux2014_compatible,
])
class TestManylinuxTags(object):
"""
Tests common to all manylinux tags (e.g. manylinux1, manylinux2010,
...)
"""
@patch('pip._internal.pep425tags.get_platform', lambda: 'linux_x86_64')
@patch('pip._internal.utils.glibc.have_compatible_glibc',
lambda major, minor: True)
def test_manylinux_compatible_on_linux_x86_64(self,
is_manylinux_compatible):
"""
Test that manylinuxes are enabled on linux_x86_64
"""
assert is_manylinux_compatible()

@patch('pip._internal.pep425tags.get_platform', lambda: 'linux_i686')
@patch('pip._internal.utils.glibc.have_compatible_glibc',
lambda major, minor: True)
def test_manylinux_compatible_on_linux_i686(self,
is_manylinux_compatible):
"""
Test that manylinuxes are enabled on linux_i686
"""
assert is_manylinux_compatible()

@patch('pip._internal.pep425tags.get_platform', lambda: 'linux_x86_64')
@patch('pip._internal.utils.glibc.have_compatible_glibc',
lambda major, minor: False)
def test_manylinux_2(self, is_manylinux_compatible):
"""
Test that manylinuxes are disabled with incompatible glibc
"""
assert not is_manylinux_compatible()

@patch('pip._internal.pep425tags.get_platform', lambda: 'arm6vl')
@patch('pip._internal.utils.glibc.have_compatible_glibc',
lambda major, minor: True)
def test_manylinux_3(self, is_manylinux_compatible):
"""
Test that manylinuxes are disabled on arm6vl
"""
assert not is_manylinux_compatible()


class TestManylinux2010Tags(object):

@pytest.mark.parametrize("manylinux2010,manylinux1", [
Expand Down