Mercurial > hg > truffle
comparison mxtool/mx.py @ 4215:a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Fix mx : call the mx_post_parse_cmd_line hook from commands' scripts
OutputParser : cosmetic changes to logged output, return the retcode along yith the parsed output
Add a new Test class representing a sanity check and/or a benchmark
Port dacapo command to use this class, begning work on benchmarks
author | Gilles Duboscq <gilles.m.duboscq@gmail.com> |
---|---|
date | Wed, 04 Jan 2012 13:52:46 +0100 |
parents | 148fa38782e8 |
children | 47f7d91d34cf |
comparison
equal
deleted
inserted
replaced
4213:e4cfa571d8c4 | 4215:a2caa019ba3a |
---|---|
229 self.projects = [] | 229 self.projects = [] |
230 self.libs = [] | 230 self.libs = [] |
231 self.includes = [] | 231 self.includes = [] |
232 self.commands = None | 232 self.commands = None |
233 self.primary = primary | 233 self.primary = primary |
234 self._load_env(join(dir, 'mx')) | 234 mxDir = join(dir, 'mx') |
235 self._load_env(mxDir) | |
236 if primary: | |
237 self._load_commands(mxDir) | |
235 | 238 |
236 def _load_projects(self, mxDir): | 239 def _load_projects(self, mxDir): |
237 libsMap = dict() | 240 libsMap = dict() |
238 projsMap = dict() | 241 projsMap = dict() |
239 projectsFile = join(mxDir, 'projects') | 242 projectsFile = join(mxDir, 'projects') |
306 # revert the Python path | 309 # revert the Python path |
307 del sys.path[0] | 310 del sys.path[0] |
308 | 311 |
309 if not hasattr(mod, 'mx_init'): | 312 if not hasattr(mod, 'mx_init'): |
310 abort(commands + ' must define an mx_init(env) function') | 313 abort(commands + ' must define an mx_init(env) function') |
314 if hasattr(mod, 'mx_post_parse_cmd_line'): | |
315 self.mx_post_parse_cmd_line = mod.mx_post_parse_cmd_line | |
311 | 316 |
312 mod.mx_init() | 317 mod.mx_init() |
313 self.commands = mod | 318 self.commands = mod |
314 | 319 |
315 def _load_includes(self, mxDir): | 320 def _load_includes(self, mxDir): |
331 | 336 |
332 def _post_init(self, opts): | 337 def _post_init(self, opts): |
333 mxDir = join(self.dir, 'mx') | 338 mxDir = join(self.dir, 'mx') |
334 self._load_includes(mxDir) | 339 self._load_includes(mxDir) |
335 self._load_projects(mxDir) | 340 self._load_projects(mxDir) |
336 if self.primary: | 341 if self.mx_post_parse_cmd_line is not None: |
337 self._load_commands(mxDir) | 342 self.mx_post_parse_cmd_line(opts) |
338 if commands is not None and hasattr(commands, 'mx_post_parse_cmd_line'): | |
339 commands.mx_post_parse_cmd_line(opts) | |
340 for p in self.projects: | 343 for p in self.projects: |
341 existing = _projects.get(p.name) | 344 existing = _projects.get(p.name) |
342 if existing is not None: | 345 if existing is not None: |
343 abort('cannot override project ' + p.name + ' in ' + p.dir + " with project of the same name in " + existing.dir) | 346 abort('cannot override project ' + p.name + ' in ' + p.dir + " with project of the same name in " + existing.dir) |
344 _projects[p.name] = p | 347 _projects[p.name] = p |