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

don't use normalize_version() #6476

Merged
merged 2 commits into from
Sep 17, 2022

Conversation

dimbleby
Copy link
Contributor

When you already have a Version in hand, normalize_version(version.text) is a very roundabout way of calling version.to_string(): it re-parses the version text to give you the same Version you already had and then calls to_string() on that.

https://github.com/python-poetry/poetry-core/blob/37cee90a5dd4c7ee2c5ee836216ba813242b3ade/src/poetry/core/utils/helpers.py#L27-L28

Then calling escape_version() on such a version is actually counter-productive, per #6466.

Similar changes can and should be made over in poetry-core, but it should be safe to merge this before that is done.

it's just a complicated way of calling version.to_string()
version.to_string() already gave an escaped version
@dimbleby
Copy link
Contributor Author

test failure is not the usual 3.11 one, but it still looks like noise

@neersighted neersighted added this to the 1.3 milestone Sep 17, 2022
@neersighted neersighted added kind/refactor Pulls that refactor, or clean-up code area/uploader Related to the repository uploader impact/changelog Requires a changelog entry labels Sep 17, 2022
@neersighted neersighted merged commit a14a93d into python-poetry:master Sep 17, 2022
@dimbleby dimbleby deleted the no-normalize-version branch September 17, 2022 15:51
@radoering radoering added impact/backport Requires backport to stable branch backport/1.2 labels Sep 17, 2022
@radoering
Copy link
Member

Requires a backport to avoid deprecation warnings after merging python-poetry/poetry-core#469

poetry-bot bot pushed a commit that referenced this pull request Sep 17, 2022
…#6476)

When you already have a `Version` in hand,
`normalize_version(version.text)` is a very roundabout way of calling
`version.to_string()`: it re-parses the version text to give you the
same `Version` you already had and then calls `to_string()` on that.

https://github.com/python-poetry/poetry-core/blob/37cee90a5dd4c7ee2c5ee836216ba813242b3ade/src/poetry/core/utils/helpers.py#L27-L28

Then calling `escape_version()` on such a version is actually
counter-productive, per #6466.

Similar changes can and should be made over in poetry-core, but it
should be safe to merge this before that is done.

(cherry picked from commit a14a93d)
neersighted pushed a commit that referenced this pull request Sep 17, 2022
…#6476)

When you already have a `Version` in hand,
`normalize_version(version.text)` is a very roundabout way of calling
`version.to_string()`: it re-parses the version text to give you the
same `Version` you already had and then calls `to_string()` on that.

https://github.com/python-poetry/poetry-core/blob/37cee90a5dd4c7ee2c5ee836216ba813242b3ade/src/poetry/core/utils/helpers.py#L27-L28

Then calling `escape_version()` on such a version is actually
counter-productive, per #6466.

Similar changes can and should be made over in poetry-core, but it
should be safe to merge this before that is done.

(cherry picked from commit a14a93d)
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/uploader Related to the repository uploader impact/backport Requires backport to stable branch impact/changelog Requires a changelog entry kind/refactor Pulls that refactor, or clean-up code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants