David Fraser wrote: > Martin Maly wrote: > >> 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. >> >> > What about sys.version? Surely this doesn't have to depend on the > assembly version, in which case it could return values as suggested > earlier in the thread... > There is lots of code in the wild which uses sys.version (and sys.version_info) to determine the availability of Python features. Changing this could break things.
I would recommend a new attribute on the sys module to provide this information. Which could be a shortcut for the monstrosity recommended previously ;-) Fuzzyman http://www.voidspace.org.uk/python/weblog/arch_IronPython.shtml > David > _______________________________________________ > users mailing list > [email protected] > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.407 / Virus Database: 268.13.1/469 - Release Date: 09/10/2006 _______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
