diff --git a/tconfpy.py b/tconfpy.py index 54fc0b3..f0da44b 100755 --- a/tconfpy.py +++ b/tconfpy.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "tconfpy" -RCSID = "$Id: tconfpy.py,v 1.157 2004/04/02 08:04:52 tundra Exp $" +RCSID = "$Id: tconfpy.py,v 1.158 2004/04/02 08:59:43 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -33,8 +33,9 @@ #----------------------------------------------------------# import os +import platform import re -import sys +from sys import platform as sysplat #----------------------------------------------------------# @@ -78,9 +79,14 @@ # Pre-Defined System Symbols PREDEFINTRO = '.' -PLATFORM = PREDEFINTRO + "PLATFORM" -OSNAME = PREDEFINTRO + "OSNAME" -PYTHONVERSION = PREDEFINTRO + "PYTHONVERSION" + +Predefined = {PREDEFINTRO + "PLATFORM" : sysplat, + PREDEFINTRO + "OSDETAILS" : platform.platform(), + PREDEFINTRO + "OSNAME" : platform.system(), + PREDEFINTRO + "OSRELEASE" : platform.release(), + PREDEFINTRO + "PYTHONVERSION" : platform.python_version(), + PREDEFINTRO + "MACHINENAME" : platform.node() + } # Control and conditional symbols @@ -219,15 +225,10 @@ # Add the predefined symbols -v = sys.version_info - -for var, val in ((PLATFORM, sys.platform), - (OSNAME, os.name), - (PYTHONVERSION,"%s.%s.%s" % (v[0], v[1], v[2])) - ): +for var in Predefined.keys(): d = VarDescriptor() - d.Value = val + d.Value = Predefined[var] d.Writeable = False SymTable[var] = d @@ -1222,12 +1223,15 @@ if __name__ == '__main__': + # Print program information print BANNER - for var in (PLATFORM, OSNAME, PYTHONVERSION): + # Print things we know about the environment + pk = Predefined.keys() + pk.sort() + for var in pk: - val = SymTable[var].Value - + val = Predefined[var] print "%s%s%s" % (var, (20-len(var)) * " ", val)