[IronPython] IronPython 1.0.1 Released!
Martin.Maly at microsoft.com
Wed Oct 11 17:34:34 CEST 2006
I am sorry, this is a simple miscommunication. I am not suggesting that this is (and always will be) the way to check for IronPython's version. I only provided this temporary solution for people who absolutely must be able to tell the difference between 1.0 and 1.0.1 for simply there is no other good way to tell at this point. Of course, apart from making this (I admit not ideal) solution available now, we must find something better, something which will fit nicely with the Python model of providing version information. The script below, or probably looking for substrings in sys.version:
1.0: sys.version == 'IronPython 1.0.60816 on .NET 2.0.50727.42'
1.0.1: sys.version == 'IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42'
are just about the only way to tell (for now) between 1.0 and 1.0.1. Note that our sys.version_info reports (2, 4, 0, 'final', 0) to express compatibility with CPython 2.4) and that in the absence of sys.subversion. We can certainly add the sys.subversion in the nearest release, but it will be solution going forward, unfortunately not available for 1.0 and 1.0.1 where - sadly - we don't have anything as clean as that available.
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Anthony Baxter
Sent: Tuesday, October 10, 2006 11:50 PM
To: Discussion of IronPython
Subject: Re: [IronPython] IronPython 1.0.1 Released!
> import System
> a = .GetType().Assembly.GetCustomAttributes(System.Reflection.AssemblyFileVersionAttribute, False)
> if len(a) > 0:
> if a.Version == "1.0.61005.1977": print "IronPython 1.0.1"
> else: print "Unknown version"
> print "IronPython 1.0"
Er - what? This isn't even close to a good approach. How on earth can
I make code that uses this forward-compatible? Any code I write using
this will need to be updated for IronPython1.1, and whenever there is
a subsequent version.
Please, please at least support sys.subversion to identify the
version. I'm thinking something like
('IronPython', 'tags/1.0.1', '61005') or the like.
CPython 2.5 is currently
('CPython', 'tags/r25', '51908')
Right now, there is no easy way (aside from parsing sys.version) to
say "is this code running on CPython or IronPython." And, as I started
this thread, the format of sys.version changed from 1.0 to 1.0.1.
I'd be open to suggesting some other attribute in sys - but it really
does need to be in sys. If there was something like
"sys.implementation" I could see we could add that to CPython as well.
(But see note below about CPython release schedule)
As far as sys.version_info claiming to be Python 2.4 - I can sort of
understand that from a pragmatic point of view. But it leaves me with
a bad feeling - it's all too similar to almost every http client
identifying themselves as "Mozilla 4.0 (Actual Browser Name Here)".
The basic problem is that the stuff we have now was designed really
for a world where all Python implementations shared a common concept
of "version" - that is, Jython 2.2 is feature-compatible with CPython
2.2. It's possible that needs to be addressed, although given we just
did CPython 2.5, we're not going to be able to change it for CPython
for a good 18 months (the approximate timeframe for a 2.6).
users mailing list
users at lists.ironpython.com
More information about the Ironpython-users