Skip to content

Commit

Permalink
cargo: Fix '1.0.45' version conversion
Browse files Browse the repository at this point in the history
The middle 0 was wrongly dropped.
  • Loading branch information
xclaesse committed Jun 10, 2023
1 parent d0c6515 commit eeb0eb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions mesonbuild/cargo/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ def convert(cargo_ver: str) -> T.List[str]:
max_.append(str(int(v_) + 1))
bumped = True
else:
if not (bumped and v_ == '0'):
min_.append(v_)
min_.append(v_)
if not bumped:
max_.append('0')

Expand Down
5 changes: 3 additions & 2 deletions unittests/cargotests.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ def test_cargo_to_meson(self) -> None:
('0.0', ['< 1']),
('0', ['< 1']),
('0.0.5', ['>= 0.0.5', '< 0.0.6']),
('0.5.0', ['>= 0.5', '< 0.6']),
('0.5.0', ['>= 0.5.0', '< 0.6']),
('0.5', ['>= 0.5', '< 0.6']),
('1.0.45', ['>= 1.0.45', '< 2']),

# Caret (Which is the same as unqualified)
('^2', ['>= 2', '< 3']),
Expand All @@ -50,7 +51,7 @@ def test_cargo_to_meson(self) -> None:
('^0.0', ['< 1']),
('^0', ['< 1']),
('^0.0.5', ['>= 0.0.5', '< 0.0.6']),
('^0.5.0', ['>= 0.5', '< 0.6']),
('^0.5.0', ['>= 0.5.0', '< 0.6']),
('^0.5', ['>= 0.5', '< 0.6']),

# Multiple requirements
Expand Down

0 comments on commit eeb0eb3

Please sign in to comment.