changeset 8196:f799db6b1219

Find obsolete Java files in more than one project hierachie.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 10:10:42 +0200
parents 67b663ed0496
children 1d0b6500e0e5
files artifacts/contrib/find-obsolete-java-files.py
diffstat 1 files changed, 16 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/contrib/find-obsolete-java-files.py	Fri Sep 05 10:09:16 2014 +0200
+++ b/artifacts/contrib/find-obsolete-java-files.py	Fri Sep 05 10:10:42 2014 +0200
@@ -1,21 +1,25 @@
 #!/usr/bin/env python
 
 import os
+import sys
 
 def main():
+    dirs = ['.'] if len(sys.argv) < 2 else sys.argv[1:]
+
     cnames = []
-    for root, _, files in os.walk('.'):
-        for f in files:
-            if not (f.endswith(".java") or f.endswith('.xml')):
-                continue
-            p = os.path.join(root, f)
-            with open(p, "rb") as jf:
-                content = jf.read()
-            if f.endswith('.xml'):
-                cnames.append(('', content, p))
-            else:
-                cname = f[0:-5]
-                cnames.append((cname, content, p))
+    for dir in dirs:
+        for root, _, files in os.walk(dir):
+            for f in files:
+                if not (f.endswith(".java") or f.endswith('.xml')):
+                    continue
+                p = os.path.join(root, f)
+                with open(p, "rb") as jf:
+                    content = jf.read()
+                if f.endswith('.xml'):
+                    cnames.append(('', content, p))
+                else:
+                    cname = f[0:-5]
+                    cnames.append((cname, content, p))
 
     for i in range(len(cnames)):
         x = cnames[i]

http://dive4elements.wald.intevation.org