Source

SCons / src / test_strings.py

Diff from to

src/test_strings.py

 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:
     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()
         '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',
             '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',
             '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',
             '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',