Chromium Code Reviews| Index: gn.py |
| diff --git a/gn.py b/gn.py |
| index 067f42e0f1ce62ab43eb5ed3fc55a7747d4e0689..d7bf338d435a1037a7c3a238a0854e2c7129f48a 100755 |
| --- a/gn.py |
| +++ b/gn.py |
| @@ -27,9 +27,24 @@ def RunGN(sourceroot): |
| def main(args): |
| + for arg in sys.argv: |
| + # TODO(dpranke): It would be nice if '--root foo' worked in addition |
|
brettw
2014/03/27 21:04:20
I disagree that this should be supported and I'd j
|
| + # to '--root=foo', but that would be inconsistent with how GN parses |
| + # command line args. If we fix that in GN, we should fix this wrapper, too. |
| + if arg.startswith('--root='): |
| + sourceroot = arg.replace('--root=', '') |
| + dotfile_path = os.path.join(sourceroot, '.gn') |
| + if not os.path.exists(dotfile_path): |
| + print >> sys.stderr, 'gn.py: "%s" not found, exiting.' % dotfile_path |
| + sys.exit(1) |
| + return RunGN(sourceroot) |
| + |
| sourceroot = gclient_utils.FindFileUpwards('.gn') |
| if not sourceroot: |
| - print >> sys.stderr, '.gn file not found in any parent of the current path.' |
| + print >> sys.stderr, ('gn.py: No .gn file found in any parent of ' |
| + 'the current path.') |
| + print >> sys.stderr, ('\nYou need to either be inside a checkout, ' |
| + 'or use --root to specify the checkout root.') |
| sys.exit(1) |
| return RunGN(sourceroot) |