--- a/build/buildutils/checkjavapackages.py Thu Jul 15 18:31:06 2010 +0300
+++ b/build/buildutils/checkjavapackages.py Thu Aug 19 09:48:13 2010 +0300
@@ -16,13 +16,17 @@
# Checks that all the java source files declare a package and that
# the directory within a java source file is located corresponds
# properly to the package.
+#
+# Ignores tsrc directories unless the option -all is given.
import sys, os, re
def main():
- files = []
+ root = sys.argv[1]
+ all = len(sys.argv) > 2 and sys.argv[2] == '-all'
+
# Create a reg exp matching to "package x.y.z;" with whitespace ignored
regex = re.compile("\\s*package\\s*([\\w.]*);.*", re.IGNORECASE)
@@ -31,8 +35,12 @@
# Skip SVN directories
if dirname.find("\\.svn") != -1:
- return names
+ return
+ # Skip tsrc
+ if not all and dirname.find("\\tsrc") != -1:
+ return
+
for f in names:
if not f.endswith(".java"):
continue
@@ -63,7 +71,7 @@
except IOError:
print "Error reading the file " + fname
- os.path.walk(sys.argv[1], visitFun, files)
+ os.path.walk(sys.argv[1], visitFun, None)
if __name__ == "__main__":