Fix for using Python 2.4
[gem5.git] / python / m5 / __init__.py
1 import sys, os
2
3 # the mpy import code is added to the global import meta_path as a
4 # side effect of this import
5 from mpy_importer import AddToPath, LoadMpyFile
6
7 # define this here so we can use it right away if necessary
8 def panic(string):
9 print >>sys.stderr, 'panic:', string
10 sys.exit(1)
11
12 # find the m5 compile options: must be specified as a dict in
13 # __main__.m5_build_env.
14 import __main__
15 if 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
19 import smartdict
20 build_env = smartdict.SmartDict()
21 build_env.update(__main__.m5_build_env)
22
23 # make a SmartDict out of the OS environment too
24 env = smartdict.SmartDict()
25 env.update(os.environ)
26
27 # import the main m5 config code
28 from config import *
29 config.add_param_types(config)
30
31 # import the built-in object definitions
32 from objects import *
33 config.add_param_types(objects)
34
35 cpp_classes = config.MetaSimObject.cpp_classes
36 cpp_classes.sort()
37