>>> VersionRange.from_string("vers:nginx/*")
---------------------------------------------------------------------------
InvalidVersion Traceback (most recent call last)
<ipython-input-17-2f9540ab85ba> in <module>
----> 1 VersionRange.from_string("vers:nginx/*")
~/Contrib/vulnerablecode/venv/lib/python3.10/site-packages/univers/version_range.py in from_string(cls, vers)
84 and_constraints = []
85 for constraint in or_constraints.split(","):
---> 86 constraint = VersionConstraint.from_string(
87 string=constraint,
88 version_class=range_class.version_class,
~/Contrib/vulnerablecode/venv/lib/python3.10/site-packages/univers/version_constraint.py in from_string(cls, string, version_class)
97 raise ValueError("Empty version")
98
---> 99 version = version_class(version)
100 return cls(comparator, version)
101
~/Contrib/vulnerablecode/venv/lib/python3.10/site-packages/univers/versions.py in __init__(self, string, normalized_string, value)
5 _inst_dict['normalized_string'] = normalized_string
6 _inst_dict['value'] = value
----> 7 self.__attrs_post_init__()
~/Contrib/vulnerablecode/venv/lib/python3.10/site-packages/univers/versions.py in __attrs_post_init__(self)
57 normalized_string = self.normalize(self.string)
58 if not self.is_valid(normalized_string):
---> 59 raise InvalidVersion(f"{self.string!r} is not a valid {self.__class__!r}")
60
61 # See https://www.attrs.org/en/stable/init.html?#post-init
InvalidVersion: '' is not a valid <class 'univers.versions.SemverVersion'>
This happens because there's no version information available for
*version constraint and yet creation of a version is attempted:https://github.com/nexB/univers/blob/a52ea9900d87ef6cd0ed989bf20a41a794cf39c4/src/univers/version_constraint.py#L99-L100
This can be solved by accepting #10