Avoid double package name canonicalization
@@ -77,19 +77,18 @@ class Cache(object):
return parts
- def _get_candidates(self, link, package_name):
+ def _get_candidates(self, link, canonical_package_name):
# type: (Link, Optional[str]) -> List[Any]
can_not_cache = (
not self.cache_dir or
- not package_name or
+ not canonical_package_name or
not link
)
if can_not_cache:
return []
- canonical_name = canonicalize_name(package_name)
formats = self.format_control.get_allowed_formats(
- canonical_name
+ canonical_package_name
)
if not self.allowed_formats.intersection(formats):
return []
@@ -176,12 +175,12 @@ class SimpleWheelCache(Cache):
return link
canonical_package_name = canonicalize_name(package_name)
- for wheel_name in self._get_candidates(link, package_name):
+ for wheel_name in self._get_candidates(link, canonical_package_name):
try:
wheel = Wheel(wheel_name)
except InvalidWheelFilename:
continue
- if wheel.name != canonical_package_name:
+ if canonicalize_name(wheel.name) != canonical_package_name:
continue
if not wheel.supported(supported_tags):
# Built for a different python/arch/etc
