From 600c75796fb38c28daf30c10df3901f16070c2b6 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 7 Jul 2017 23:45:13 +0200 Subject: [PATCH] handle versions like 1.*.* Signed-off-by: Igor Gnatenko --- rust2rpm/metadata.py | 2 ++ test.py | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py index 9990fca..e163e78 100644 --- a/rust2rpm/metadata.py +++ b/rust2rpm/metadata.py @@ -85,6 +85,8 @@ class Dependency(object): if "*" in s and s != "*": # XXX: https://github.com/rbarrois/python-semanticversion/issues/51 s = "~{}".format(s.replace(".*", "", 1)) + if ".*" in s: + s = s.replace(".*", "") spec = semver.Spec(s.replace(" ", "")) parsed = [] for req in spec.specs: diff --git a/test.py b/test.py index bbe8e4e..c69cbe6 100644 --- a/test.py +++ b/test.py @@ -210,6 +210,16 @@ def cargo_toml(request): """, ["crate(hello) = 0.0.0"], ["(crate(libc) >= 1.2.0 with crate(libc) < 1.3.0)"]), + (""" + [package] + name = "hello" + version = "0.0.0" + + [dependencies] + libc = "1.*.*" + """, + ["crate(hello) = 0.0.0"], + ["(crate(libc) >= 1.0.0 with crate(libc) < 2.0.0)"]), # Inequality requirements ("""