summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2005-01-06 01:39:03 (GMT)
committerSteven Knight <knight@baldmt.com>2005-01-06 01:39:03 (GMT)
commit8209788c5d6a2554317a13416bb953b6c3f572ab (patch)
tree94c9d4e2e123a270c35f30c4b8691f1feeb0f2e3
parent1344c9c2297d5e0931bfcd15a853b13d8e5caf34 (diff)
downloadSCons-8209788c5d6a2554317a13416bb953b6c3f572ab.zip
SCons-8209788c5d6a2554317a13416bb953b6c3f572ab.tar.gz
SCons-8209788c5d6a2554317a13416bb953b6c3f572ab.tar.bz2
More command-line customizability: , , , , , , .
-rw-r--r--doc/man/scons.133
-rw-r--r--src/CHANGES.txt20
-rw-r--r--src/engine/SCons/Tool/Perforce.py8
-rw-r--r--src/engine/SCons/Tool/dmd.py19
-rw-r--r--src/engine/SCons/Tool/dvipdf.py5
-rw-r--r--src/engine/SCons/Tool/dvips.py5
-rw-r--r--src/engine/SCons/Tool/gs.py5
-rw-r--r--src/engine/SCons/Tool/m4.py4
-rw-r--r--src/engine/SCons/Tool/swig.py7
-rw-r--r--test/DVIPDF/DVIPDF.py (renamed from test/DVIPDF.py)0
-rw-r--r--test/DVIPDF/DVIPDFCOM.py63
-rw-r--r--test/DVIPDF/DVIPDFCOMSTR.py67
-rw-r--r--test/DVIPDF/DVIPDFFLAGS.py (renamed from test/DVIPDFFLAGS.py)0
-rw-r--r--test/DVIPS/DVIPS.py (renamed from test/DVIPS.py)0
-rw-r--r--test/DVIPS/DVIPSFLAGS.py (renamed from test/DVIPSFLAGS.py)0
-rw-r--r--test/DVIPS/PSCOM.py63
-rw-r--r--test/DVIPS/PSCOMSTR.py67
-rw-r--r--test/Ghostscript/GS.py (renamed from test/GS.py)0
-rw-r--r--test/Ghostscript/GSCOM.py63
-rw-r--r--test/Ghostscript/GSCOMSTR.py67
-rw-r--r--test/M4/M4.py (renamed from test/M4.py)0
-rw-r--r--test/M4/M4COM.py63
-rw-r--r--test/M4/M4COMSTR.py67
-rw-r--r--test/Perforce/P4COM.py121
-rw-r--r--test/Perforce/P4COMSTR.py122
-rw-r--r--test/Perforce/Perforce.py (renamed from test/Perforce.py)0
-rw-r--r--test/SWIG/SWIG.py (renamed from test/SWIG.py)0
-rw-r--r--test/SWIG/SWIGCOM.py66
-rw-r--r--test/SWIG/SWIGCOMSTR.py71
29 files changed, 984 insertions, 22 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1
index 38a3822..f195c62 100644
--- a/doc/man/scons.1
+++ b/doc/man/scons.1
@@ -4918,6 +4918,11 @@ General options passed to the TeX DVI file to PDF file converter.
.IP DVIPDFCOM
The command line used to convert TeX DVI files into a PDF file.
+.IP DVIPDFCOMSTR
+The string displayed when a TeX DVI file
+is converted into a PDF file.
+If this is not set, then $DVIPDFCOM (the command line) is displayed.
+
.IP DVIPS
The TeX DVI file to PostScript converter.
@@ -5477,6 +5482,12 @@ when converting PostScript to PDF files.
.IP GSCOM
The Ghostscript command line used to convert PostScript to PDF files.
+.IP GSCOMSTR
+The string displayed when
+Ghostscript is used to convert
+a PostScript file to a PDF file.
+If this is not set, then $GSCOM (the command line) is displayed.
+
.IP IDLSUFFIXES
The list of suffixes of files that will be scanned
for IDL implicit dependencies
@@ -5838,7 +5849,12 @@ The M4 macro preprocessor.
General options passed to the M4 macro preprocessor.
.IP M4COM
-The command line used to pass files through the macro preprocessor.
+The command line used to pass files through the M4 macro preprocessor.
+
+.IP M4COMSTR
+The string displayed when
+a file is passed through the M4 macro preprocessor.
+If this is not set, then $M4COM (the command line) is displayed.
.IP MAXLINELENGTH
The maximum number of characters allowed on an external command line.
@@ -6032,6 +6048,11 @@ The Perforce executable.
The command line used to
fetch source files from Perforce.
+.IP P4COMSTR
+The string displayed when
+fetching a source file from Perforce.
+If this is not set, then $P4COM (the command line) is displayed.
+
.IP P4FLAGS
General options that are passed to Perforce.
@@ -6143,6 +6164,11 @@ The suffix used for executable file names.
.IP PSCOM
The command line used to convert TeX DVI files into a PostScript file.
+.IP PSCOMSTR
+The string displayed when a TeX DVI file
+is converted into a PostScript file.
+If this is not set, then $PSCOM (the command line) is displayed.
+
.IP PSPREFIX
The prefix used for PostScript file names.
@@ -6753,6 +6779,11 @@ construction variable.
The command line used to call
the scripting language wrapper and interface generator.
+.IP SWIGCOMSTR
+The string displayed when calling
+the scripting language wrapper and interface generator.
+If this is not set, then $SWIGCOM (the command line) is displayed.
+
.IP SWIGCXXFILESUFFIX
The suffix that will be used for intermediate C++
source files generated by
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index ff2dd71..c2801bd 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -135,15 +135,17 @@ RELEASE 0.97 - XXX
- Fix expansion of env.Command() overrides within target and
source file names.
- - Support easier customization of what's displayed by various
- default actions by adding lots of new construction variables:
- $ARCOMSTR, $ASCOMSTR, $ASPPCOMSTR, $BIBTEXCOMSTR, $BITKEEPERCOMSTR,
- $CCCOMSTR, $CVSCOMSTR, $CXXCOMSTR, $F77COMSTR, $F90COMSTR, $F95COMSTR,
- $FORTRANCOMSTR, $JARCOMSTR, $JAVACCOMSTR, $JAVAHCOMSTR, $LATEXCOMSTR,
- $LEXCOMSTR, $LINKCOMSTR, $PDFLATEXCOMSTR, $PDFTEXCOMSTR, $RCSCOMSTR,
- $RMICCOMSTR, $SCCSCOMSTR, $SHCCCOMSTR, $SHCXXCOMSTR, $SHF77COMSTR,
- $SHF90COMSTR, $SHF95COMSTR, $SHFORTRANCOMSTR, $SHLINKCOMSTR,
- $TARCOMSTR, $TEXCOMSTR, $YACCCOMSTR and $ZIPCOMSTR.
+ - Support easier customization of what's displayed by various default
+ actions by adding lots of new construction variables: $ARCOMSTR,
+ $ASCOMSTR, $ASPPCOMSTR, $BIBTEXCOMSTR, $BITKEEPERCOMSTR, $CCCOMSTR,
+ $CVSCOMSTR, $CXXCOMSTR, $DCOMSTR, $DVIPDFCOMSTR, $F77COMSTR,
+ $F90COMSTR, $F95COMSTR, $FORTRANCOMSTR, $GSCOMSTR, $JARCOMSTR,
+ $JAVACCOMSTR, $JAVAHCOMSTR, $LATEXCOMSTR, $LEXCOMSTR, $LINKCOMSTR,
+ $M4COMSTR, $P4COMSTR, $PDFLATEXCOMSTR, $PDFTEXCOMSTR, $PSCOMSTR,
+ $RCSCOMSTR, $RMICCOMSTR, $SCCSCOMSTR, $SHCCCOMSTR, $SHCXXCOMSTR,
+ $SHF77COMSTR, $SHF90COMSTR, $SHF95COMSTR, $SHFORTRANCOMSTR,
+ $SHLINKCOMSTR, $SWIGCOMSTR, $TARCOMSTR, $TEXCOMSTR, $YACCCOMSTR
+ and $ZIPCOMSTR.
- Add an optional "map" keyword argument to ListOption() that takes a
dictionary to map user-specified values to legal values from the list
diff --git a/src/engine/SCons/Tool/Perforce.py b/src/engine/SCons/Tool/Perforce.py
index 0c6796c..22c75e9 100644
--- a/src/engine/SCons/Tool/Perforce.py
+++ b/src/engine/SCons/Tool/Perforce.py
@@ -35,6 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
+import SCons.Action
import SCons.Builder
import SCons.Node.FS
import SCons.Util
@@ -42,18 +43,21 @@ import SCons.Util
# This function should maybe be moved to SCons.Util?
from SCons.Tool.PharLapCommon import addPathIfNotExists
+
+
# Variables that we want to import from the base OS environment.
_import_env = [ 'P4PORT', 'P4CLIENT', 'P4USER', 'USER', 'USERNAME', 'P4PASSWD',
'P4CHARSET', 'P4LANGUAGE', 'SYSTEMROOT' ]
+PerforceAction = SCons.Action.Action('$P4COM', '$P4COMSTR')
+
def generate(env):
"""Add a Builder factory function and construction variables for
Perforce to an Environment."""
def PerforceFactory(env=env):
""" """
- return SCons.Builder.Builder(action = '$P4COM',
- env = env)
+ return SCons.Builder.Builder(action = PerforceAction, env = env)
#setattr(env, 'Perforce', PerforceFactory)
env.Perforce = PerforceFactory
diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py
index 5d773c3..914129c 100644
--- a/src/engine/SCons/Tool/dmd.py
+++ b/src/engine/SCons/Tool/dmd.py
@@ -58,10 +58,11 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import string
-import SCons.Tool
-import SCons.Scanner.D
+import SCons.Action
import SCons.Builder
import SCons.Defaults
+import SCons.Scanner.D
+import SCons.Tool
# Adapted from c++.py
def isD(source):
@@ -85,8 +86,10 @@ def generate(env):
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
- static_obj.add_action('.d', '$DCOM')
- shared_obj.add_action('.d', '$DCOM')
+ DAction = SCons.Action.Action('$DCOM', '$DCOMSTR')
+
+ static_obj.add_action('.d', DAction)
+ shared_obj.add_action('.d', DAction)
static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter)
shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter)
@@ -152,6 +155,10 @@ def generate(env):
def _smartLink(source, target, env, for_signature,
defaultLinker=linkcom):
if isD(source):
+ # XXX I'm not sure how to add a $DLINKCOMSTR variable
+ # so that it works with this _smartLink() logic,
+ # and I don't have a D compiler/linker to try it out,
+ # so we'll leave it alone for now.
return '$DLINKCOM'
else:
return defaultLinker
@@ -164,6 +171,10 @@ def generate(env):
def _smartLib(source, target, env, for_signature,
defaultLib=arcom):
if isD(source):
+ # XXX I'm not sure how to add a $DLIBCOMSTR variable
+ # so that it works with this _smartLib() logic, and
+ # I don't have a D compiler/archiver to try it out,
+ # so we'll leave it alone for now.
return '$DLIBCOM'
else:
return defaultLib
diff --git a/src/engine/SCons/Tool/dvipdf.py b/src/engine/SCons/Tool/dvipdf.py
index 8c51ac0..1ffb655 100644
--- a/src/engine/SCons/Tool/dvipdf.py
+++ b/src/engine/SCons/Tool/dvipdf.py
@@ -33,9 +33,12 @@ selection method.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.Action
import SCons.Defaults
import SCons.Util
+PDFAction = SCons.Action.Action('$DVIPDFCOM', '$DVIPDFCOMSTR')
+
def generate(env):
"""Add Builders and construction variables for dvipdf to an Environment."""
try:
@@ -43,7 +46,7 @@ def generate(env):
except KeyError:
bld = SCons.Defaults.PDF()
env['BUILDERS']['PDF'] = bld
- bld.add_action('.dvi', '$PDFCOM')
+ bld.add_action('.dvi', PDFAction)
env['DVIPDF'] = 'dvipdf'
env['DVIPDFFLAGS'] = SCons.Util.CLVar('')
diff --git a/src/engine/SCons/Tool/dvips.py b/src/engine/SCons/Tool/dvips.py
index d70d78d..d2debf0 100644
--- a/src/engine/SCons/Tool/dvips.py
+++ b/src/engine/SCons/Tool/dvips.py
@@ -34,10 +34,13 @@ selection method.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import SCons.Action
+import SCons.Builder
import SCons.Defaults
import SCons.Util
-PostScript = SCons.Builder.Builder(action = '$PSCOM',
+PSAction = SCons.Action.Action('$PSCOM', '$PSCOMSTR')
+
+PostScript = SCons.Builder.Builder(action = PSAction,
prefix = '$PSPREFIX',
suffix = '$PSSUFFIX',
src_suffix = '.dvi',
diff --git a/src/engine/SCons/Tool/gs.py b/src/engine/SCons/Tool/gs.py
index 2666189..7df110a 100644
--- a/src/engine/SCons/Tool/gs.py
+++ b/src/engine/SCons/Tool/gs.py
@@ -33,6 +33,7 @@ selection method.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.Action
import SCons.Defaults
import SCons.Platform
import SCons.Util
@@ -47,6 +48,8 @@ elif platform == 'win32':
else:
gs = 'gs'
+GhostscriptAction = SCons.Action.Action('$GSCOM', '$GSCOMSTR')
+
def generate(env):
"""Add Builders and construction variables for Ghostscript to an
Environment."""
@@ -56,7 +59,7 @@ def generate(env):
bld = SCons.Defaults.PDF()
env['BUILDERS']['PDF'] = bld
- bld.add_action('.ps', '$GSCOM')
+ bld.add_action('.ps', GhostscriptAction)
env['GS'] = gs
env['GSFLAGS'] = SCons.Util.CLVar('-dNOPAUSE -dBATCH -sDEVICE=pdfwrite')
diff --git a/src/engine/SCons/Tool/m4.py b/src/engine/SCons/Tool/m4.py
index 3fd2d66..06757bf 100644
--- a/src/engine/SCons/Tool/m4.py
+++ b/src/engine/SCons/Tool/m4.py
@@ -33,12 +33,14 @@ selection method.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.Action
import SCons.Builder
import SCons.Util
def generate(env):
"""Add Builders and construction variables for m4 to an Environment."""
- bld = SCons.Builder.Builder(action = '$M4COM', src_suffix = '.m4')
+ M4Action = SCons.Action.Action('$M4COM', '$M4COMSTR')
+ bld = SCons.Builder.Builder(action = M4Action, src_suffix = '.m4')
env['BUILDERS']['M4'] = bld
diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py
index 66e6011..449e3aa 100644
--- a/src/engine/SCons/Tool/swig.py
+++ b/src/engine/SCons/Tool/swig.py
@@ -33,10 +33,13 @@ selection method.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.Action
import SCons.Defaults
import SCons.Tool
import SCons.Util
+SwigAction = SCons.Action.Action('$SWIGCOM', '$SWIGCOMSTR')
+
def swigSuffixEmitter(env, source):
if '-c++' in SCons.Util.CLVar(env.subst("$SWIGFLAGS")):
return '$SWIGCXXFILESUFFIX'
@@ -50,8 +53,8 @@ def generate(env):
c_file.suffix['.i'] = swigSuffixEmitter
cxx_file.suffix['.i'] = swigSuffixEmitter
- c_file.add_action('.i', '$SWIGCOM')
- cxx_file.add_action('.i', '$SWIGCOM')
+ c_file.add_action('.i', SwigAction)
+ cxx_file.add_action('.i', SwigAction)
env['SWIG'] = 'swig'
env['SWIGFLAGS'] = SCons.Util.CLVar('')
diff --git a/test/DVIPDF.py b/test/DVIPDF/DVIPDF.py
index a140c3a..a140c3a 100644
--- a/test/DVIPDF.py
+++ b/test/DVIPDF/DVIPDF.py
diff --git a/test/DVIPDF/DVIPDFCOM.py b/test/DVIPDF/DVIPDFCOM.py
new file mode 100644
index 0000000..61d5ce7
--- /dev/null
+++ b/test/DVIPDF/DVIPDFCOM.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+#
+# __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__"
+
+"""
+Test the ability to configure the $DVIPDFCOM construction variable.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('mypdf.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+ infile = open(f, 'rb')
+ for l in filter(lambda l: l != '/*pdf*/\\n', infile.readlines()):
+ outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'dvipdf'],
+ DVIPDFCOM = r'%s mypdf.py $TARGET $SOURCES')
+env.PDF(target = 'aaa', source = 'aaa.dvi')
+""" % python)
+
+test.write('aaa.dvi', "aaa.dvi\n/*pdf*/\n")
+
+test.run()
+
+test.must_match('aaa.pdf', "aaa.dvi\n")
+
+
+
+test.pass_test()
diff --git a/test/DVIPDF/DVIPDFCOMSTR.py b/test/DVIPDF/DVIPDFCOMSTR.py
new file mode 100644
index 0000000..6e57adb
--- /dev/null
+++ b/test/DVIPDF/DVIPDFCOMSTR.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+#
+# __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__"
+
+"""
+Test that the $DVIPDFCOMSTR construction variable allows you to customize
+the displayed string when is called.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('mypdf.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+ infile = open(f, 'rb')
+ for l in filter(lambda l: l != '/*pdf*/\\n', infile.readlines()):
+ outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'dvipdf'],
+ DVIPDFCOM = r'%s mypdf.py $TARGET $SOURCES',
+ DVIPDFCOMSTR = 'DVIPDFing $TARGET from $SOURCE')
+env.PDF(target = 'aaa', source = 'aaa.dvi')
+""" % python)
+
+test.write('aaa.dvi', "aaa.dvi\n/*pdf*/\n")
+
+test.run(stdout = test.wrap_stdout("""\
+DVIPDFing aaa.pdf from aaa.dvi
+"""))
+
+test.must_match('aaa.pdf', "aaa.dvi\n")
+
+
+
+test.pass_test()
diff --git a/test/DVIPDFFLAGS.py b/test/DVIPDF/DVIPDFFLAGS.py
index e9bd8ba..e9bd8ba 100644
--- a/test/DVIPDFFLAGS.py
+++ b/test/DVIPDF/DVIPDFFLAGS.py
diff --git a/test/DVIPS.py b/test/DVIPS/DVIPS.py
index 2ae856a..2ae856a 100644
--- a/test/DVIPS.py
+++ b/test/DVIPS/DVIPS.py
diff --git a/test/DVIPSFLAGS.py b/test/DVIPS/DVIPSFLAGS.py
index 82e57c5..82e57c5 100644
--- a/test/DVIPSFLAGS.py
+++ b/test/DVIPS/DVIPSFLAGS.py
diff --git a/test/DVIPS/PSCOM.py b/test/DVIPS/PSCOM.py
new file mode 100644
index 0000000..65e66a2
--- /dev/null
+++ b/test/DVIPS/PSCOM.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+#
+# __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__"
+
+"""
+Test the ability to configure the $PSCOM construction variable.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('myps.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+ infile = open(f, 'rb')
+ for l in filter(lambda l: l != '/*ps*/\\n', infile.readlines()):
+ outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'dvips'],
+ PSCOM = r'%s myps.py $TARGET $SOURCES')
+env.PostScript(target = 'aaa', source = 'aaa.dvi')
+""" % python)
+
+test.write('aaa.dvi', "aaa.dvi\n/*ps*/\n")
+
+test.run()
+
+test.must_match('aaa.ps', "aaa.dvi\n")
+
+
+
+test.pass_test()
diff --git a/test/DVIPS/PSCOMSTR.py b/test/DVIPS/PSCOMSTR.py
new file mode 100644
index 0000000..9a565a4
--- /dev/null
+++ b/test/DVIPS/PSCOMSTR.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+#
+# __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__"
+
+"""
+Test that the $PSCOMSTR construction variable allows you to customize
+the displayed string when is called.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('myps.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+ infile = open(f, 'rb')
+ for l in filter(lambda l: l != '/*ps*/\\n', infile.readlines()):
+ outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'dvips'],
+ PSCOM = r'%s myps.py $TARGET $SOURCES',
+ PSCOMSTR = 'PostScripting $TARGET from $SOURCE')
+env.PostScript(target = 'aaa', source = 'aaa.dvi')
+""" % python)
+
+test.write('aaa.dvi', "aaa.dvi\n/*ps*/\n")
+
+test.run(stdout = test.wrap_stdout("""\
+PostScripting aaa.ps from aaa.dvi
+"""))
+
+test.must_match('aaa.ps', "aaa.dvi\n")
+
+
+
+test.pass_test()
diff --git a/test/GS.py b/test/Ghostscript/GS.py
index a836cf6..a836cf6 100644
--- a/test/GS.py
+++ b/test/Ghostscript/GS.py
diff --git a/test/Ghostscript/GSCOM.py b/test/Ghostscript/GSCOM.py
new file mode 100644
index 0000000..acd46f2
--- /dev/null
+++ b/test/Ghostscript/GSCOM.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+#
+# __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__"
+
+"""
+Test the ability to configure the $GSCOM construction variable.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('mygs.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+ infile = open(f, 'rb')
+ for l in filter(lambda l: l != '/*gs*/\\n', infile.readlines()):
+ outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'gs'],
+ GSCOM = r'%s mygs.py $TARGET $SOURCES')
+env.PDF(target = 'aaa', source = 'aaa.ps')
+""" % python)
+
+test.write('aaa.ps', "aaa.ps\n/*gs*/\n")
+
+test.run(arguments = '.')
+
+test.must_match('aaa.pdf', "aaa.ps\n")
+
+
+
+test.pass_test()
diff --git a/test/Ghostscript/GSCOMSTR.py b/test/Ghostscript/GSCOMSTR.py
new file mode 100644
index 0000000..9f7aee8
--- /dev/null
+++ b/test/Ghostscript/GSCOMSTR.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+#
+# __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__"
+
+"""
+Test that the $GSCOMSTR construction variable allows you to customize
+the displayed string when Ghostscript is called.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('mygs.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+ infile = open(f, 'rb')
+ for l in filter(lambda l: l != '/*gs*/\\n', infile.readlines()):
+ outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'gs'],
+ GSCOM = r'%s mygs.py $TARGET $SOURCES',
+ GSCOMSTR = 'GSing $TARGET from $SOURCE')
+env.PDF(target = 'aaa', source = 'aaa.ps')
+""" % python)
+
+test.write('aaa.ps', "aaa.ps\n/*gs*/\n")
+
+test.run(stdout = test.wrap_stdout("""\
+GSing aaa.pdf from aaa.ps
+"""))
+
+test.must_match('aaa.pdf', "aaa.ps\n")
+
+
+
+test.pass_test()
diff --git a/test/M4.py b/test/M4/M4.py
index bf56e74..bf56e74 100644
--- a/test/M4.py
+++ b/test/M4/M4.py
diff --git a/test/M4/M4COM.py b/test/M4/M4COM.py
new file mode 100644
index 0000000..d1c53b4
--- /dev/null
+++ b/test/M4/M4COM.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+#
+# __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__"
+
+"""
+Test the ability to configure the $M4COM construction variable.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('mym4.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+ infile = open(f, 'rb')
+ for l in filter(lambda l: l != '/*m4*/\\n', infile.readlines()):
+ outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'm4'],
+ M4COM = r'%s mym4.py $TARGET $SOURCES')
+env.M4(target = 'aaa.out', source = 'aaa.in')
+""" % python)
+
+test.write('aaa.in', "aaa.in\n/*m4*/\n")
+
+test.run(arguments = '.')
+
+test.must_match('aaa.out', "aaa.in\n")
+
+
+
+test.pass_test()
diff --git a/test/M4/M4COMSTR.py b/test/M4/M4COMSTR.py
new file mode 100644
index 0000000..0e14495
--- /dev/null
+++ b/test/M4/M4COMSTR.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+#
+# __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__"
+
+"""
+Test that the $M4COMSTR construction variable allows you to customize
+the displayed string when m4 is called.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('mym4.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+ infile = open(f, 'rb')
+ for l in filter(lambda l: l != '/*m4*/\\n', infile.readlines()):
+ outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'm4'],
+ M4COM = r'%s mym4.py $TARGET $SOURCES',
+ M4COMSTR = 'M4ing $TARGET from $SOURCE')
+env.M4(target = 'aaa.out', source = 'aaa.in')
+""" % python)
+
+test.write('aaa.in', "aaa.in\n/*m4*/\n")
+
+test.run(stdout = test.wrap_stdout("""\
+M4ing aaa.out from aaa.in
+"""))
+
+test.must_match('aaa.out', "aaa.in\n")
+
+
+
+test.pass_test()
diff --git a/test/Perforce/P4COM.py b/test/Perforce/P4COM.py
new file mode 100644
index 0000000..c33254a
--- /dev/null
+++ b/test/Perforce/P4COM.py
@@ -0,0 +1,121 @@
+#!/usr/bin/env python
+#
+# __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__"
+
+"""
+Test setting the $P4COM variable.
+"""
+
+import os.path
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+test.subdir('Perforce', ['Perforce', 'sub'], 'sub')
+
+sub_Perforce = os.path.join('sub', 'Perforce')
+sub_SConscript = os.path.join('sub', 'SConscript')
+sub_all = os.path.join('sub', 'all')
+sub_ddd_in = os.path.join('sub', 'ddd.in')
+sub_ddd_out = os.path.join('sub', 'ddd.out')
+sub_eee_in = os.path.join('sub', 'eee.in')
+sub_eee_out = os.path.join('sub', 'eee.out')
+sub_fff_in = os.path.join('sub', 'fff.in')
+sub_fff_out = os.path.join('sub', 'fff.out')
+
+test.write('my-p4.py', """
+import shutil
+import sys
+for f in sys.argv[1:]:
+ shutil.copy('Perforce/'+f, f)
+""")
+
+test.write('SConstruct', """
+def cat(env, source, target):
+ target = str(target[0])
+ source = map(str, source)
+ f = open(target, "wb")
+ for src in source:
+ f.write(open(src, "rb").read())
+ f.close()
+env = Environment(TOOLS = ['default', 'Perforce'],
+ BUILDERS={'Cat':Builder(action=cat)},
+ P4COM='%(python)s my-p4.py $TARGET')
+env.Cat('aaa.out', 'aaa.in')
+env.Cat('bbb.out', 'bbb.in')
+env.Cat('ccc.out', 'ccc.in')
+env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
+env.SourceCode('.', env.Perforce())
+SConscript('sub/SConscript', "env")
+""" % locals())
+
+test.write(['Perforce', 'sub', 'SConscript'], """\
+Import("env")
+env.Cat('ddd.out', 'ddd.in')
+env.Cat('eee.out', 'eee.in')
+env.Cat('fff.out', 'fff.in')
+env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
+""")
+
+test.write(['Perforce', 'aaa.in'], "Perforce/aaa.in\n")
+test.write('bbb.in', "checked-out bbb.in\n")
+test.write(['Perforce', 'ccc.in'], "Perforce/ccc.in\n")
+
+test.write(['Perforce', 'sub', 'ddd.in'], "Perforce/sub/ddd.in\n")
+test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n")
+test.write(['Perforce', 'sub', 'fff.in'], "Perforce/sub/fff.in\n")
+
+test.run(arguments = '.',
+ stdout = test.wrap_stdout(read_str = """\
+%(python)s my-p4.py %(sub_SConscript)s
+""" % locals(),
+ build_str = """\
+%(python)s my-p4.py aaa.in
+cat(["aaa.out"], ["aaa.in"])
+cat(["bbb.out"], ["bbb.in"])
+%(python)s my-p4.py ccc.in
+cat(["ccc.out"], ["ccc.in"])
+cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
+%(python)s my-p4.py %(sub_ddd_in)s
+cat(["%(sub_ddd_out)s"], ["%(sub_ddd_in)s"])
+cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"])
+%(python)s my-p4.py %(sub_fff_in)s
+cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"])
+cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"])
+""" % locals()))
+
+test.must_match('all',
+ "Perforce/aaa.in\nchecked-out bbb.in\nPerforce/ccc.in\n")
+
+test.must_match(['sub', 'all'],
+ "Perforce/sub/ddd.in\nchecked-out sub/eee.in\nPerforce/sub/fff.in\n")
+
+
+
+#
+test.pass_test()
diff --git a/test/Perforce/P4COMSTR.py b/test/Perforce/P4COMSTR.py
new file mode 100644
index 0000000..d9a3bc0
--- /dev/null
+++ b/test/Perforce/P4COMSTR.py
@@ -0,0 +1,122 @@
+#!/usr/bin/env python
+#
+# __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__"
+
+"""
+Test setting the $P4COMSTR variable.
+"""
+
+import os.path
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+test.subdir('Perforce', ['Perforce', 'sub'], 'sub')
+
+sub_Perforce = os.path.join('sub', 'Perforce')
+sub_SConscript = os.path.join('sub', 'SConscript')
+sub_all = os.path.join('sub', 'all')
+sub_ddd_in = os.path.join('sub', 'ddd.in')
+sub_ddd_out = os.path.join('sub', 'ddd.out')
+sub_eee_in = os.path.join('sub', 'eee.in')
+sub_eee_out = os.path.join('sub', 'eee.out')
+sub_fff_in = os.path.join('sub', 'fff.in')
+sub_fff_out = os.path.join('sub', 'fff.out')
+
+test.write('my-p4.py', """
+import shutil
+import sys
+for f in sys.argv[1:]:
+ shutil.copy('Perforce/'+f, f)
+""")
+
+test.write('SConstruct', """
+def cat(env, source, target):
+ target = str(target[0])
+ source = map(str, source)
+ f = open(target, "wb")
+ for src in source:
+ f.write(open(src, "rb").read())
+ f.close()
+env = Environment(TOOLS = ['default', 'Perforce'],
+ BUILDERS={'Cat':Builder(action=cat)},
+ P4COM='%(python)s my-p4.py $TARGET',
+ P4COMSTR='Checking out $TARGET from our fake Perforce')
+env.Cat('aaa.out', 'aaa.in')
+env.Cat('bbb.out', 'bbb.in')
+env.Cat('ccc.out', 'ccc.in')
+env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
+env.SourceCode('.', env.Perforce())
+SConscript('sub/SConscript', "env")
+""" % locals())
+
+test.write(['Perforce', 'sub', 'SConscript'], """\
+Import("env")
+env.Cat('ddd.out', 'ddd.in')
+env.Cat('eee.out', 'eee.in')
+env.Cat('fff.out', 'fff.in')
+env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
+""")
+
+test.write(['Perforce', 'aaa.in'], "Perforce/aaa.in\n")
+test.write('bbb.in', "checked-out bbb.in\n")
+test.write(['Perforce', 'ccc.in'], "Perforce/ccc.in\n")
+
+test.write(['Perforce', 'sub', 'ddd.in'], "Perforce/sub/ddd.in\n")
+test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n")
+test.write(['Perforce', 'sub', 'fff.in'], "Perforce/sub/fff.in\n")
+
+test.run(arguments = '.',
+ stdout = test.wrap_stdout(read_str = """\
+Checking out %(sub_SConscript)s from our fake Perforce
+""" % locals(),
+ build_str = """\
+Checking out aaa.in from our fake Perforce
+cat(["aaa.out"], ["aaa.in"])
+cat(["bbb.out"], ["bbb.in"])
+Checking out ccc.in from our fake Perforce
+cat(["ccc.out"], ["ccc.in"])
+cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
+Checking out %(sub_ddd_in)s from our fake Perforce
+cat(["%(sub_ddd_out)s"], ["%(sub_ddd_in)s"])
+cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"])
+Checking out %(sub_fff_in)s from our fake Perforce
+cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"])
+cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"])
+""" % locals()))
+
+test.must_match('all',
+ "Perforce/aaa.in\nchecked-out bbb.in\nPerforce/ccc.in\n")
+
+test.must_match(['sub', 'all'],
+ "Perforce/sub/ddd.in\nchecked-out sub/eee.in\nPerforce/sub/fff.in\n")
+
+
+
+#
+test.pass_test()
diff --git a/test/Perforce.py b/test/Perforce/Perforce.py
index 5808b23..5808b23 100644
--- a/test/Perforce.py
+++ b/test/Perforce/Perforce.py
diff --git a/test/SWIG.py b/test/SWIG/SWIG.py
index 2a0ee32..2a0ee32 100644
--- a/test/SWIG.py
+++ b/test/SWIG/SWIG.py
diff --git a/test/SWIG/SWIGCOM.py b/test/SWIG/SWIGCOM.py
new file mode 100644
index 0000000..22e217a
--- /dev/null
+++ b/test/SWIG/SWIGCOM.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+#
+# __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__"
+
+"""
+Test the ability to configure the $SWIGCOM construction variable.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('myswig.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+ infile = open(f, 'rb')
+ for l in filter(lambda l: l != '/*swig*/\\n', infile.readlines()):
+ outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'swig'],
+ SWIGCOM = r'%s myswig.py $TARGET $SOURCES')
+env.CFile(target = 'aaa', source = 'aaa.i')
+env.CXXFile(target = 'bbb', source = 'bbb.i', SWIGFLAGS='-c++')
+""" % python)
+
+test.write('aaa.i', "aaa.i\n/*swig*/\n")
+test.write('bbb.i', "bbb.i\n/*swig*/\n")
+
+test.run(arguments = '.')
+
+test.must_match('aaa_wrap.c', "aaa.i\n")
+test.must_match('bbb_wrap.cc', "bbb.i\n")
+
+
+
+test.pass_test()
diff --git a/test/SWIG/SWIGCOMSTR.py b/test/SWIG/SWIGCOMSTR.py
new file mode 100644
index 0000000..3ffcdbf
--- /dev/null
+++ b/test/SWIG/SWIGCOMSTR.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+#
+# __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__"
+
+"""
+Test that the $SWIGCOMSTR construction variable allows you to customize
+the displayed string when swig is called.
+"""
+
+import TestSCons
+
+python = TestSCons.python
+
+test = TestSCons.TestSCons()
+
+
+
+test.write('myswig.py', """
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+ infile = open(f, 'rb')
+ for l in filter(lambda l: l != '/*swig*/\\n', infile.readlines()):
+ outfile.write(l)
+sys.exit(0)
+""")
+
+test.write('SConstruct', """
+env = Environment(tools=['default', 'swig'],
+ SWIGCOM = r'%s myswig.py $TARGET $SOURCES',
+ SWIGCOMSTR = 'Swigging $TARGET from $SOURCE')
+env.CFile(target = 'aaa', source = 'aaa.i')
+env.CXXFile(target = 'bbb', source = 'bbb.i', SWIGFLAGS='-c++')
+""" % python)
+
+test.write('aaa.i', "aaa.i\n/*swig*/\n")
+test.write('bbb.i', "bbb.i\n/*swig*/\n")
+
+test.run(stdout = test.wrap_stdout("""\
+Swigging aaa_wrap.c from aaa.i
+Swigging bbb_wrap.cc from bbb.i
+"""))
+
+test.must_match('aaa_wrap.c', "aaa.i\n")
+test.must_match('bbb_wrap.cc', "bbb.i\n")
+
+
+
+test.pass_test()