On 19.10.2013 12:11, Martin Matusiak wrote:
>
> Attaching a v3 which uses "in" and "startswith".
>
>
> Just for good measure I ran this module on IronPython 1.0 and it fails on import:
>
> - bytes literal: b'(__libc_init)'
> - "if" as infix operator: line 177
> - "unexpected token open": use of "with" context manager on line 334
> - "as" keyword: except OSError as why: line 430
> - ImportError: No module named os. os and subprocess are missing altogether in IronPython 1.0.
>
> That's as far as I looked - there may be other issues still.
>
> So I decided to isolate this one function and see if it works. It fails because re.ASCII does not exist. If I remove that then the function runs and parses its own sys.version correctly.
>
> But it may be a bit of a stretch at this point to stay compatible that far back.
Well, there's a catch here: the trunk version of platform.py is for
Python 3. This does not need to stay backwards compatible to Python 2
(but keeping it close to the Python 2 version helps make merges easier).
Then there's the Python 2.7 version, which receives patches like yours.
This has to stay compatible for Python versions relying on it, which
are in particular older IronPython and Jython versions that don't
ship with their own stdlib.
I think it's ok to use Python 2.4 as the latest version supported
by the Python 2.7 platform.py. The module is used for creating
Python packages and 2.4 is still used by some Zope/Plone installations.
If IronPython 1.0 does not support Python 2.4, we don't need to
support it in the 2.7 version of platform.py.