handle versions like 1.*.*

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2017-07-07 23:45:13 +02:00
parent 67ca805fda
commit 600c75796f
2 changed files with 12 additions and 0 deletions

View file

@ -85,6 +85,8 @@ class Dependency(object):
if "*" in s and s != "*": if "*" in s and s != "*":
# XXX: https://github.com/rbarrois/python-semanticversion/issues/51 # XXX: https://github.com/rbarrois/python-semanticversion/issues/51
s = "~{}".format(s.replace(".*", "", 1)) s = "~{}".format(s.replace(".*", "", 1))
if ".*" in s:
s = s.replace(".*", "")
spec = semver.Spec(s.replace(" ", "")) spec = semver.Spec(s.replace(" ", ""))
parsed = [] parsed = []
for req in spec.specs: for req in spec.specs:

10
test.py
View file

@ -210,6 +210,16 @@ def cargo_toml(request):
""", """,
["crate(hello) = 0.0.0"], ["crate(hello) = 0.0.0"],
["(crate(libc) >= 1.2.0 with crate(libc) < 1.3.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 # Inequality requirements
(""" ("""