There is a way to tell the difference, but first let me provide a little
background ...
IronPython is released as signed binaries, and in order to maintain binary
compatibility (for example for the customer who writes an application that
relies on particular version of IronPython binaries, but then wants to simply
replace IronPython 1.0 binaries with 1.0.1 binaries without having to recompile
his application) the assembly version is identical with the assembly version of
the 1.0 release. However, we added some more assembly-level attributes which
can be used to tell the difference between versions. They are
AssemblyInformationVersionAttribute and AssemblyFileVersionAttribute. Note that
they are not present on the 1.0 assemblies.
Unfortunately, due to a omission/bug, one of them
(AssemblyInformationVersionAttribute) still reads "1.0" on the 1.0.1
assemblies, but the other (AssemblyFileVersionAttribute) changes with each
build of IronPython and its version for 1.0.1 release is:
1.0.61005.1977
Now, how can I find out which version I am running?
import System
a =
[].GetType().Assembly.GetCustomAttributes(System.Reflection.AssemblyFileVersionAttribute,
False)
if len(a) > 0:
if a[0].Version == "1.0.61005.1977": print "IronPython 1.0.1"
else: print "Unknown version"
else:
print "IronPython 1.0"
Hope this helps and sorry for the confusion with
AssemblyInformationVersionAttribute. It'll be fixed in the next release.
Martin
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sylvain
Hellegouarch
Sent: Tuesday, October 10, 2006 1:07 AM
To: Discussion of IronPython
Cc: Discussion of IronPython
Subject: Re: [IronPython] IronPython 1.0.1 Released!
I could not agree more. If people are two write Python packages which
could run in both environment they may need to differentiate both in some
cases (like import statements of assemblies which would fail with
CPython).
This is quite an important piece of information and I was so surprised to
see sys.version returning my CPython major version number (because it does
not set the minor version number either).
Thanks,
- Sylvain
> I notice the format of sys.version has changed. Since sys.version_info
> lies, and sys.subversion isn't supported, could this please not be
> changed so much?
>
> Old:
> IronPython 1.0.2453 on .NET 2.0.50727.42
> New:
> IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42
>
> On another related matter, there really is no useful way to ask "what
> version of IronPython is the user running" that I can see. Ideally,
> IronPython would also support sys.subversion in some way, at least -
> even if it has to synthesise the values. But *please* don't just copy
> the sys.subversion values from CPython - actually make it relevant to
> the IronPython release!
>
> Python 2.5 (r25:51908, Sep 19 2006, 14:29:31)
> [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> t>>> import sys
>>>> sys.subversion
> ('CPython', 'tags/r25', '51908')
>>>>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com