diff options
Diffstat (limited to 'src/test_strings.py')
-rw-r--r-- | src/test_strings.py | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/src/test_strings.py b/src/test_strings.py index b609f59..a3ed6e8 100644 --- a/src/test_strings.py +++ b/src/test_strings.py @@ -54,18 +54,28 @@ build_local = build_path('scons-local', 'scons-local-'+scons_version) build_src = build_path('scons-src') class Checker: - def __init__(self, directory, search_list = [], remove_list=[]): + def __init__(self, directory, + search_list = [], + remove_list = [], + remove_patterns = []): self.directory = directory self.search_list = search_list self.remove_dict = {} for r in remove_list: self.remove_dict[os.path.join(directory, r)] = 1 + self.remove_patterns = remove_patterns def directory_exists(self): return os.path.exists(self.directory) - def remove_path(self, path): - return self.remove_dict.get(path) + def remove_this(self, name, path): + if self.remove_dict.get(path): + return 1 + else: + for pattern in self.remove_patterns: + if fnmatch.fnmatch(name, pattern): + return 1 + return 0 def search_this(self, path): if self.search_list: @@ -79,7 +89,7 @@ class Checker: def visit(self, result, dirname, names): make_path_tuple = lambda n, d=dirname: (n, os.path.join(d, n)) for name, path in map(make_path_tuple, names): - if self.remove_path(path): + if self.remove_this(name, path): names.remove(name) elif self.search_this(path): body = open(path, 'r').read() @@ -114,9 +124,9 @@ check_list = [ 'src', search_list = [ '*.py' ], remove_list = [ - 'engine/SCons/compat/_sets.py', - 'engine/SCons/compat/_sets15.py', - 'engine/SCons/compat/_subprocess.py', + 'engine/SCons/compat/_scons_sets.py', + 'engine/SCons/compat/_scons_sets15.py', + 'engine/SCons/compat/_scons_subprocess.py', 'engine/SCons/Conftest.py', 'engine/SCons/dblite.py', 'engine/SCons/Optik', @@ -137,9 +147,9 @@ check_list = [ 'debian', 'dist', 'gentoo', - 'engine/SCons/compat/_sets.py', - 'engine/SCons/compat/_sets15.py', - 'engine/SCons/compat/_subprocess.py', + 'engine/SCons/compat/_scons_sets.py', + 'engine/SCons/compat/_scons_sets15.py', + 'engine/SCons/compat/_scons_subprocess.py', 'engine/SCons/Conftest.py', 'engine/SCons/dblite.py', 'engine/SCons/Optik', @@ -147,14 +157,18 @@ check_list = [ 'os_spawnv_fix.diff', 'setup.cfg', ], + # We run epydoc on the *.py files, which generates *.pyc files. + remove_patterns = [ + '*.pyc' + ] ), CheckExpandedCopyright( build_local, remove_list = [ - 'SCons/compat/_sets.py', - 'SCons/compat/_sets15.py', - 'SCons/compat/_subprocess.py', + 'SCons/compat/_scons_sets.py', + 'SCons/compat/_scons_sets15.py', + 'SCons/compat/_scons_subprocess.py', 'SCons/Conftest.py', 'SCons/dblite.py', 'SCons/Optik', @@ -192,9 +206,9 @@ check_list = [ 'src/engine/MANIFEST.in', 'src/engine/MANIFEST-xml.in', 'src/engine/setup.cfg', - 'src/engine/SCons/compat/_sets.py', - 'src/engine/SCons/compat/_sets15.py', - 'src/engine/SCons/compat/_subprocess.py', + 'src/engine/SCons/compat/_scons_sets.py', + 'src/engine/SCons/compat/_scons_sets15.py', + 'src/engine/SCons/compat/_scons_subprocess.py', 'src/engine/SCons/Conftest.py', 'src/engine/SCons/dblite.py', 'src/engine/SCons/Optik', |