summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons
diff options
context:
space:
mode:
authorAdam Gross <grossag@vmware.com>2020-01-10 17:49:12 (GMT)
committerAdam Gross <grossag@vmware.com>2020-01-10 17:49:12 (GMT)
commit16a7153d8564fe9f14bac7e6ec4136dbbef6df5a (patch)
tree609db401f9ff5ca4e3e160b52508e3bb78427e6a /src/engine/SCons
parent125a9e0dda8ff8870fc608f1c33661f5d8203fcf (diff)
downloadSCons-16a7153d8564fe9f14bac7e6ec4136dbbef6df5a.zip
SCons-16a7153d8564fe9f14bac7e6ec4136dbbef6df5a.tar.gz
SCons-16a7153d8564fe9f14bac7e6ec4136dbbef6df5a.tar.bz2
Add a Tool that hooks up the python scanner
Diffstat (limited to 'src/engine/SCons')
-rw-r--r--src/engine/SCons/Tool/__init__.py2
-rw-r--r--src/engine/SCons/Tool/python.py49
2 files changed, 51 insertions, 0 deletions
diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py
index 14306ab..99a958c 100644
--- a/src/engine/SCons/Tool/__init__.py
+++ b/src/engine/SCons/Tool/__init__.py
@@ -1312,6 +1312,8 @@ def tool_list(platform, env):
'tar', 'zip',
# File builders (text)
'textfile',
+ # Python scanner tool
+ 'python',
], env)
tools = ([linker, c_compiler, cxx_compiler,
diff --git a/src/engine/SCons/Tool/python.py b/src/engine/SCons/Tool/python.py
new file mode 100644
index 0000000..c61fc8d
--- /dev/null
+++ b/src/engine/SCons/Tool/python.py
@@ -0,0 +1,49 @@
+"""SCons.Tool.python
+
+Registers the Python scanner for the supported Python source file suffixes.
+
+"""
+
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# 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.Tool
+from SCons.Scanner.Python import PythonScanner, PythonSuffixes
+
+
+def generate(env):
+ """Hook the python builder and scanner into the environment."""
+ for suffix in PythonSuffixes:
+ SCons.Tool.SourceFileScanner.add_scanner(suffix, PythonScanner)
+
+
+def exists(env):
+ return True
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: