Skip to content

Commit ba9f8e5

Browse files
committed
Remove unused manylinux functions
1 parent 8e22476 commit ba9f8e5

File tree

2 files changed

+0
-138
lines changed

2 files changed

+0
-138
lines changed

src/pip/_internal/pep425tags.py

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
mac_platforms,
1919
)
2020

21-
import pip._internal.utils.glibc
2221
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
2322

2423
if MYPY_CHECK_RUNNING:
@@ -157,94 +156,6 @@ def get_platform():
157156
return result
158157

159158

160-
def is_linux_armhf():
161-
# type: () -> bool
162-
if get_platform() != "linux_armv7l":
163-
return False
164-
# hard-float ABI can be detected from the ELF header of the running
165-
# process
166-
try:
167-
with open(sys.executable, 'rb') as f:
168-
elf_header_raw = f.read(40) # read 40 first bytes of ELF header
169-
except (IOError, OSError, TypeError):
170-
return False
171-
if elf_header_raw is None or len(elf_header_raw) < 40:
172-
return False
173-
if isinstance(elf_header_raw, str):
174-
elf_header = [ord(c) for c in elf_header_raw]
175-
else:
176-
elf_header = [b for b in elf_header_raw]
177-
result = elf_header[0:4] == [0x7f, 0x45, 0x4c, 0x46] # ELF magic number
178-
result &= elf_header[4:5] == [1] # 32-bit ELF
179-
result &= elf_header[5:6] == [1] # little-endian
180-
result &= elf_header[18:20] == [0x28, 0] # ARM machine
181-
result &= elf_header[39:40] == [5] # ARM EABIv5
182-
result &= (elf_header[37:38][0] & 4) == 4 # EF_ARM_ABI_FLOAT_HARD
183-
return result
184-
185-
186-
def is_manylinux1_compatible():
187-
# type: () -> bool
188-
# Only Linux, and only x86-64 / i686
189-
if get_platform() not in {"linux_x86_64", "linux_i686"}:
190-
return False
191-
192-
# Check for presence of _manylinux module
193-
try:
194-
import _manylinux
195-
return bool(_manylinux.manylinux1_compatible)
196-
except (ImportError, AttributeError):
197-
# Fall through to heuristic check below
198-
pass
199-
200-
# Check glibc version. CentOS 5 uses glibc 2.5.
201-
return pip._internal.utils.glibc.have_compatible_glibc(2, 5)
202-
203-
204-
def is_manylinux2010_compatible():
205-
# type: () -> bool
206-
# Only Linux, and only x86-64 / i686
207-
if get_platform() not in {"linux_x86_64", "linux_i686"}:
208-
return False
209-
210-
# Check for presence of _manylinux module
211-
try:
212-
import _manylinux
213-
return bool(_manylinux.manylinux2010_compatible)
214-
except (ImportError, AttributeError):
215-
# Fall through to heuristic check below
216-
pass
217-
218-
# Check glibc version. CentOS 6 uses glibc 2.12.
219-
return pip._internal.utils.glibc.have_compatible_glibc(2, 12)
220-
221-
222-
def is_manylinux2014_compatible():
223-
# type: () -> bool
224-
# Only Linux, and only supported architectures
225-
platform = get_platform()
226-
if platform not in {"linux_x86_64", "linux_i686", "linux_aarch64",
227-
"linux_armv7l", "linux_ppc64", "linux_ppc64le",
228-
"linux_s390x"}:
229-
return False
230-
231-
# check for hard-float ABI in case we're running linux_armv7l not to
232-
# install hard-float ABI wheel in a soft-float ABI environment
233-
if platform == "linux_armv7l" and not is_linux_armhf():
234-
return False
235-
236-
# Check for presence of _manylinux module
237-
try:
238-
import _manylinux
239-
return bool(_manylinux.manylinux2014_compatible)
240-
except (ImportError, AttributeError):
241-
# Fall through to heuristic check below
242-
pass
243-
244-
# Check glibc version. CentOS 7 uses glibc 2.17.
245-
return pip._internal.utils.glibc.have_compatible_glibc(2, 17)
246-
247-
248159
def get_all_minor_versions_as_strings(version_info):
249160
# type: (Tuple[int, ...]) -> List[str]
250161
versions = []

tests/unit/test_pep425tags.py

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -137,55 +137,6 @@ def test_manual_abi_dm_flags(self):
137137
self.abi_tag_unicode('dm', {'Py_DEBUG': True, 'WITH_PYMALLOC': True})
138138

139139

140-
@pytest.mark.parametrize('is_manylinux_compatible', [
141-
pep425tags.is_manylinux1_compatible,
142-
pep425tags.is_manylinux2010_compatible,
143-
pep425tags.is_manylinux2014_compatible,
144-
])
145-
class TestManylinuxTags(object):
146-
"""
147-
Tests common to all manylinux tags (e.g. manylinux1, manylinux2010,
148-
...)
149-
"""
150-
@patch('pip._internal.pep425tags.get_platform', lambda: 'linux_x86_64')
151-
@patch('pip._internal.utils.glibc.have_compatible_glibc',
152-
lambda major, minor: True)
153-
def test_manylinux_compatible_on_linux_x86_64(self,
154-
is_manylinux_compatible):
155-
"""
156-
Test that manylinuxes are enabled on linux_x86_64
157-
"""
158-
assert is_manylinux_compatible()
159-
160-
@patch('pip._internal.pep425tags.get_platform', lambda: 'linux_i686')
161-
@patch('pip._internal.utils.glibc.have_compatible_glibc',
162-
lambda major, minor: True)
163-
def test_manylinux_compatible_on_linux_i686(self,
164-
is_manylinux_compatible):
165-
"""
166-
Test that manylinuxes are enabled on linux_i686
167-
"""
168-
assert is_manylinux_compatible()
169-
170-
@patch('pip._internal.pep425tags.get_platform', lambda: 'linux_x86_64')
171-
@patch('pip._internal.utils.glibc.have_compatible_glibc',
172-
lambda major, minor: False)
173-
def test_manylinux_2(self, is_manylinux_compatible):
174-
"""
175-
Test that manylinuxes are disabled with incompatible glibc
176-
"""
177-
assert not is_manylinux_compatible()
178-
179-
@patch('pip._internal.pep425tags.get_platform', lambda: 'arm6vl')
180-
@patch('pip._internal.utils.glibc.have_compatible_glibc',
181-
lambda major, minor: True)
182-
def test_manylinux_3(self, is_manylinux_compatible):
183-
"""
184-
Test that manylinuxes are disabled on arm6vl
185-
"""
186-
assert not is_manylinux_compatible()
187-
188-
189140
class TestManylinux2010Tags(object):
190141

191142
@pytest.mark.parametrize("manylinux2010,manylinux1", [

0 commit comments

Comments
 (0)