summaryrefslogtreecommitdiffstats
path: root/SCons/Scanner
diff options
context:
space:
mode:
authorAdam Gross <grossag@vmware.com>2020-11-06 17:46:12 (GMT)
committerAdam Gross <grossag@vmware.com>2020-11-06 17:46:12 (GMT)
commitcc7b28e50655960e7aab2dd8581f427a0920bf38 (patch)
tree3c9e36a05f4069bf2e8699e351043254c3edd1da /SCons/Scanner
parent450b28367cdcbf10f855e43e0571915ebf9f09ca (diff)
parentebe6e9b1b2fedbe3dd44c07aa2b6739d4079879e (diff)
downloadSCons-cc7b28e50655960e7aab2dd8581f427a0920bf38.zip
SCons-cc7b28e50655960e7aab2dd8581f427a0920bf38.tar.gz
SCons-cc7b28e50655960e7aab2dd8581f427a0920bf38.tar.bz2
Merge branch 'master' into topic/grossag/newhashes
Diffstat (limited to 'SCons/Scanner')
-rw-r--r--SCons/Scanner/C.py35
-rw-r--r--SCons/Scanner/CTests.py9
-rw-r--r--SCons/Scanner/D.py18
-rw-r--r--SCons/Scanner/DTests.py10
-rw-r--r--SCons/Scanner/Dir.py5
-rw-r--r--SCons/Scanner/DirTests.py7
-rw-r--r--SCons/Scanner/Fortran.py11
-rw-r--r--SCons/Scanner/FortranTests.py7
-rw-r--r--SCons/Scanner/IDL.py23
-rw-r--r--SCons/Scanner/IDLTests.py7
-rw-r--r--SCons/Scanner/LaTeX.py18
-rw-r--r--SCons/Scanner/LaTeXTests.py10
-rw-r--r--SCons/Scanner/Prog.py16
-rw-r--r--SCons/Scanner/ProgTests.py7
-rw-r--r--SCons/Scanner/Python.py31
-rw-r--r--SCons/Scanner/PythonTests.py6
-rw-r--r--SCons/Scanner/RC.py39
-rw-r--r--SCons/Scanner/RCTests.py14
-rw-r--r--SCons/Scanner/SWIG.py12
-rw-r--r--SCons/Scanner/Scanner.xml2
-rw-r--r--SCons/Scanner/ScannerTests.py9
-rw-r--r--SCons/Scanner/__init__.py168
22 files changed, 186 insertions, 278 deletions
diff --git a/SCons/Scanner/C.py b/SCons/Scanner/C.py
index 21da574..91beb04 100644
--- a/SCons/Scanner/C.py
+++ b/SCons/Scanner/C.py
@@ -1,11 +1,6 @@
-"""SCons.Scanner.C
-
-This module implements the dependency scanner for C/C++ code.
-
-"""
-
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -25,9 +20,8 @@ This module implements the dependency scanner for C/C++ code.
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""Dependency scanner for C/C++ code."""
import SCons.Node.FS
import SCons.Scanner
@@ -36,8 +30,7 @@ import SCons.Util
import SCons.cpp
class SConsCPPScanner(SCons.cpp.PreProcessor):
- """
- SCons-specific subclass of the cpp.py module's processing.
+ """SCons-specific subclass of the cpp.py module's processing.
We subclass this so that: 1) we can deal with files represented
by Nodes, not strings; 2) we can keep track of the files that are
@@ -81,8 +74,7 @@ def dictify_CPPDEFINES(env):
return cppdefines
class SConsCPPScannerWrapper:
- """
- The SCons wrapper around a cpp.py scanner.
+ """The SCons wrapper around a cpp.py scanner.
This is the actual glue between the calling conventions of generic
SCons scanners, and the (subclass of) cpp.py class that knows how
@@ -116,12 +108,14 @@ def CScanner():
# knows how to evaluate #if/#ifdef/#else/#elif lines when searching
# for #includes. This is commented out for now until we add the
# right configurability to let users pick between the scanners.
- #return SConsCPPScannerWrapper("CScanner", "CPPPATH")
-
- cs = SCons.Scanner.ClassicCPP("CScanner",
- "$CPPSUFFIXES",
- "CPPPATH",
- '^[ \t]*#[ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")')
+ # return SConsCPPScannerWrapper("CScanner", "CPPPATH")
+
+ cs = SCons.Scanner.ClassicCPP(
+ "CScanner",
+ "$CPPSUFFIXES",
+ "CPPPATH",
+ r'^[ \t]*#[ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")',
+ )
return cs
@@ -131,8 +125,7 @@ def CScanner():
class SConsCPPConditionalScanner(SCons.cpp.PreProcessor):
- """
- SCons-specific subclass of the cpp.py module's processing.
+ """SCons-specific subclass of the cpp.py module's processing.
We subclass this so that: 1) we can deal with files represented
by Nodes, not strings; 2) we can keep track of the files that are
diff --git a/SCons/Scanner/CTests.py b/SCons/Scanner/CTests.py
index 8042e3f..25c6e99 100644
--- a/SCons/Scanner/CTests.py
+++ b/SCons/Scanner/CTests.py
@@ -1,5 +1,6 @@
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -19,11 +20,6 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-import SCons.compat
import collections
import os
@@ -32,6 +28,7 @@ import unittest
import TestCmd
import TestUnit
+import SCons.compat
import SCons.Node.FS
import SCons.Warnings
diff --git a/SCons/Scanner/D.py b/SCons/Scanner/D.py
index b3fb29e..645934b 100644
--- a/SCons/Scanner/D.py
+++ b/SCons/Scanner/D.py
@@ -1,14 +1,6 @@
-"""SCons.Scanner.D
-
-Scanner for the Digital Mars "D" programming language.
-
-Coded by Andy Friesen
-17 Nov 2003
-
-"""
-
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -28,9 +20,11 @@ Coded by Andy Friesen
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""Scanner for the Digital Mars "D" programming language.
+
+Coded by Andy Friesen, 17 Nov 2003
+"""
import SCons.Scanner
diff --git a/SCons/Scanner/DTests.py b/SCons/Scanner/DTests.py
index d0157bf..7b764aa 100644
--- a/SCons/Scanner/DTests.py
+++ b/SCons/Scanner/DTests.py
@@ -1,5 +1,6 @@
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -19,10 +20,9 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import collections
+import os
import unittest
import TestCmd
@@ -31,8 +31,6 @@ import SCons.Scanner.D
test = TestCmd.TestCmd(workdir = '')
-import collections
-import os
class DummyEnvironment(collections.UserDict):
def __init__(self, **kw):
diff --git a/SCons/Scanner/Dir.py b/SCons/Scanner/Dir.py
index 3b33fe5..617bf2b 100644
--- a/SCons/Scanner/Dir.py
+++ b/SCons/Scanner/Dir.py
@@ -1,5 +1,6 @@
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,8 +21,6 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
import SCons.Node.FS
import SCons.Scanner
diff --git a/SCons/Scanner/DirTests.py b/SCons/Scanner/DirTests.py
index 8f866c4..2e73fe2 100644
--- a/SCons/Scanner/DirTests.py
+++ b/SCons/Scanner/DirTests.py
@@ -1,5 +1,6 @@
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -19,12 +20,8 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
-import sys
import unittest
import TestCmd
diff --git a/SCons/Scanner/Fortran.py b/SCons/Scanner/Fortran.py
index 67e6180..18e5082 100644
--- a/SCons/Scanner/Fortran.py
+++ b/SCons/Scanner/Fortran.py
@@ -1,11 +1,6 @@
-"""SCons.Scanner.Fortran
-
-This module implements the dependency scanner for Fortran code.
-
-"""
-
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -26,7 +21,7 @@ This module implements the dependency scanner for Fortran code.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""Dependency scanner for Fortran code."""
import re
diff --git a/SCons/Scanner/FortranTests.py b/SCons/Scanner/FortranTests.py
index be2acd3..487fb7b 100644
--- a/SCons/Scanner/FortranTests.py
+++ b/SCons/Scanner/FortranTests.py
@@ -1,5 +1,6 @@
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -19,12 +20,8 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import os.path
import unittest
import SCons.Scanner.Fortran
diff --git a/SCons/Scanner/IDL.py b/SCons/Scanner/IDL.py
index 86ee006..418608f 100644
--- a/SCons/Scanner/IDL.py
+++ b/SCons/Scanner/IDL.py
@@ -1,12 +1,6 @@
-"""SCons.Scanner.IDL
-
-This module implements the dependency scanner for IDL (Interface
-Definition Language) files.
-
-"""
-
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -26,19 +20,20 @@ Definition Language) files.
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""Dependency scanner for IDL (Interface Definition Language) files."""
import SCons.Node.FS
import SCons.Scanner
def IDLScan():
"""Return a prototype Scanner instance for scanning IDL source files"""
- cs = SCons.Scanner.ClassicCPP("IDLScan",
- "$IDLSUFFIXES",
- "CPPPATH",
- '^[ \t]*(?:#[ \t]*include|[ \t]*import)[ \t]+(<|")([^>"]+)(>|")')
+ cs = SCons.Scanner.ClassicCPP(
+ "IDLScan",
+ "$IDLSUFFIXES",
+ "CPPPATH",
+ r'^[ \t]*(?:#[ \t]*include|[ \t]*import)[ \t]+(<|")([^>"]+)(>|")',
+ )
return cs
# Local Variables:
diff --git a/SCons/Scanner/IDLTests.py b/SCons/Scanner/IDLTests.py
index 9cbb73d..fc1d1c8 100644
--- a/SCons/Scanner/IDLTests.py
+++ b/SCons/Scanner/IDLTests.py
@@ -1,5 +1,6 @@
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -19,12 +20,8 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import unittest
-import sys
import os
import os.path
diff --git a/SCons/Scanner/LaTeX.py b/SCons/Scanner/LaTeX.py
index a85592e..73f0035 100644
--- a/SCons/Scanner/LaTeX.py
+++ b/SCons/Scanner/LaTeX.py
@@ -1,11 +1,6 @@
-"""SCons.Scanner.LaTeX
-
-This module implements the dependency scanner for LaTeX code.
-
-"""
-
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -25,9 +20,8 @@ This module implements the dependency scanner for LaTeX code.
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""Dependency scanner for LaTeX code."""
import os.path
import re
@@ -96,7 +90,6 @@ class FindENVPathDirs:
return tuple(dir.Rfindalldirs(path))
-
def LaTeXScanner():
"""
Return a prototype Scanner instance for scanning LaTeX source files
@@ -109,6 +102,7 @@ def LaTeXScanner():
recursive = 0)
return ds
+
def PDFLaTeXScanner():
"""
Return a prototype Scanner instance for scanning LaTeX source files
@@ -121,9 +115,9 @@ def PDFLaTeXScanner():
recursive = 0)
return ds
+
class LaTeX(SCons.Scanner.Base):
- """
- Class for scanning LaTeX files for included files.
+ """Class for scanning LaTeX files for included files.
Unlike most scanners, which use regular expressions that just
return the included file name, this returns a tuple consisting
diff --git a/SCons/Scanner/LaTeXTests.py b/SCons/Scanner/LaTeXTests.py
index 409699c..818cbe4 100644
--- a/SCons/Scanner/LaTeXTests.py
+++ b/SCons/Scanner/LaTeXTests.py
@@ -1,5 +1,6 @@
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -19,19 +20,14 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-import SCons.compat
import collections
import os
-import sys
import unittest
import TestCmd
+import SCons.compat
import SCons.Node.FS
import SCons.Scanner.LaTeX
diff --git a/SCons/Scanner/Prog.py b/SCons/Scanner/Prog.py
index 6567b3d..41be1a4 100644
--- a/SCons/Scanner/Prog.py
+++ b/SCons/Scanner/Prog.py
@@ -1,5 +1,6 @@
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -19,9 +20,8 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""Dependency scanner for program files."""
import SCons.Node
import SCons.Node.FS
@@ -39,9 +39,7 @@ def ProgramScanner(**kw):
return ps
def _subst_libs(env, libs):
- """
- Substitute environment variables and split into list.
- """
+ """Substitute environment variables and split into list."""
if SCons.Util.is_String(libs):
libs = env.subst(libs)
if SCons.Util.is_String(libs):
@@ -57,9 +55,9 @@ def _subst_libs(env, libs):
return libs
def scan(node, env, libpath = ()):
- """
- This scanner scans program files for static-library
- dependencies. It will search the LIBPATH environment variable
+ """Scans program files for static-library dependencies.
+
+ It will search the LIBPATH environment variable
for libraries specified in the LIBS variable, returning any
files it finds as dependencies.
"""
diff --git a/SCons/Scanner/ProgTests.py b/SCons/Scanner/ProgTests.py
index b91a2ad..4b17d9b 100644
--- a/SCons/Scanner/ProgTests.py
+++ b/SCons/Scanner/ProgTests.py
@@ -1,5 +1,6 @@
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -19,12 +20,8 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
-import sys
import unittest
import TestCmd
diff --git a/SCons/Scanner/Python.py b/SCons/Scanner/Python.py
index deb2241..dc6812c 100644
--- a/SCons/Scanner/Python.py
+++ b/SCons/Scanner/Python.py
@@ -1,18 +1,6 @@
-"""SCons.Scanner.Python
-
-This module implements the dependency scanner for Python code.
-
-One important note about the design is that this does not take any dependencies
-upon packages or binaries in the Python installation unless they are listed in
-PYTHONPATH. To do otherwise would have required code to determine where the
-Python installation is, which is outside of the scope of a scanner like this.
-If consumers want to pick up dependencies upon these packages, they must put
-those directories in PYTHONPATH.
-
-"""
-
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -32,9 +20,17 @@ those directories in PYTHONPATH.
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""Dependency scanner for Python code.
+
+One important note about the design is that this does not take any dependencies
+upon packages or binaries in the Python installation unless they are listed in
+PYTHONPATH. To do otherwise would have required code to determine where the
+Python installation is, which is outside of the scope of a scanner like this.
+If consumers want to pick up dependencies upon these packages, they must put
+those directories in PYTHONPATH.
+
+"""
import itertools
import os
@@ -55,8 +51,7 @@ def path_function(env, dir=None, target=None, source=None, argument=None):
def find_include_names(node):
- """
- Scans the node for all imports.
+ """Scans the node for all imports.
Returns a list of tuples. Each tuple has two elements:
1. The main import (e.g. module, module.file, module.module2)
diff --git a/SCons/Scanner/PythonTests.py b/SCons/Scanner/PythonTests.py
index 0d4e628..faf548a 100644
--- a/SCons/Scanner/PythonTests.py
+++ b/SCons/Scanner/PythonTests.py
@@ -1,5 +1,6 @@
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -19,9 +20,6 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import SCons.compat
diff --git a/SCons/Scanner/RC.py b/SCons/Scanner/RC.py
index abaaef7..12e431d 100644
--- a/SCons/Scanner/RC.py
+++ b/SCons/Scanner/RC.py
@@ -1,12 +1,6 @@
-"""SCons.Scanner.RC
-
-This module implements the dependency scanner for RC (Interface
-Definition Language) files.
-
-"""
-
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -26,20 +20,17 @@ Definition Language) files.
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""Dependency scanner for RC (Interface Definition Language) files."""
-import re
import SCons.Node.FS
import SCons.Scanner
def no_tlb(nodes):
- """
- Filter out .tlb files as they are binary and shouldn't be scanned
- """
+ """Filter out .tlb files as they are binary and shouldn't be scanned."""
+
# print("Nodes:%s"%[str(n) for n in nodes])
return [n for n in nodes if str(n)[-4:] != '.tlb']
@@ -47,16 +38,16 @@ def no_tlb(nodes):
def RCScan():
"""Return a prototype Scanner instance for scanning RC source files"""
- res_re= r'^(?:\s*#\s*(?:include)|' \
- r'.*?\s+(?:ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)' \
- r'\s*.*?)' \
- r'\s*(<|"| )([^>"\s]+)(?:[>"\s])*$'
- resScanner = SCons.Scanner.ClassicCPP("ResourceScanner",
- "$RCSUFFIXES",
- "CPPPATH",
- res_re,
- recursive=no_tlb)
-
+ res_re = (
+ r'^(?:\s*#\s*(?:include)|'
+ r'.*?\s+(?:ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)'
+ r'\s*.*?)'
+ r'\s*(<|"| )([^>"\s]+)(?:[>"\s])*$'
+ )
+ resScanner = SCons.Scanner.ClassicCPP(
+ "ResourceScanner", "$RCSUFFIXES", "CPPPATH", res_re, recursive=no_tlb
+ )
+
return resScanner
# Local Variables:
diff --git a/SCons/Scanner/RCTests.py b/SCons/Scanner/RCTests.py
index 347149c..9183ec7 100644
--- a/SCons/Scanner/RCTests.py
+++ b/SCons/Scanner/RCTests.py
@@ -1,5 +1,6 @@
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -19,12 +20,8 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import unittest
-import sys
import collections
import os
@@ -158,13 +155,6 @@ class RCScannerTestCase3(unittest.TestCase):
deps_match(self, deps, headers)
-def suite():
- suite = unittest.TestSuite()
- suite.addTest(RCScannerTestCase1())
- suite.addTest(RCScannerTestCase2())
- suite.addTest(RCScannerTestCase3())
- return suite
-
if __name__ == "__main__":
unittest.main()
diff --git a/SCons/Scanner/SWIG.py b/SCons/Scanner/SWIG.py
index a333134..5a60c74 100644
--- a/SCons/Scanner/SWIG.py
+++ b/SCons/Scanner/SWIG.py
@@ -1,11 +1,6 @@
-"""SCons.Scanner.SWIG
-
-This module implements the dependency scanner for SWIG code.
-
-"""
-
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -25,9 +20,8 @@ This module implements the dependency scanner for SWIG code.
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""Dependency scanner for SWIG code."""
import SCons.Scanner
diff --git a/SCons/Scanner/Scanner.xml b/SCons/Scanner/Scanner.xml
index 4f96d39..c9b7f32 100644
--- a/SCons/Scanner/Scanner.xml
+++ b/SCons/Scanner/Scanner.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
-__COPYRIGHT__
+Copyright The SCons Foundation
This file is processed by the bin/SConsDoc.py module.
See its __doc__ string for a discussion of the format.
diff --git a/SCons/Scanner/ScannerTests.py b/SCons/Scanner/ScannerTests.py
index bf9879e..815dabd 100644
--- a/SCons/Scanner/ScannerTests.py
+++ b/SCons/Scanner/ScannerTests.py
@@ -1,5 +1,6 @@
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,16 +21,12 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-import SCons.compat
-
import collections
-import sys
import unittest
import TestUnit
+import SCons.compat
import SCons.Scanner
class DummyFS:
diff --git a/SCons/Scanner/__init__.py b/SCons/Scanner/__init__.py
index e99c526..d98f651 100644
--- a/SCons/Scanner/__init__.py
+++ b/SCons/Scanner/__init__.py
@@ -1,11 +1,6 @@
-"""SCons.Scanner
-
-The Scanner package for the SCons software construction utility.
-
-"""
-
+# MIT License
#
-# __COPYRIGHT__
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -25,9 +20,8 @@ The Scanner package for the SCons software construction utility.
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+"""The Scanner package for the SCons software construction utility."""
import re
@@ -43,16 +37,16 @@ class _Null:
_null = _Null
def Scanner(function, *args, **kw):
- """
- Public interface factory function for creating different types
- of Scanners based on the different types of "functions" that may
- be supplied.
+ """Factory function to create a Scanner Object.
+
+ Creates the appropriate Scanner based on the type of "function".
TODO: Deprecate this some day. We've moved the functionality
inside the Base class and really don't need this factory function
any more. It was, however, used by some of our Tool modules, so
the call probably ended up in various people's custom modules
patterned on SCons code.
+
"""
if SCons.Util.is_Dict(function):
return Selector(function, *args, **kw)
@@ -60,10 +54,8 @@ def Scanner(function, *args, **kw):
return Base(function, *args, **kw)
-
class FindPathDirs:
- """
- A class to bind a specific E{*}PATH variable name to a function that
+ """Class to bind a specific E{*}PATH variable name to a function that
will return all of the E{*}path directories.
"""
def __init__(self, variable):
@@ -82,66 +74,25 @@ class FindPathDirs:
class Base:
- """
- The base class for dependency scanners. This implements
- straightforward, single-pass scanning of a single file.
- """
-
- def __init__(self,
- function,
- name = "NONE",
- argument = _null,
- skeys = _null,
- path_function = None,
- # Node.FS.Base so that, by default, it's okay for a
- # scanner to return a Dir, File or Entry.
- node_class = SCons.Node.FS.Base,
- node_factory = None,
- scan_check = None,
- recursive = None):
- """
- Construct a new scanner object given a scanner function.
-
- 'function' - a scanner function taking two or three
- arguments and returning a list of strings.
-
- 'name' - a name for identifying this scanner object.
+ """Base class for dependency scanners.
- 'argument' - an optional argument that, if specified, will be
- passed to both the scanner function and the path_function.
-
- 'skeys' - an optional list argument that can be used to determine
- which scanner should be used for a given Node. In the case of File
- nodes, for example, the 'skeys' would be file suffixes.
-
- 'path_function' - a function that takes four or five arguments
- (a construction environment, Node for the directory containing
- the SConscript file that defined the primary target, list of
- target nodes, list of source nodes, and optional argument for
- this instance) and returns a tuple of the directories that can
- be searched for implicit dependency files. May also return a
- callable() which is called with no args and returns the tuple
- (supporting Bindable class).
-
- 'node_class' - the class of Nodes which this scan will return.
- If node_class is None, then this scanner will not enforce any
- Node conversion and will return the raw results from the
- underlying scanner function.
-
- 'node_factory' - the factory function to be called to translate
- the raw results returned by the scanner function into the
- expected node_class objects.
-
- 'scan_check' - a function to be called to first check whether
- this node really needs to be scanned.
-
- 'recursive' - specifies that this scanner should be invoked
- recursively on all of the implicit dependencies it returns
- (the canonical example being #include lines in C source files).
- May be a callable, which will be called to filter the list
- of nodes found to select a subset for recursive scanning
- (the canonical example being only recursively scanning
- subdirectories within a directory).
+ This implements straightforward, single-pass scanning of a single file.
+ """
+ def __init__(
+ self,
+ function,
+ name="NONE",
+ argument=_null,
+ skeys=_null,
+ path_function=None,
+ # Node.FS.Base so that, by default, it's okay for a
+ # scanner to return a Dir, File or Entry.
+ node_class=SCons.Node.FS.Base,
+ node_factory=None,
+ scan_check=None,
+ recursive=None,
+ ):
+ """Construct a new scanner object given a scanner function.
The scanner function's first argument will be a Node that should
be scanned for dependencies, the second argument will be an
@@ -152,14 +103,55 @@ class Base:
Examples:
- s = Scanner(my_scanner_function)
-
- s = Scanner(function = my_scanner_function)
-
- s = Scanner(function = my_scanner_function, argument = 'foo')
+ s = Scanner(my_scanner_function)
+ s = Scanner(function = my_scanner_function)
+ s = Scanner(function = my_scanner_function, argument = 'foo')
+
+ Args:
+ function: a scanner function taking two or three arguments
+ and returning a list of strings.
+
+ name: a name for identifying this scanner object.
+
+ argument: an optional argument that, if specified, will be
+ passed to both the scanner function and the path_function.
+
+ skeys: an optional list argument that can be used
+ to determine which scanner should be used for a given
+ Node. In the case of File nodes, for example, the 'skeys'
+ would be file suffixes.
+
+ path_function: a function that takes four or five arguments
+ (a construction environment, Node for the directory
+ containing the SConscript file that defined the primary
+ target, list of target nodes, list of source nodes, and
+ optional argument for this instance) and returns a tuple
+ of the directories that can be searched for implicit
+ dependency files. May also return a callable() which
+ is called with no args and returns the tuple (supporting
+ Bindable class).
+
+ node_class: the class of Nodes which this scan will return.
+ If node_class is None, then this scanner will not enforce
+ any Node conversion and will return the raw results from
+ the underlying scanner function.
+
+ node_factory: the factory function to be called to
+ translate the raw results returned by the scanner function
+ into the expected node_class objects.
+
+ scan_check: a function to be called to first check whether
+ this node really needs to be scanned.
+
+ recursive: specifies that this scanner should be invoked
+ recursively on all of the implicit dependencies it returns
+ (the canonical example being #include lines in C source
+ files). May be a callable, which will be called to filter
+ the list of nodes found to select a subset for recursive
+ scanning (the canonical example being only recursively
+ scanning subdirectories within a directory).
"""
-
# Note: this class could easily work with scanner functions that take
# something other than a filename as an argument (e.g. a database
# node) and a dependencies list that aren't file names. All that
@@ -196,11 +188,15 @@ class Base:
return self.path_function(env, dir, target, source)
def __call__(self, node, env, path=()):
- """
- This method scans a single object. 'node' is the node
- that will be passed to the scanner function, and 'env' is the
- environment that will be passed to the scanner function. A list of
- direct dependency nodes for the specified node will be returned.
+ """Scans a single object.
+
+ Args:
+ node: the node that will be passed to the scanner function
+ env: the environment that will be passed to the scanner function.
+
+ Returns:
+ A list of direct dependency nodes for the specified node.
+
"""
if self.scan_check and not self.scan_check(node, env):
return []