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

[1.2] don't use normalize_version() #6550

Merged
merged 1 commit into from
Sep 17, 2022
Merged
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
14 changes: 3 additions & 11 deletions src/poetry/publishing/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

from poetry.core.masonry.metadata import Metadata
from poetry.core.masonry.utils.helpers import escape_name
from poetry.core.masonry.utils.helpers import escape_version
from poetry.core.utils.helpers import normalize_version
from requests import adapters
from requests.exceptions import ConnectionError
from requests.exceptions import HTTPError
Expand Down Expand Up @@ -78,13 +76,10 @@ def adapter(self) -> adapters.HTTPAdapter:
@property
def files(self) -> list[Path]:
dist = self._poetry.file.parent / "dist"
version = normalize_version(self._package.version.text)
version = self._package.version.to_string()

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

Expand Down Expand Up @@ -305,10 +300,7 @@ 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}-{normalize_version(self._package.version.text)}.tar.gz" # noqa: E501
)
file = dist / f"{self._package.name}-{self._package.version.to_string()}.tar.gz"

if not file.exists():
raise RuntimeError(f'"{file.name}" does not exist.')
Expand Down
3 changes: 1 addition & 2 deletions tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from typing import Any

from poetry.core.masonry.utils.helpers import escape_name
from poetry.core.masonry.utils.helpers import escape_version
from poetry.core.packages.package import Package
from poetry.core.packages.utils.link import Link
from poetry.core.toml.file import TOMLFile
Expand Down Expand Up @@ -237,7 +236,7 @@ def find_links_for_package(self, package: Package) -> list[Link]:
return [
Link(
f"https://foo.bar/files/{escape_name(package.name)}"
f"-{escape_version(package.version.text)}-py2.py3-none-any.whl"
f"-{package.version.to_string()}-py2.py3-none-any.whl"
)
]

Expand Down