-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix cache bug with legacy cache entries #7490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix unrelease bug from #7319. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,11 +138,13 @@ def _get_candidates(self, link, canonical_package_name): | |
| candidates = [] | ||
| path = self.get_path_for_link(link) | ||
| if os.path.isdir(path): | ||
| candidates.extend(os.listdir(path)) | ||
| for candidate in os.listdir(path): | ||
| candidates.append((candidate, path)) | ||
| # TODO remove legacy path lookup in pip>=21 | ||
| legacy_path = self.get_path_for_link_legacy(link) | ||
| if os.path.isdir(legacy_path): | ||
| candidates.extend(os.listdir(legacy_path)) | ||
| for candidate in os.listdir(legacy_path): | ||
| candidates.append((candidate, legacy_path)) | ||
| return candidates | ||
|
|
||
| def get_path_for_link_legacy(self, link): | ||
|
|
@@ -167,13 +169,6 @@ def get( | |
| """ | ||
| raise NotImplementedError() | ||
|
|
||
| def _link_for_candidate(self, link, candidate): | ||
| # type: (Link, str) -> Link | ||
| root = self.get_path_for_link(link) | ||
| path = os.path.join(root, candidate) | ||
|
|
||
| return Link(path_to_url(path)) | ||
|
|
||
| def cleanup(self): | ||
| # type: () -> None | ||
| pass | ||
|
|
@@ -228,7 +223,9 @@ def get( | |
| return link | ||
|
|
||
| canonical_package_name = canonicalize_name(package_name) | ||
| for wheel_name in self._get_candidates(link, canonical_package_name): | ||
| for wheel_name, wheel_dir in self._get_candidates( | ||
| link, canonical_package_name | ||
| ): | ||
| try: | ||
| wheel = Wheel(wheel_name) | ||
| except InvalidWheelFilename: | ||
|
|
@@ -245,13 +242,18 @@ def get( | |
| # Built for a different python/arch/etc | ||
| continue | ||
| candidates.append( | ||
| (wheel.support_index_min(supported_tags), wheel_name) | ||
| ( | ||
| wheel.support_index_min(supported_tags), | ||
| wheel_name, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: it's unlikely that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At least this is equivalent to the previous behavior. Alternatively, we may want to separately consider whether an sdist may produce a wheel with "build tag" that should be taken into account even in the cache. |
||
| wheel_dir, | ||
| ) | ||
| ) | ||
|
|
||
| if not candidates: | ||
| return link | ||
|
|
||
| return self._link_for_candidate(link, min(candidates)[1]) | ||
| _, wheel_name, wheel_dir = min(candidates) | ||
| return Link(path_to_url(os.path.join(wheel_dir, wheel_name))) | ||
|
|
||
|
|
||
| class EphemWheelCache(SimpleWheelCache): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.