Chromium Code Reviews| Index: tools/check_ecs_deps/check_ecs_deps.py |
| =================================================================== |
| --- tools/check_ecs_deps/check_ecs_deps.py (revision 237842) |
| +++ tools/check_ecs_deps/check_ecs_deps.py (working copy) |
| @@ -62,7 +62,6 @@ |
| if final: |
| print '\n@@@STEP_%s@@@' % final |
| - |
| def _main(): |
| output = { |
| 'message': lambda x: stdmsg(None, x), |
| @@ -70,6 +69,7 @@ |
| 'warn': lambda x: stdmsg('WARNING', x), |
| 'abend': lambda x: stdmsg('FAILED', x), |
| 'ok': lambda x: stdmsg('SUCCESS', x), |
| + 'verbose': lambda x: None, |
| } |
| parser = optparse.OptionParser( |
| @@ -80,6 +80,7 @@ |
| parser.add_option("-b", "--build-dir", |
| help="the location of the compiler output") |
| parser.add_option("--target", help="Debug or Release") |
| + parser.add_option('-v', '--verbose', default=False, action='store_true') |
| options, args = parser.parse_args() |
| # Bake target into build_dir. |
| @@ -95,19 +96,27 @@ |
| target = binary_target |
| if options.annotate: |
| - output = { |
| + output.update({ |
| 'message': lambda x: bbmsg(None, x), |
| 'fail': lambda x: bbmsg('FAILURE', x), |
| 'warn': lambda x: bbmsg('WARNINGS', x), |
| 'abend': lambda x: bbmsg('EXCEPTIONS', x), |
| 'ok': lambda x: bbmsg(None, x), |
| - } |
| + }) |
| + if options.verbose: |
| + output['verbose'] = lambda x: stdmsg(None, x) |
| + |
| forbidden_regexp = re.compile(string.join(map(re.escape, |
| kUndesiredLibraryList), '|')) |
| - mapping_regexp = re.compile(r"\s*([^/]*) => ") |
| + mapping_regexp = re.compile(r"\s*([^/]*) => (.*)") |
| blessed_regexp = re.compile(r"(%s)[-0-9.]*\.so" % string.join(map(re.escape, |
| kAllowedLibraryList), '|')) |
| + if options.build_dir != None: |
| + built_regexp = re.compile(re.escape(options.build_dir)) |
| + else: |
| + built_regexp = re.compile(re.escape('lib')) |
| + built_regexp |
| success = 0 |
| warning = 0 |
| @@ -134,10 +143,15 @@ |
| libmatch = mapping_regexp.match(d) |
| if libmatch: |
| lib = libmatch.group(1) |
| + source = libmatch.group(2) |
| if forbidden_regexp.search(lib): |
| success = 0 |
| output['message'](['Forbidden library: ' + lib]) |
| - if not blessed_regexp.match(lib): |
| + elif built_regexp.match(source): |
|
rjkroege
2013/12/02 16:17:22
nit: why extra spaces before lib?
Peter Mayo (wrong one)
2013/12/02 16:42:01
Tyop : interesting, why no pylint?
|
| + output['verbose'](['Built library: ' + lib]) |
| + elif blessed_regexp.match(lib): |
| + output['verbose'](['Blessed library: ' + lib]) |
| + else: |
| warning = 1 |
| output['message'](['Unexpected library: ' + lib]) |