wheel: fix `is_compatible` implementation

This commit is contained in:
Benoit Pierre 2019-11-25 11:24:10 +01:00
parent d155aa0d61
commit 926c80f5e8
3 changed files with 11 additions and 1 deletions

View File

@ -0,0 +1 @@
Fix regression in handling wheels compatibility tags.

View File

@ -18,6 +18,7 @@ import pytest
from pkg_resources import Distribution, PathMetadata, PY_MAJOR
from setuptools.extern.packaging.utils import canonicalize_name
from setuptools.extern.packaging.tags import parse_tag
from setuptools.wheel import Wheel
from .contexts import tempdir
@ -571,3 +572,11 @@ def test_wheel_no_dist_dir():
_check_wheel_install(wheel_path, install_dir, None,
project_name,
version, None)
def test_wheel_is_compatible(monkeypatch):
def sys_tags():
for t in parse_tag('cp36-cp36m-manylinux1_x86_64'):
yield t
monkeypatch.setattr('setuptools.wheel.sys_tags', sys_tags)
assert Wheel('onnxruntime-0.1.2-cp36-cp36m-manylinux1_x86_64.whl').is_compatible()

View File

@ -77,7 +77,7 @@ class Wheel:
def is_compatible(self):
'''Is the wheel is compatible with the current platform?'''
supported_tags = set(map(str, sys_tags()))
supported_tags = set((t.interpreter, t.abi, t.platform) for t in sys_tags())
return next((True for t in self.tags() if t in supported_tags), False)
def egg_name(self):