]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blobdiff - misc/coding_tools/check-interfaces.py
misc/coding_tools/check_interfaces.py: use os.walk instead of FilePath, since this...
[tahoe-lafs/tahoe-lafs.git] / misc / coding_tools / check-interfaces.py
index 2a22cffc984363fc4fe0a818267fe27909c39f1b..4d472975304555629d26b4b94c79b6737cda3a77 100644 (file)
@@ -12,8 +12,8 @@ from zope.interface.advice import addClassAdvisor
 
 
 interesting_modules = re.compile(r'(allmydata)|(foolscap)\..*')
-excluded_classnames = re.compile(r'(_)|(Mock)|(Fake).*')
-excluded_file_basenames = re.compile(r'check_.*')
+excluded_classnames = re.compile(r'(_)|(Mock)|(Fake)|(Dummy).*')
+excluded_file_basenames = re.compile(r'(check)|(bench)_.*')
 
 
 other_modules_with_violations = set()
@@ -60,21 +60,20 @@ zi.implements = strictly_implements
 sys.argv = ['', '--help']
 
 
-from twisted.python.filepath import FilePath
-
 # import modules under src/
-src = FilePath('src')
-for fp in src.walk():
-    (basepath, ext) = fp.splitext()
-    if ext == '.py' and not excluded_file_basenames.match(fp.basename()):
-        relpath = os.path.relpath(basepath, src.path)
-        module = relpath.replace(os.path.sep, '/').replace('/', '.')
-        try:
-            __import__(module)
-        except ImportError:
-            import traceback
-            traceback.print_exc()
-            print >>sys.stderr
+srcdir = 'src'
+for (dirpath, dirnames, filenames) in os.walk(srcdir):
+    for fn in filenames:
+        (basename, ext) = os.path.splitext(fn)
+        if ext == '.py' and not excluded_file_basenames.match(basename):
+            relpath = os.path.join(dirpath[len(srcdir)+1:], basename)
+            module = relpath.replace(os.sep, '/').replace('/', '.')
+            try:
+                __import__(module)
+            except ImportError:
+                import traceback
+                traceback.print_exc()
+                print >>sys.stderr
 
 others = list(other_modules_with_violations)
 others.sort()