[Python-checkins] python/dist/src/Lib platform.py,1.5.8.4,1.5.8.5
gvanrossum at users.sourceforge.net
gvanrossum at users.sourceforge.net
Wed May 5 19:58:05 EDT 2004
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21284
Modified Files:
Tag: release23-maint
platform.py
Log Message:
Merge all fixes from Python 2.4. This includes:
1.12
Added more Windows version names (thanks to Thomas Heller).
Fixed bug in platform() cache (thanks to Brett Cannon).
1.10,1.11
Fixed a caching bug in platform.platform() where the argument of 'terse' was
not taken into consideration when caching value.
Index: platform.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v
retrieving revision 1.5.8.4
retrieving revision 1.5.8.5
diff -C2 -d -r1.5.8.4 -r1.5.8.5
*** platform.py 4 May 2004 18:18:23 -0000 1.5.8.4
--- platform.py 5 May 2004 23:58:03 -0000 1.5.8.5
***************
*** 32,36 ****
#
# History:
! # 1.0.2 - fix a bug with caching of value for platform()
# 1.0.1 - reformatted to make doc.py happy
# 1.0.0 - reformatted a bit and checked into Python CVS
--- 32,36 ----
#
# History:
! # 1.0.2 - added more Windows support
# 1.0.1 - reformatted to make doc.py happy
# 1.0.0 - reformatted a bit and checked into Python CVS
***************
*** 458,462 ****
--- 458,466 ----
# XXX Is there any way to find out the processor type on WinXX ?
# XXX Is win32 available on Windows CE ?
+ #
# Adapted from code posted by Karl Putland to comp.lang.python.
+ #
+ # The mappings between reg. values and release names can be found
+ # here: http://msdn.microsoft.com/library/en-us/sysinfo/base/osversioninfo_str.asp
# Import the needed APIs
***************
*** 480,485 ****
if min == 0:
release = '95'
! else:
release = '98'
elif maj == 5:
release = '2000'
--- 484,493 ----
if min == 0:
release = '95'
! elif min == 10:
release = '98'
+ elif min == 90:
+ release = 'Me'
+ else:
+ release = 'postMe'
elif maj == 5:
release = '2000'
***************
*** 489,493 ****
release = 'NT'
elif maj == 5:
! release = '2000'
else:
if not release:
--- 497,508 ----
release = 'NT'
elif maj == 5:
! if min == 0:
! release = '2000'
! elif min == 1:
! release = 'XP'
! elif min == 2:
! release = '2003Server'
! else:
! release = 'post2003'
else:
if not release:
***************
*** 1137,1144 ****
### The Opus Magnum of platform strings :-)
! _platform_cache_terse = None
! _platform_cache_not_terse = None
! _platform_aliased_cache_terse = None
! _platform_aliased_cache_not_terse = None
def platform(aliased=0, terse=0):
--- 1152,1156 ----
### The Opus Magnum of platform strings :-)
! _platform_cache = {}
def platform(aliased=0, terse=0):
***************
*** 1161,1175 ****
"""
! global _platform_cache_terse, _platform_cache_not_terse
! global _platform_aliased_cache_terse, _platform_aliased_cache_not_terse
!
! if not aliased and terse and (_platform_cache_terse is not None):
! return _platform_cache_terse
! elif not aliased and not terse and (_platform_cache_not_terse is not None):
! return _platform_cache_not_terse
! elif terse and _platform_aliased_cache_terse is not None:
! return _platform_aliased_cache_terse
! elif not terse and _platform_aliased_cache_not_terse is not None:
! return _platform_aliased_cache_not_terse
# Get uname information and then apply platform specific cosmetics
--- 1173,1179 ----
"""
! result = _platform_cache.get((aliased, terse), None)
! if result is not None:
! return result
# Get uname information and then apply platform specific cosmetics
***************
*** 1227,1241 ****
platform = _platform(system,release,machine,processor,bits,linkage)
! if aliased and terse:
! _platform_aliased_cache_terse = platform
! elif aliased and not terse:
! _platform_aliased_cache_not_terse = platform
! elif terse:
! pass
! else:
! if terse:
! _platform_cache_terse = platform
! else:
! _platform_cache_not_terse = platform
return platform
--- 1231,1235 ----
platform = _platform(system,release,machine,processor,bits,linkage)
! _platform_cache[(aliased, terse)] = platform
return platform
More information about the Python-checkins
mailing list