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

Allow Wheel to work when no version is specified in filename #3411

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion poetry/installation/chooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def __init__(self, filename): # type: (str) -> None

self.filename = filename
self.name = wheel_info.group("name").replace("_", "-")
self.version = wheel_info.group("ver").replace("_", "-")
self.version = wheel_info.group("ver")
if self.version:
self.version = self.version.replace("_", "-")
self.build_tag = wheel_info.group("build")
self.pyversions = wheel_info.group("pyver").split(".")
self.abis = wheel_info.group("abi").split(".")
Expand Down
5 changes: 5 additions & 0 deletions tests/installation/test_chooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from poetry.core.packages.package import Package
from poetry.installation.chooser import Chooser
from poetry.installation.chooser import Wheel
from poetry.repositories.legacy_repository import LegacyRepository
from poetry.repositories.pool import Pool
from poetry.repositories.pypi_repository import PyPiRepository
Expand Down Expand Up @@ -196,3 +197,7 @@ def test_chooser_chooses_distributions_that_match_the_package_hashes(
link = chooser.choose_for(package)

assert "isort-4.3.4.tar.gz" == link.filename


def test_wheel_handles_no_version(env, pool):
Wheel("tiamat-6-py3-none-any.whl")