From: david-sarah Date: Fri, 16 Sep 2011 21:26:33 +0000 (-0700) Subject: misc/coding_tools/check_interfaces.py: use os.walk instead of FilePath, since this... X-Git-Tag: allmydata-tahoe-1.9.0a2~12 X-Git-Url: https://git.rkrishnan.org/simplejson/%22news.html/frontends/quickstart.html?a=commitdiff_plain;h=9ca8ff7bfce1a2168572a4d459a588f31329592e;p=tahoe-lafs%2Ftahoe-lafs.git misc/coding_tools/check_interfaces.py: use os.walk instead of FilePath, since this script shouldn't really depend on Twisted. refs #1474 --- diff --git a/misc/coding_tools/check-interfaces.py b/misc/coding_tools/check-interfaces.py index c5dbf246..4d472975 100644 --- a/misc/coding_tools/check-interfaces.py +++ b/misc/coding_tools/check-interfaces.py @@ -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()