AcademySoftwareFoundation / rez

An integrated package configuration, build and deployment system for software
https://rez.readthedocs.io
Apache License 2.0
941 stars 335 forks source link

_VersionRangeParser regex don't match `range_desc` example #1786

Open doubleailes opened 3 months ago

doubleailes commented 3 months ago

_VersionRangeParser regex don't match range_desc example see the "To Reproduce"section.

Environment

To Reproduce

from rez.version._version import _VersionRangeParser, AlphanumericVersionToken

parser = _VersionRangeParser("<=2.0.0,1.0.0+",make_token=AlphanumericVersionToken)
print(parser._groups)

Expected behavior returning something like this {'range_desc': '<=2.0.0,1.0.0+', 'range_upper_desc': '<=2.0.0', 'range_upper_desc_prefix': '<=', 'range_upper_desc_version': '2.0.0', 'range_lower_desc': '1.0.0+', 'range_lower_desc_prefix': None, 'range_lower_desc_version': '1.0.0'}

Actual behavior

Traceback (most recent call last):
  File "xxx/python/test_regex.py", line 16, in <module>
    parser = _VersionRangeParser("<=2.0.0,1.0.0+",True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "xxx/.venv/lib/python3.11/site-packages/rez/version/_version.py", line 684, in __init__
    raise ParseException("Syntax error in version range '%s'" % part)
rez.version._util.ParseException: Syntax error in version range '<=2.0.0,1.0.0+'
JeanChristopheMorinPerso commented 3 months ago

Hi @doubleailes, do you have more context around this? This class is not public and should not be used directly.

doubleailes commented 3 months ago

Hi @JeanChristopheMorinPerso ,

I was benching some part of Rez. And just found this error(?). No more context, than me messing around.

JeanChristopheMorinPerso commented 3 months ago

Ok thanks for th additional info. I'll keep it open for a while, but I don't have the time to investigate if it's normal or not. Because it's an internal class and nobody has reported issues with public facing functions and classes, it's highly likely that it'll never be fixed (if it's a bug).