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

Incorrect version comparison when updating from vcs tag #174

Closed
timobrembeck opened this issue Mar 7, 2022 · 2 comments · Fixed by #175
Closed

Incorrect version comparison when updating from vcs tag #174

timobrembeck opened this issue Mar 7, 2022 · 2 comments · Fixed by #175

Comments

@timobrembeck
Copy link
Contributor

The version check in _update_cfg_from_vcs() just does a regular string comparison, which does not work when the version numbers are not zero-padded:

if latest_version_tag <= cfg.current_version:

E.g., I use the version pattern YYYY.MM.INC0[-TAG] and have multiple local alpha versions which I don't commit to the vcs, but just use to publish dev versions to test.pypi.org. However, this workflow failed today, because the tools thinks that the version from my git tag 2022.3.2 is newer than my local alpha version 2022.3.10a0.

Because "2022.3.9a0" <= "2022.3.2" is False, the previous build succeeded and "2022.3.10a0" <= "2022.3.2" is True, it does not allow me to bump my version any further than that and sets the version back to 2022.3.3-alpha, which causes pypi to fail because this version already exists.

I would really appreciate any help and would also try to fix this if you point me into the right direction.

@mbarkhau
Copy link
Owner

mbarkhau commented Mar 7, 2022

Good catch. You can have a look at the function parse_version(version: str) -> typ.Any.

So you might be able to change that line:

- if latest_version_tag <= cfg.current_version: 
+ if version.parse_version(latest_version_tag) <= version.parse_version(cfg.current_version): 

@mbarkhau
Copy link
Owner

mbarkhau commented Mar 11, 2022

Uploaded to pypi 2022.1116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants