diff options
author | Steven Knight <knight@baldmt.com> | 2010-04-18 14:03:36 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2010-04-18 14:03:36 (GMT) |
commit | ae1e7c742dcd1ed0b521640455794172fe275c65 (patch) | |
tree | 15f668e70035c926caa062d91f2fd806b7b65528 /src/test_strings.py | |
parent | e254cdf344ed0a466661b319dc019f2400ad12f3 (diff) | |
download | SCons-ae1e7c742dcd1ed0b521640455794172fe275c65.zip SCons-ae1e7c742dcd1ed0b521640455794172fe275c65.tar.gz SCons-ae1e7c742dcd1ed0b521640455794172fe275c65.tar.bz2 |
Replace remaining os.path.walk() calls with os.walk().
Diffstat (limited to 'src/test_strings.py')
-rw-r--r-- | src/test_strings.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/test_strings.py b/src/test_strings.py index c6bf75d..9aaad08 100644 --- a/src/test_strings.py +++ b/src/test_strings.py @@ -85,20 +85,19 @@ class Checker: else: return os.path.isfile(path) - def visit(self, result, dirname, names): - for name, path in [(n, os.path.join(dirname, n)) for n in names]: - if self.remove_this(name, path): - names.remove(name) - elif self.search_this(path): - body = open(path, 'r').read() - for expr in self.expressions: - if not expr.search(body): - msg = '%s: missing %s' % (path, repr(expr.pattern)) - result.append(msg) - def find_missing(self): result = [] - os.path.walk(self.directory, self.visit, result) + for dirpath, dirnames, filenames in os.walk(self.directory): + for fname in filenames: + fpath = os.path.join(dirpath, fname) + if self.remove_this(fname, fpath): + result.remove(fname) + elif self.search_this(fpath): + body = open(path, 'r').read() + for expr in self.expressions: + if not expr.search(body): + msg = '%s: missing %s' % (path, repr(expr.pattern)) + result.append(msg) return result class CheckUnexpandedStrings(Checker): |