fix macos wheel selection and add tests for it
This commit is contained in:
parent
ffd51659df
commit
9856807769
2 changed files with 25 additions and 19 deletions
|
@ -284,11 +284,11 @@ class WheelDependencyProvider(DependencyProviderBase):
|
|||
)
|
||||
elif self.system == "darwin":
|
||||
self.preferred_wheels = (
|
||||
re.compile(rf".*(py{maj}|cp{maj}){min}?[\.-].*-({cp_abi}|abi3|none)-macosx_\d*_\d*_universal"),
|
||||
re.compile(rf".*(py{maj}|cp{maj}){min}?[\.-].*-({cp_abi}|abi3|none)-macosx_\d*_\d*_x86_64"),
|
||||
re.compile(rf".*(py{maj}|cp{maj}){min}?[\.-].*-({cp_abi}|abi3|none)-macosx_\d*_\d*_intel"),
|
||||
re.compile(rf".*(py{maj}|cp{maj}){min}?[\.-].*-({cp_abi}|abi3|none)-macosx_\d*_\d*_(fat64|fat32)"),
|
||||
re.compile(rf".*(py{maj}|cp{maj}){min}?[\.-].*-({cp_abi}|abi3|none)-any"),)
|
||||
re.compile(rf".*(py{maj}|cp{maj}){min}?[\.-].*({cp_abi}|abi3|none)-macosx_\d*_\d*_universal"),
|
||||
re.compile(rf".*(py{maj}|cp{maj}){min}?[\.-].*({cp_abi}|abi3|none)-macosx_\d*_\d*_x86_64"),
|
||||
re.compile(rf".*(py{maj}|cp{maj}){min}?[\.-].*({cp_abi}|abi3|none)-macosx_\d*_\d*_intel"),
|
||||
re.compile(rf".*(py{maj}|cp{maj}){min}?[\.-].*({cp_abi}|abi3|none)-macosx_\d*_\d*_(fat64|fat32)"),
|
||||
re.compile(rf".*(py{maj}|cp{maj}){min}?[\.-].*({cp_abi}|abi3|none)-any"),)
|
||||
else:
|
||||
raise Exception(f"Unsupported Platform {platform.system()}")
|
||||
|
||||
|
|
|
@ -5,23 +5,29 @@ from mach_nix.data.providers import WheelRelease
|
|||
from mach_nix.versions import PyVer
|
||||
|
||||
|
||||
@pytest.mark.parametrize("expected, py_ver, wheel_fn", [
|
||||
@pytest.mark.parametrize("expected, py_ver, wheel_fn, system, platform", [
|
||||
# with multiple versions
|
||||
(False, '2.7.0', 'PyQt5-5.15.1-5.15.1-cp35.cp36.cp37-abi3-manylinux2014_x86_64.whl'),
|
||||
(False, '3.4.0', 'PyQt5-5.15.1-5.15.1-cp35.cp36.cp37-abi3-manylinux2014_x86_64.whl'),
|
||||
(True, '3.5.0', 'PyQt5-5.15.1-5.15.1-cp35.cp36.cp37-abi3-manylinux2014_x86_64.whl'),
|
||||
(True, '3.6.0', 'PyQt5-5.15.1-5.15.1-cp35.cp36.cp37-abi3-manylinux2014_x86_64.whl'),
|
||||
(True, '3.7.0', 'PyQt5-5.15.1-5.15.1-cp35.cp36.cp37-abi3-manylinux2014_x86_64.whl'),
|
||||
(False, '3.8.0', 'PyQt5-5.15.1-5.15.1-cp35.cp36.cp37-abi3-manylinux2014_x86_64.whl'),
|
||||
(False, '2.7.0', 'PyQt5-5.15.1-5.15.1-cp35.cp36.cp37-abi3-manylinux2014_x86_64.whl', "linux", "x86_64"),
|
||||
(False, '3.4.0', 'PyQt5-5.15.1-5.15.1-cp35.cp36.cp37-abi3-manylinux2014_x86_64.whl', "linux", "x86_64"),
|
||||
(True, '3.5.0', 'PyQt5-5.15.1-5.15.1-cp35.cp36.cp37-abi3-manylinux2014_x86_64.whl', "linux", "x86_64"),
|
||||
(True, '3.6.0', 'PyQt5-5.15.1-5.15.1-cp35.cp36.cp37-abi3-manylinux2014_x86_64.whl', "linux", "x86_64"),
|
||||
(True, '3.7.0', 'PyQt5-5.15.1-5.15.1-cp35.cp36.cp37-abi3-manylinux2014_x86_64.whl', "linux", "x86_64"),
|
||||
(False, '3.8.0', 'PyQt5-5.15.1-5.15.1-cp35.cp36.cp37-abi3-manylinux2014_x86_64.whl', "linux", "x86_64"),
|
||||
# none-any wheels for py2 + py3
|
||||
(True, '2.7.0', 'requests-2.24.0-py2.py3-none-any.whl'),
|
||||
(True, '3.8.0', 'requests-2.24.0-py2.py3-none-any.whl'),
|
||||
(False, '4.0.0', 'requests-2.24.0-py2.py3-none-any.whl'),
|
||||
(True, '2.7.0', 'requests-2.24.0-py2.py3-none-any.whl', "linux", "x86_64"),
|
||||
(True, '3.8.0', 'requests-2.24.0-py2.py3-none-any.whl', "linux", "x86_64"),
|
||||
(False, '4.0.0', 'requests-2.24.0-py2.py3-none-any.whl', "linux", "x86_64"),
|
||||
# none-any wheels for py2
|
||||
(True, '2.0.0', 'requests-2.24.0-py2-none-any.whl'),
|
||||
(False, '3.0.0', 'requests-2.24.0-py2-none-any.whl'),
|
||||
(True, '2.0.0', 'requests-2.24.0-py2-none-any.whl', "linux", "x86_64"),
|
||||
(False, '3.0.0', 'requests-2.24.0-py2-none-any.whl', "linux", "x86_64"),
|
||||
|
||||
# darwin
|
||||
(True, '2.0.0', 'requests-2.24.0-py2-none-any.whl', "darwin", "x86_64"),
|
||||
(True, '3.8.0', 'tensorflow-2.3.1-cp38-cp38-macosx_10_14_x86_64.whl', "darwin", "x86_64"),
|
||||
(False, '3.8.0', 'tensorflow-2.3.1-cp35-cp35m-macosx_10_6_intel.whl', "darwin", "x86_64"),
|
||||
(True, '3.5.0', 'tensorflow-2.3.1-cp35-cp35m-macosx_10_6_intel.whl', "darwin", "x86_64"),
|
||||
])
|
||||
def test_select_wheel_for_py_ver(expected, py_ver, wheel_fn):
|
||||
prov = providers.WheelDependencyProvider('', py_ver=PyVer(py_ver), system="linux", platform="x86_64")
|
||||
def test_select_wheel_for_py_ver(expected, py_ver, wheel_fn, system, platform):
|
||||
prov = providers.WheelDependencyProvider('', py_ver=PyVer(py_ver), system=system, platform=platform)
|
||||
w = WheelRelease(*([""] * 3), wheel_fn, *([""] * 3))
|
||||
assert prov._wheel_type_ok(w) == expected
|
||||
|
|
Loading…
Reference in a new issue