Skip to content

Commit

Permalink
allow Wheel to work when no version is specified in filename
Browse files Browse the repository at this point in the history
See #3411
  • Loading branch information
dhiltonp committed Nov 24, 2020
1 parent bf30ca6 commit c6c7519
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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")

0 comments on commit c6c7519

Please sign in to comment.