__init__.py revision 1581
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# the mpy import code is added to the global import meta_path as a 9# side effect of this import 10from mpy_importer import AddToPath, LoadMpyFile 11 12# find the m5 compile options: must be specified as a dict in 13# __main__.m5_build_env. 14import __main__ 15if not hasattr(__main__, 'm5_build_env'): 16 panic("__main__ must define m5_build_env") 17 18# make a SmartDict out of the build options for our local use 19import smartdict 20build_env = smartdict.SmartDict() 21build_env.update(__main__.m5_build_env) 22 23# make a SmartDict out of the OS environment too 24env = smartdict.SmartDict() 25env.update(os.environ) 26 27# import the main m5 config code 28from config import * 29config.add_param_types(config) 30 31# import the built-in object definitions 32from objects import * 33config.add_param_types(objects) 34 35cpp_classes = config.MetaSimObject.cpp_classes 36cpp_classes.sort() 37 38