Chromium Code Reviews| Index: tools/licenses.py |
| =================================================================== |
| --- tools/licenses.py (revision 199288) |
| +++ tools/licenses.py (working copy) |
| @@ -71,9 +71,10 @@ |
| ]) |
| # Directories we don't scan through. |
| -PRUNE_DIRS = ('.svn', '.git', # VCS metadata |
| - 'out', 'Debug', 'Release', # build files |
| - 'layout_tests') # lots of subdirs |
| +VCS_METADATA_DIRS = ('.svn', '.git') |
| +PRUNE_DIRS = (VCS_METADATA_DIRS + |
| + ('out', 'Debug', 'Release', # build files |
| + 'layout_tests')) # lots of subdirs |
| ADDITIONAL_PATHS = ( |
| os.path.join('breakpad'), |
| @@ -328,9 +329,12 @@ |
| def ContainsFiles(path, root): |
| """Determines whether any files exist in a directory or in any of its |
| subdirectories.""" |
| - for _, _, files in os.walk(os.path.join(root, path)): |
| + for _, dirs, files in os.walk(os.path.join(root, path)): |
| if files: |
| return True |
| + for vcs_metadata in VCS_METADATA_DIRS: |
| + if vcs_metadata in dirs: |
| + dirs.remove(vcs_metadata) |
|
Nico
2013/05/14 03:06:15
Huh, I didn't know this works!
(I checked the doc
|
| return False |