Skip to content

Commit

Permalink
normalized sdist names
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby committed Sep 25, 2022
1 parent aee025e commit 614ac5a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/poetry/publishing/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import requests

from poetry.core.masonry.metadata import Metadata
from poetry.core.masonry.utils.helpers import escape_name
from poetry.core.masonry.utils.helpers import distribution_name
from requests import adapters
from requests.exceptions import ConnectionError
from requests.exceptions import HTTPError
Expand Down Expand Up @@ -77,11 +77,10 @@ def adapter(self) -> adapters.HTTPAdapter:
def files(self) -> list[Path]:
dist = self._poetry.file.parent / "dist"
version = self._package.version.to_string()
escaped_name = distribution_name(self._package.name)

wheels = list(
dist.glob(f"{escape_name(self._package.pretty_name)}-{version}-*.whl")
)
tars = list(dist.glob(f"{self._package.pretty_name}-{version}.tar.gz"))
wheels = list(dist.glob(f"{escaped_name}-{version}-*.whl"))
tars = list(dist.glob(f"{escaped_name}-{version}.tar.gz"))

return sorted(wheels + tars)

Expand Down Expand Up @@ -301,7 +300,8 @@ def _register(self, session: requests.Session, url: str) -> requests.Response:
Register a package to a repository.
"""
dist = self._poetry.file.parent / "dist"
file = dist / f"{self._package.name}-{self._package.version.to_string()}.tar.gz"
escaped_name = distribution_name(self._package.name)
file = dist / f"{escaped_name}-{self._package.version.to_string()}.tar.gz"

if not file.exists():
raise RuntimeError(f'"{file.name}" does not exist.')
Expand Down
4 changes: 2 additions & 2 deletions tests/console/commands/test_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_publish_dry_run_skip_existing(
error = app_tester.io.fetch_error()

assert "Publishing simple-project (1.2.3) to PyPI" in output
assert "- Uploading simple-project-1.2.3.tar.gz" in error
assert "- Uploading simple_project-1.2.3.tar.gz" in error
assert "- Uploading simple_project-1.2.3-py2.py3-none-any.whl" in error


Expand All @@ -125,4 +125,4 @@ def test_skip_existing_output(
assert exit_code == 0

error = app_tester.io.fetch_error()
assert "- Uploading simple-project-1.2.3.tar.gz File exists. Skipping" in error
assert "- Uploading simple_project-1.2.3.tar.gz File exists. Skipping" in error

0 comments on commit 614ac5a

Please sign in to comment.