Commit a2a0c576 authored by dpranke@chromium.org's avatar dpranke@chromium.org

Fix the gn wrapper to be aware of the --root argument.

The gn binary itself is capable of being run from outside of a
checkout as long as you pass the --root flag.

However, the gn.py wrapper script needs to *also* know where the the
checkout is, in order to figure out how to find the gn binary itself.

This patch changes the wrapper to be aware of the --root arg :).

R=brettw@chromium.org
BUG=

Review URL: https://codereview.chromium.org/212173004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@259998 0039d316-1c4b-4281-b951-d872f2087c98
parent 782dc94b
......@@ -27,9 +27,21 @@ def RunGN(sourceroot):
def main(args):
for arg in sys.argv:
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment