Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: tools/licenses.py

Issue 14949016: Fix tools/licenses.py to better prune directories that are empty except for VCS metadata. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698