__init__.py revision 1692
1import sys, os 2 3# define this here so we can use it right away if necessary 4def panic(string): 5 print >>sys.stderr, 'panic:', string 6 sys.exit(1) 7 8# Add given directory to system module search path, if it is not 9# already there. 10def AddToPath(path): 11 path = os.path.realpath(path) 12 if os.path.isdir(path) and path not in sys.path: 13 sys.path.append(path) 14 15# find the m5 compile options: must be specified as a dict in 16# __main__.m5_build_env. 17import __main__ 18if not hasattr(__main__, 'm5_build_env'): 19 panic("__main__ must define m5_build_env") 20 21# make a SmartDict out of the build options for our local use 22import smartdict 23build_env = smartdict.SmartDict() 24build_env.update(__main__.m5_build_env) 25 26# make a SmartDict out of the OS environment too 27env = smartdict.SmartDict() 28env.update(os.environ) 29 30# import the main m5 config code 31from config import * 32 33# import the built-in object definitions 34from objects import * 35 36