cargo: Fix '1.0.45' version conversion

The middle 0 was wrongly dropped.
pull/12110/head
Xavier Claessens 1 year ago committed by Xavier Claessens
parent 019a0c38c6
commit ea42d2d019
  1. 3
      mesonbuild/cargo/version.py
  2. 5
      unittests/cargotests.py

@ -80,8 +80,7 @@ def convert(cargo_ver: str) -> T.List[str]:
max_.append(str(int(v_) + 1)) max_.append(str(int(v_) + 1))
bumped = True bumped = True
else: else:
if not (bumped and v_ == '0'): min_.append(v_)
min_.append(v_)
if not bumped: if not bumped:
max_.append('0') max_.append('0')

@ -39,8 +39,9 @@ class CargoVersionTest(unittest.TestCase):
('0.0', ['< 1']), ('0.0', ['< 1']),
('0', ['< 1']), ('0', ['< 1']),
('0.0.5', ['>= 0.0.5', '< 0.0.6']), ('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']), ('0.5', ['>= 0.5', '< 0.6']),
('1.0.45', ['>= 1.0.45', '< 2']),
# Caret (Which is the same as unqualified) # Caret (Which is the same as unqualified)
('^2', ['>= 2', '< 3']), ('^2', ['>= 2', '< 3']),
@ -50,7 +51,7 @@ class CargoVersionTest(unittest.TestCase):
('^0.0', ['< 1']), ('^0.0', ['< 1']),
('^0', ['< 1']), ('^0', ['< 1']),
('^0.0.5', ['>= 0.0.5', '< 0.0.6']), ('^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']), ('^0.5', ['>= 0.5', '< 0.6']),
# Multiple requirements # Multiple requirements

Loading…
Cancel
Save