Updated version parsing to include all variants

parent f63c6e77
......@@ -16,12 +16,15 @@ _usedep_re = re.compile("^" + usedep_re + "$")
op_re = r"(?P<B>(!!))?(?P<OP>([<>]=?|[<>=]))?"
cat_re = r"((?P<C>[a-z\-]+)/)?"
ver_re = r"(\d+)((\.\d+)*)([a-z]?)((_(pre|p|beta|alpha|rc)\d*)*)"
rev_re = r"(-(?P<MR>r[0-9]+))?"
repo_re = r"(::(?P<R>.*))?"
_atom_re = re.compile(
op_re
+ cat_re
+ r"(?P<M>(?P<MN>[a-z\-]+)(-(?P<MV>[0-9\.]+))?)"
+ r"(?P<M>(?P<MN>[A-Za-z0-9+_-]+)(-(?P<MV>"
+ ver_re
+ r"))?)"
+ rev_re
+ repo_re
+ r"(\[(?P<USE>.*)\])?$"
......
......@@ -4,8 +4,17 @@ from ..atom import Atom, InvalidAtom
def test_invalid():
with pytest.raises(InvalidAtom):
Atom("foo/bar_baz")
Atom("foo/bar baz")
def test_valid():
Atom("foo/bar-baz-1.0.20.3-r123::foo[-a,b?,!c?,c]")
def test_complex_version():
Atom("foo/bar-1.0a_alpha")
Atom("foo/bar-1.0a_alpha12")
Atom("foo/bar-1.0a_pre1")
Atom("foo/bar-1.0a_beta2")
Atom("foo/bar-1.0a_rc1")
Atom("foo/bar-1.0a_p1")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment