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
  • Loading branch information
dhiltonp committed Nov 24, 2020
1 parent bf30ca6 commit 8976f1e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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
6 changes: 5 additions & 1 deletion tests/installation/test_chooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from packaging.tags import Tag

from poetry.core.packages.package import Package
from poetry.installation.chooser import Chooser
from poetry.installation.chooser import Chooser, 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 +196,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 8976f1e

Please sign in to comment.