comparison pytools/gl.py @ 3691:b054dd61bfe1

Made gl script able to import and use the mx script.
author Doug Simon <doug.simon@oracle.com>
date Wed, 23 Nov 2011 18:11:28 +0100
parents 61f10abeb25a
children 4a76e44544d9
comparison
equal deleted inserted replaced
3690:f8d7ab42c479 3691:b054dd61bfe1
54 54
55 def __init__(self): 55 def __init__(self):
56 self.dacapo = os.getenv('DACAPO') 56 self.dacapo = os.getenv('DACAPO')
57 self.jdk7 = os.getenv('JDK7') 57 self.jdk7 = os.getenv('JDK7')
58 self.maxine = os.getenv('MAXINE') 58 self.maxine = os.getenv('MAXINE')
59 self._mx = None
59 60
60 ArgumentParser.__init__(self, prog='gl') 61 ArgumentParser.__init__(self, prog='gl')
61 62
62 self.add_argument('-v', action='store_true', dest='verbose', help='enable verbose output') 63 self.add_argument('-v', action='store_true', dest='verbose', help='enable verbose output')
63 self.add_argument('--dacapo', help='path to DaCapo 9.12 jar file', metavar='<path>') 64 self.add_argument('--dacapo', help='path to DaCapo 9.12 jar file', metavar='<path>')
193 194
194 def abort(self, code): 195 def abort(self, code):
195 """ raises a SystemExit exception with the provided exit code """ 196 """ raises a SystemExit exception with the provided exit code """
196 raise SystemExit(code) 197 raise SystemExit(code)
197 198
199 def mx(self):
200 if (self._mx is None):
201 p = join(self.maxine, 'com.oracle.max.shell')
202 sys.path.insert(0, p)
203 import mx
204 self._mx = mx.Env()
205 self._mx.maxine_home = self.maxine
206 self._mx.parse_cmd_line([])
207 return self._mx
208
198 def main(env): 209 def main(env):
199 configFile = join(dirname(sys.argv[0]), 'glrc') 210 configFile = join(dirname(sys.argv[0]), 'glrc')
200 env.load_config_file(configFile) 211 env.load_config_file(configFile)
201 env.parse_cmd_line(configFile) 212 env.parse_cmd_line(configFile)
202 213