-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IronPython parsing of sys.version #1667
Comments
@eendebakpt Thanks for checking! The regular expression currently in CPython is no longer correct for IronPython. In fact, even the check for IronPython further down in
The current diff with CPython is as follows: _ironpython_sys_version_parser = re.compile(
- r'IronPython\s*'
- r'([\d\.]+)'
- r'(?: \(([\d\.]+)\))?'
- r' on (.NET [\d\.]+)', re.ASCII)
-
-# IronPython covering 2.6 and 2.7
-_ironpython26_sys_version_parser = re.compile(
- r'([\d.]+)\s*'
- r'\(IronPython\s*'
- r'[\d.]+\s*'
- r'\(([\d.]+)\) on ([\w.]+ [\d.]+(?: \(\d+-bit\))?)\)'
-)
+ r'([\w.+]+)\s*' # "version<space>"
+ r'(?: DEBUG)?\s*' # DEBUG - IronPython DEBUG builds only
+ r'\(([^,]+)\)\s*' # "(fileversion)<space>"
+ r'\[([^\]]+)\]?') # "[compiler]" - if 'IronPython' in sys_version:
+ if sys.implementation.name == "ironpython":
# IronPython
name = 'IronPython'
- if sys_version.startswith('IronPython'):
- match = _ironpython_sys_version_parser.match(sys_version)
- else:
- match = _ironpython26_sys_version_parser.match(sys_version)
-
+ match = _ironpython_sys_version_parser.match(sys_version)
if match is None:
raise ValueError(
'failed to parse IronPython sys.version: %s' %
repr(sys_version))
- version, alt_version, compiler = match.groups()
+ version, _, _ = match.groups()
buildno = ''
builddate = ''
+ compiler = '' |
@slozier Thanks for the info. Given the fact that the regular expressions in the current cpython main do not work, what should we do with the ironpython parsing in cpython? Three options: i) leave as it is, ii) remove the ironpython version parsing iii) update with the expressions above. Is ironpython still using the platform.py from current cpython repo (or expected to use in the near future)? |
@eendebakpt While I would love to take option iii, given how far behind we are (ipy's stdlib is based off 3.4) I don't expect us to be using cpython's main any time soon (and things may change by the time we get there). So that leaves options i and ii. It seems to me like option i serves no one (other than requiring no additional effort). So option ii is probably best (as long as it doesn't close the door on getting ipy in there if we ever catch up). |
Thanks, let's go with option 2 then. But I'm perfectly happy with option 3 if you want it and the door is always open — all you need to do is ask :-) |
Description
In python/cpython#102492 the IronPyhon 2.x version parsing is removed. We are wondering whether the other regular expression parsing a version tag, e.g. https://github.com/python/cpython/pull/102492/files#diff-cb1ba6039236dca71c97ea898f2798c60262c30614192862259889f839e4d503L1043-L1048 is still correct and relevant for ironpython as there is a difference with the one in current ironpython git:
ironpython3/Src/StdLib/Lib/platform.py
Line 1141 in f41afc4
@slozier
The text was updated successfully, but these errors were encountered: