Skip to content
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

Prefer wheels over source distribution #6547

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions src/poetry/repositories/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,18 @@ def _get_info_from_sdist(self, url: str) -> PackageInfo:
return PackageInfo.from_sdist(filepath)

def _get_info_from_urls(self, urls: dict[str, list[str]]) -> PackageInfo:
# Checking wheels first as they are more likely to hold
# the necessary information
if "bdist_wheel" in urls:
# Check for a universal wheel
wheels = urls["bdist_wheel"]

# Prefer to read data from wheels: this is faster and more reliable
wheels = urls.get("bdist_wheel")
if wheels:
# We ought just to be able to look at any of the available wheels to read
# metadata, they all should give the same answer.
#
# In practice this hasn't always been true.
#
# Most of the code in here is to deal with cases such as isort 4.3.4 which
# published separate python3 and python2 wheels with quite different
# dependencies. We try to detect such cases and combine the data from the
# two wheels into what ought to have been published in the first place...
universal_wheel = None
universal_python2_wheel = None
universal_python3_wheel = None
Expand Down Expand Up @@ -195,9 +201,9 @@ def _get_info_from_urls(self, urls: dict[str, list[str]]) -> PackageInfo:
if universal_python2_wheel:
return self._get_info_from_wheel(universal_python2_wheel)

if platform_specific_wheels and "sdist" not in urls:
# Pick the first wheel available and hope for the best
return self._get_info_from_wheel(platform_specific_wheels[0])
if platform_specific_wheels:
first_wheel = platform_specific_wheels[0]
return self._get_info_from_wheel(first_wheel)

return self._get_info_from_sdist(urls["sdist"][0])

Expand Down