diff -r dc7c549001d5 -r 85266cc22c7f build/buildutils/checkjavapackages.py --- a/build/buildutils/checkjavapackages.py Thu May 27 12:49:31 2010 +0300 +++ b/build/buildutils/checkjavapackages.py Fri Jun 11 13:33:44 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__":