Chromium Code Reviews| Index: gclient.py |
| =================================================================== |
| --- gclient.py (revision 119551) |
| +++ gclient.py (working copy) |
| @@ -1080,6 +1080,23 @@ |
| print('%s: %s' % (x, entries[x])) |
| logging.info(str(self)) |
| + def HookInfo(self): |
| + work_queue = gclient_utils.ExecutionQueue(self._options.jobs, None) |
| + for s in self.dependencies: |
| + work_queue.enqueue(s) |
| + work_queue.flush({}, None, [], options=self._options) |
| + hooks = [] |
| + def _f(*args, **kwargs): |
| + cwd = kwargs['cwd'][len(self.root.root_dir)+1:] |
| + if not cwd: |
| + cwd = '.' |
| + hooks.append({'command': list(*args), 'cwd': cwd}) |
| + tmp = gclient_utils.CheckCallAndFilterAndHeader |
| + gclient_utils.CheckCallAndFilterAndHeader = _f |
|
M-A Ruel
2012/01/28 02:15:18
:/ I'd rather have you pass an argument to RunHook
szager
2012/01/30 18:47:07
OK, less monkey more patch.
|
| + self.RunHooksRecursively(self._options) |
| + gclient_utils.CheckCallAndFilterAndHeader = tmp |
| + return hooks |
| + |
| def ParseDepsFile(self): |
| """No DEPS to parse for a .gclient file.""" |
| raise gclient_utils.Error('Internal error') |
| @@ -1423,6 +1440,17 @@ |
| return 0 |
| +def CMDhookinfo(parser, args): |
| + """Output the hooks that would be run by `gclient runhooks`""" |
| + |
| + (options, args) = parser.parse_args(args) |
| + client = GClient.LoadCurrentConfig(options) |
| + if not client: |
| + raise gclient_utils.Error('client not configured; see \'gclient config\'') |
| + print client.HookInfo() |
| + return 0 |
| + |
| + |
| def Command(name): |
| return getattr(sys.modules[__name__], 'CMD' + name, None) |