rez icon indicating copy to clipboard operation
rez copied to clipboard

_VersionRangeParser regex don't match `range_desc` example

Open doubleailes opened this issue 1 year ago • 3 comments

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

Environment

  • OS Rocky9.2
  • Rez version 3.1.1
  • Rez python version Python 3.11.9

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+'

doubleailes avatar Jul 02 '24 17:07 doubleailes

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

Hi @JeanChristopheMorinPerso ,

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

doubleailes avatar Jul 05 '24 08:07 doubleailes

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).