Incorrect version comparison when updating from vcs tag
timobrembeck opened this issue · 2 comments
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:
Line 668 in 328ef5c
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.
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):