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

Unified Diff: tools/checkdeps/java_checker.py

Issue 310003004: Update tree walking to not update a list while iterating over it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/checkdeps/java_checker.py
diff --git a/tools/checkdeps/java_checker.py b/tools/checkdeps/java_checker.py
index 36e46230f4cd6ee47160fd27cd8555eb31898e98..8b33199f9e663fea0c8da4a3db8c684d58ae1d35 100644
--- a/tools/checkdeps/java_checker.py
+++ b/tools/checkdeps/java_checker.py
@@ -39,25 +39,28 @@ class JavaChecker(object):
self._classmap = {}
self._PrescanFiles()
+ def _IgnoreDir(self, d):
+ # Skip hidden directories.
+ if d.startswith('.'):
+ return True
+ # Skip the "out" directory, as dealing with generated files is awkward.
+ # We don't want paths like "out/Release/lib.java" in our DEPS files.
+ # TODO(husky): We need some way of determining the "real" path to
+ # a generated file -- i.e., where it would be in source control if
+ # it weren't generated.
+ if d == 'out':
+ return True
+ # Skip third-party directories.
+ if d in ('third_party', 'ThirdParty'):
+ return True
+ return False
+
def _PrescanFiles(self):
for root, dirs, files in os.walk(self._base_directory):
# Skip unwanted subdirectories. TODO(husky): it would be better to do
# this via the skip_child_includes flag in DEPS files. Maybe hoist this
# prescan logic into checkdeps.py itself?
- for d in dirs:
- # Skip hidden directories.
- if d.startswith('.'):
- dirs.remove(d)
- # Skip the "out" directory, as dealing with generated files is awkward.
- # We don't want paths like "out/Release/lib.java" in our DEPS files.
- # TODO(husky): We need some way of determining the "real" path to
- # a generated file -- i.e., where it would be in source control if
- # it weren't generated.
- if d == 'out':
- dirs.remove(d)
- # Skip third-party directories.
- if d in ('third_party', 'ThirdParty'):
- dirs.remove(d)
+ dirs[:] = [d for d in dirs if not self._IgnoreDir(d)]
for f in files:
if f.endswith('.java'):
self._PrescanFile(os.path.join(root, f))
« 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