Chromium Code Reviews| Index: build/landmines.py |
| diff --git a/build/landmines.py b/build/landmines.py |
| index f1a514c5e7e206c345a33febea6b3d840781999e..2d16c166b2784e9b1c5e48d2c110925c029ee9a3 100755 |
| --- a/build/landmines.py |
| +++ b/build/landmines.py |
| @@ -83,13 +83,15 @@ def set_up_landmines(target, new_landmines): |
| os.remove(triggered) |
| -def main(): |
| +def process_options(): |
| + """Returns a list of landmine emitting scripts.""" |
| parser = optparse.OptionParser() |
| parser.add_option( |
| '-s', '--landmine-scripts', action='append', |
| default=[os.path.join(SRC_DIR, 'build', 'get_landmines.py')], |
| help='Path to the script which emits landmines to stdout. The target ' |
| - 'is passed to this script via option -t.') |
| + 'is passed to this script via option -t. Note that an extra ' |
| + 'script can be specified via an env var EXTRA_LANDMINES_SCRIPT.') |
| parser.add_option('-v', '--verbose', action='store_true', |
| default=('LANDMINES_VERBOSE' in os.environ), |
| help=('Emit some extra debugging information (default off). This option ' |
| @@ -97,22 +99,31 @@ def main(): |
| 'variable.')) |
| options, args = parser.parse_args() |
| - |
| if args: |
|
iannucci
2013/08/31 01:18:59
I'd keep this whitespace line
|
| parser.error('Unknown arguments %s' % args) |
| logging.basicConfig( |
| level=logging.DEBUG if options.verbose else logging.ERROR) |
| + extra_script = os.environ.get('EXTRA_LANDMINES_SCRIPT') |
| + if extra_script: |
| + return options.landmine_scripts + [extra_script] |
| + else: |
| + return options.landmine_scripts |
| + |
| + |
| +def main(): |
| + landmine_scripts = process_options() |
| gyp_helper.apply_chromium_gyp_env() |
| for target in ('Debug', 'Release', 'Debug_x64', 'Release_x64'): |
| landmines = [] |
| - for s in options.landmine_scripts: |
| + for s in landmine_scripts: |
| proc = subprocess.Popen([sys.executable, s, '-t', target], |
| stdout=subprocess.PIPE) |
| output, _ = proc.communicate() |
| landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()]) |
| + |
|
iannucci
2013/08/31 01:18:59
and remove this one
|
| set_up_landmines(target, landmines) |
| return 0 |