MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / wheel_name_match

Method wheel_name_match

pipcl.py:965–1008  ·  view source on GitHub ↗

Returns true if `wheel` matches our wheel. We basically require the name to be the same, except that we accept platform tags that contain extra items (see pep-0600/), for example we return true with: self: foo-cp38-none-manylinux2014_x86_64.whl whe

(self, wheel)

Source from the content-addressed store, hash-verified

963 return ret
964
965 def wheel_name_match(self, wheel):
966 '''
967 Returns true if `wheel` matches our wheel. We basically require the
968 name to be the same, except that we accept platform tags that contain
969 extra items (see pep-0600/), for example we return true with:
970
971 self: foo-cp38-none-manylinux2014_x86_64.whl
972 wheel: foo-cp38-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
973 '''
974 log2(f'{wheel=}')
975 assert wheel.endswith('.whl')
976 wheel2 = wheel[:-len('.whl')]
977 name, version, tag_python, tag_abi, tag_platform = wheel2.split('-')
978
979 py_limited_api_compatible = False
980 if self.py_limited_api and tag_abi == 'abi3':
981 # Allow lower tag_python number.
982 m = re.match('cp([0-9]+)', tag_python)
983 tag_python_int = int(m.group(1))
984 m = re.match('cp([0-9]+)', self.tag_python())
985 tag_python_int_self = int(m.group(1))
986 if tag_python_int <= tag_python_int_self:
987 # This wheel uses Python stable ABI same or older than ours, so
988 # we can use it.
989 log2(f'py_limited_api; {tag_python=} compatible with {self.tag_python()=}.')
990 py_limited_api_compatible = True
991
992 log2(f'{_normalise2(self.name) == name=}')
993 log2(f'{self.version == version=}')
994 log2(f'{self.tag_python() == tag_python=} {self.tag_python()=} {tag_python=}')
995 log2(f'{py_limited_api_compatible=}')
996 log2(f'{self.tag_abi() == tag_abi=}')
997 log2(f'{self.tag_platform() in tag_platform.split(".")=}')
998 log2(f'{self.tag_platform()=}')
999 log2(f'{tag_platform.split(".")=}')
1000 ret = (1
1001 and _normalise2(self.name) == name
1002 and self.version == version
1003 and (self.tag_python() == tag_python or py_limited_api_compatible)
1004 and self.tag_abi() == tag_abi
1005 and self.tag_platform() in tag_platform.split('.')
1006 )
1007 log2(f'Returning {ret=}.')
1008 return ret
1009
1010 def _entry_points_text(self):
1011 if self.entry_points:

Callers 1

build_wheelFunction · 0.80

Calls 5

tag_pythonMethod · 0.95
tag_abiMethod · 0.95
tag_platformMethod · 0.95
log2Function · 0.85
_normalise2Function · 0.85

Tested by

no test coverage detected