b63a8b3e27
The VALID_VERSION regex didn't check that the version string was completely valid, only that a prefix of it was. This version ensures the entire string represents a valid version. This makes a few related changes. 1. Make the SEGMENT_REGEX identify *which* arm it matches by what groups are populated, including whether it's a string or int component or a separator all at once. 2. Use the updated regex to parse the input once with a findall rather than twice, once with findall and once with split, since the version components and separators can be distinguished by their group status. 3. Rather than "convert to int, on exception stay string," if the int group is set then convert to int, if not then construct an instance of the VersionStrComponent class 4. VersionStrComponent now implements all of the special string comparison logic as part of its __lt__ and __eq__ methods to deal with infinity versions and also overloads comparison with integers. 5. Version now uses direct tuple comparison since it has no per-element special logic outside the VersionStrComponent class. Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com> |
||
---|---|---|
.. | ||
spack |