diff options
author | noelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-13 00:02:56 +0000 |
---|---|---|
committer | noelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-13 00:02:56 +0000 |
commit | 4a41db50f0f8ec321d14c43c5e2fab3d14418cf0 (patch) | |
tree | 6230b1e56332ddc400f595f5eeb2c6ac95f1c5d9 /ppapi/generators | |
parent | be279ff32d7ffb004752c012d9b185e614260fa4 (diff) | |
download | chromium_src-4a41db50f0f8ec321d14c43c5e2fab3d14418cf0.zip chromium_src-4a41db50f0f8ec321d14c43c5e2fab3d14418cf0.tar.gz chromium_src-4a41db50f0f8ec321d14c43c5e2fab3d14418cf0.tar.bz2 |
Fix incorrectly resolved conflict, and add error message for missing sources.
When running the generator with default arguments from a CWD other than
the script's directory, the default arguments will be incorrect. This adds
a check which will print an error message and fail. If any argument,
including the default arguments are provided on the command-line, then this
check is bypassed.
BUG= 109177
Review URL: http://codereview.chromium.org/9168014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117547 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/generators')
-rwxr-xr-x | ppapi/generators/generator.py | 11 | ||||
-rwxr-xr-x | ppapi/generators/idl_c_header.py | 6 | ||||
-rwxr-xr-x | ppapi/generators/idl_generator.py | 3 | ||||
-rwxr-xr-x | ppapi/generators/idl_node.py | 3 | ||||
-rwxr-xr-x | ppapi/generators/idl_parser.py | 3 |
5 files changed, 17 insertions, 9 deletions
diff --git a/ppapi/generators/generator.py b/ppapi/generators/generator.py index 2d3c703..c65fe4c 100755 --- a/ppapi/generators/generator.py +++ b/ppapi/generators/generator.py @@ -3,6 +3,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import os import sys # Note: some of these files are imported to register cmdline options. @@ -16,10 +17,18 @@ from idl_gen_pnacl import PnaclGen def Main(): args = sys.argv[1:] - # If no arguments are provided, assume we are tring to rebuild the + # If no arguments are provided, assume we are trying to rebuild the # C headers with warnings off. if not args: args = ['--wnone', '--cgen', '--range=start,end'] + current_dir = os.path.abspath(os.getcwd()) + script_dir = os.path.abspath(os.path.dirname(__file__)) + if current_dir != script_dir: + print '\nIncorrect CWD, default run skipped.' + print 'When running with no arguments set CWD to the scripts directory:' + print '\t' + script_dir + '\n' + print 'This ensures correct default paths and behavior.\n' + return 1 filenames = ParseOptions(args) ast = ParseFiles(filenames) diff --git a/ppapi/generators/idl_c_header.py b/ppapi/generators/idl_c_header.py index 485a8ab..6584ef4 100755 --- a/ppapi/generators/idl_c_header.py +++ b/ppapi/generators/idl_c_header.py @@ -1,5 +1,4 @@ -#!/usr/bin/python -# +#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -241,6 +240,5 @@ def Main(args): return failed if __name__ == '__main__': - retval = Main(sys.argv[1:]) - sys.exit(retval) + sys.exit(Main(sys.argv[1:])) diff --git a/ppapi/generators/idl_generator.py b/ppapi/generators/idl_generator.py index 683593b..e3676153 100755 --- a/ppapi/generators/idl_generator.py +++ b/ppapi/generators/idl_generator.py @@ -1,5 +1,4 @@ -#!/usr/bin/python -# +#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/ppapi/generators/idl_node.py b/ppapi/generators/idl_node.py index 267b152..d35268a 100755 --- a/ppapi/generators/idl_node.py +++ b/ppapi/generators/idl_node.py @@ -1,5 +1,4 @@ -#!/usr/bin/python -# +#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/ppapi/generators/idl_parser.py b/ppapi/generators/idl_parser.py index a5e29ed..45f1021 100755 --- a/ppapi/generators/idl_parser.py +++ b/ppapi/generators/idl_parser.py @@ -1018,6 +1018,9 @@ def ParseFiles(filenames): srcdir = os.path.normpath(srcdir) filenames += sorted(glob.glob(srcdir)) + if not filenames: + ErrOut.Log('No sources provided.') + for filename in filenames: filenode = parser.ParseFile(filename) filenodes.append(filenode) |