diff options
-rw-r--r-- | doc/man/scons.1 | 28 | ||||
-rw-r--r-- | src/CHANGES.txt | 13 | ||||
-rw-r--r-- | src/engine/SCons/Tool/latex.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Tool/pdflatex.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Tool/pdftex.py | 5 | ||||
-rw-r--r-- | src/engine/SCons/Tool/tex.py | 29 | ||||
-rw-r--r-- | test/TEX/LATEX.py (renamed from test/LATEX.py) | 0 | ||||
-rw-r--r-- | test/TEX/LATEXCOM.py | 69 | ||||
-rw-r--r-- | test/TEX/LATEXCOMSTR.py | 73 | ||||
-rw-r--r-- | test/TEX/LATEXFLAGS.py (renamed from test/LATEXFLAGS.py) | 0 | ||||
-rw-r--r-- | test/TEX/PDFLATEX.py (renamed from test/PDFLATEX.py) | 0 | ||||
-rw-r--r-- | test/TEX/PDFLATEXCOM.py | 69 | ||||
-rw-r--r-- | test/TEX/PDFLATEXCOMSTR.py | 74 | ||||
-rw-r--r-- | test/TEX/PDFLATEXFLAGS.py (renamed from test/PDFLATEXFLAGS.py) | 0 | ||||
-rw-r--r-- | test/TEX/PDFTEX.py (renamed from test/PDFTEX.py) | 0 | ||||
-rw-r--r-- | test/TEX/PDFTEXCOM.py | 69 | ||||
-rw-r--r-- | test/TEX/PDFTEXCOMSTR.py | 74 | ||||
-rw-r--r-- | test/TEX/PDFTEXFLAGS.py (renamed from test/PDFTEXFLAGS.py) | 0 | ||||
-rw-r--r-- | test/TEX/TEX.py (renamed from test/TEX.py) | 0 | ||||
-rw-r--r-- | test/TEX/TEXCOM.py | 69 | ||||
-rw-r--r-- | test/TEX/TEXCOMSTR.py | 73 | ||||
-rw-r--r-- | test/TEX/TEXFLAGS.py (renamed from test/TEXFLAGS.py) | 0 |
22 files changed, 629 insertions, 20 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1 index f620a9f..f83fc96 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -4503,6 +4503,16 @@ The command line used to call the bibliography generator for the TeX formatter and typesetter and the LaTeX structured formatter and typesetter. +.IP BIBTEXCOMSTR +The string displayed when generating a bibliography +for TeX or LaTeX. +If this is not set, then $BIBTEXCOM (the command line) is displayed. + +.ES +env = Environment(BIBTEXCOMSTR = "Generating bibliography $TARGET") +.EE + + .IP BIBTEXFLAGS General options passed to the bibliography generator for the TeX formatter and typesetter and the LaTeX structured formatter and typesetter. @@ -5584,6 +5594,15 @@ The LaTeX structured formatter and typesetter. .IP LATEXCOM The command line used to call the LaTeX structured formatter and typesetter. +.IP LATEXCOMSTR +The string displayed when calling +the LaTeX structured formatter and typesetter. +If this is not set, then $LATEXCOM (the command line) is displayed. + +.ES +env = Environment(LATEXCOMSTR = "Building $TARGET from LaTeX input $SOURCES") +.EE + .IP LATEXFLAGS General options passed to the LaTeX structured formatter and typesetter. @@ -6764,6 +6783,15 @@ The TeX formatter and typesetter. .IP TEXCOM The command line used to call the TeX formatter and typesetter. +.IP TEXCOMSTR +The string displayed when calling +the TeX formatter and typesetter. +If this is not set, then $TEXCOM (the command line) is displayed. + +.ES +env = Environment(TEXCOMSTR = "Building $TARGET from TeX input $SOURCES") +.EE + .IP TEXFLAGS General options passed to the TeX formatter and typesetter. diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 40d8454..ebfc13c 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -130,14 +130,15 @@ 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 new construction variables: $ARCOMSTR, $ASCOMSTR, - $ASPPCOMSTR, $BITKEEPERCOMSTR, $CCCOMSTR, $CVSCOMSTR, $CXXCOMSTR, - $F77COMSTR, $F90COMSTR, $F95COMSTR, $FORTRANCOMSTR, $JARCOMSTR, - $JAVACCOMSTR, $JAVAHCOMSTR, $LEXCOMSTR, $LINKCOMSTR, $RCSCOMSTR, + - 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, $YACCCOMSTR and $ZIPCOMSTR. + $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/latex.py b/src/engine/SCons/Tool/latex.py index 7bbec6f..f182b35 100644 --- a/src/engine/SCons/Tool/latex.py +++ b/src/engine/SCons/Tool/latex.py @@ -37,7 +37,7 @@ import SCons.Action import SCons.Defaults import SCons.Util -LaTeXAction = SCons.Action.Action('$LATEXCOM') +LaTeXAction = SCons.Action.Action('$LATEXCOM', '$LATEXCOMSTR') def generate(env): """Add Builders and construction variables for LaTeX to an Environment.""" diff --git a/src/engine/SCons/Tool/pdflatex.py b/src/engine/SCons/Tool/pdflatex.py index b1a559a..57c6e2d 100644 --- a/src/engine/SCons/Tool/pdflatex.py +++ b/src/engine/SCons/Tool/pdflatex.py @@ -37,7 +37,7 @@ import SCons.Action import SCons.Defaults import SCons.Util -PDFLaTeXAction = SCons.Action.Action('$PDFLATEXCOM') +PDFLaTeXAction = SCons.Action.Action('$PDFLATEXCOM', '$PDFLATEXCOMSTR') def generate(env): """Add Builders and construction variables for pdflatex to an Environment.""" diff --git a/src/engine/SCons/Tool/pdftex.py b/src/engine/SCons/Tool/pdftex.py index 3d2add0..366151e 100644 --- a/src/engine/SCons/Tool/pdftex.py +++ b/src/engine/SCons/Tool/pdftex.py @@ -33,9 +33,12 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import SCons.Action import SCons.Defaults import SCons.Util +PDFTeXAction = SCons.Action.Action('$PDFTEXCOM', '$PDFTEXCOMSTR') + def generate(env): """Add Builders and construction variables for pdftex to an Environment.""" try: @@ -44,7 +47,7 @@ def generate(env): bld = SCons.Defaults.PDF() env['BUILDERS']['PDF'] = bld - bld.add_action('.tex', '$PDFTEXCOM') + bld.add_action('.tex', PDFTeXAction) env['PDFTEX'] = 'pdftex' env['PDFTEXFLAGS'] = SCons.Util.CLVar('') diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index b9257ea..db2664a 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -45,14 +45,14 @@ import SCons.Util # Define an action to build a generic tex file. This is sufficient for all # tex files. -TeXAction = SCons.Action.CommandAction("$TEXCOM") +TeXAction = SCons.Action.Action("$TEXCOM", "$TEXCOMSTR") # Define an action to build a latex file. This action might be needed more # than once if we are dealing with labels and bibtex -LaTeXAction = SCons.Action.CommandAction("$LATEXCOM") +LaTeXAction = SCons.Action.Action("$LATEXCOM", "$LATEXCOMSTR") # Define an action to run BibTeX on a file. -BibTeXAction = SCons.Action.CommandAction("$BIBTEXCOM") +BibTeXAction = SCons.Action.Action("$BIBTEXCOM", "$BIBTEXCOMSTR") def LaTeXAuxAction(target = None, source= None, env=None): """A builder for LaTeX files that checks the output in the aux file @@ -74,22 +74,29 @@ def LaTeXAuxAction(target = None, source= None, env=None): LaTeXAction(target,source,env) return 0 -def TeXLaTeXAction(target = None, source= None, env=None): +LaTeX_re = re.compile("\\\\document(style|class)") + +def is_LaTeX(flist): + # Scan a file list to decide if it's TeX- or LaTeX-flavored. + for f in flist: + content = f.get_contents() + if LaTeX_re.search(content): + return 1 + return 0 + +def TeXLaTeXFunction(target = None, source= None, env=None): """A builder for TeX and LaTeX that scans the source file to decide the "flavor" of the source and then executes the appropriate program.""" - LaTeXFile = None - for src in source: - content = src.get_contents() - if re.search("\\\\document(style|class)",content): - LaTeXFile = 1 - break - if LaTeXFile: + if is_LaTeX(source): LaTeXAuxAction(target,source,env) else: TeXAction(target,source,env) return 0 +TeXLaTeXAction = SCons.Action.Action(TeXLaTeXFunction, + strfunction=None) + def generate(env): """Add Builders and construction variables for TeX to an Environment.""" try: diff --git a/test/LATEX.py b/test/TEX/LATEX.py index 4ed080f..4ed080f 100644 --- a/test/LATEX.py +++ b/test/TEX/LATEX.py diff --git a/test/TEX/LATEXCOM.py b/test/TEX/LATEXCOM.py new file mode 100644 index 0000000..803d26d --- /dev/null +++ b/test/TEX/LATEXCOM.py @@ -0,0 +1,69 @@ +#!/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 $LATEXCOM construction variable. +""" + +import os +import string +import sys +import TestSCons + +python = TestSCons.python +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +test.write('mylatex.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +infile = open(sys.argv[2], 'rb') +for l in filter(lambda l: l != '/*latex*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['latex'], + LATEXCOM = r'%(python)s mylatex.py $TARGET $SOURCE') +env.DVI('test1', 'test1.latex') +""" % locals()) + +test.write('test1.latex', """\ +test1.latex +/*latex*/ +""") + +test.run() + +test.must_match('test1.dvi', "test1.latex\n") + + + +test.pass_test() diff --git a/test/TEX/LATEXCOMSTR.py b/test/TEX/LATEXCOMSTR.py new file mode 100644 index 0000000..5e31301 --- /dev/null +++ b/test/TEX/LATEXCOMSTR.py @@ -0,0 +1,73 @@ +#!/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 $LATEXCOMSTR construction variable allows you to configure +the C compilation output. +""" + +import os +import string +import sys +import TestSCons + +python = TestSCons.python +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +test.write('mylatex.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +infile = open(sys.argv[2], 'rb') +for l in filter(lambda l: l != '/*latex*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['latex'], + LATEXCOM = r'%(python)s mylatex.py $TARGET $SOURCE', + LATEXCOMSTR = 'Building $TARGET from $SOURCE') +env.DVI('test1', 'test1.latex') +""" % locals()) + +test.write('test1.latex', """\ +test1.latex +/*latex*/ +""") + +test.run(stdout = test.wrap_stdout("""\ +Building test1.dvi from test1.latex +""" % locals())) + +test.must_match('test1.dvi', "test1.latex\n") + + + +test.pass_test() diff --git a/test/LATEXFLAGS.py b/test/TEX/LATEXFLAGS.py index badf85e..badf85e 100644 --- a/test/LATEXFLAGS.py +++ b/test/TEX/LATEXFLAGS.py diff --git a/test/PDFLATEX.py b/test/TEX/PDFLATEX.py index 4c6f84d..4c6f84d 100644 --- a/test/PDFLATEX.py +++ b/test/TEX/PDFLATEX.py diff --git a/test/TEX/PDFLATEXCOM.py b/test/TEX/PDFLATEXCOM.py new file mode 100644 index 0000000..f46ed37 --- /dev/null +++ b/test/TEX/PDFLATEXCOM.py @@ -0,0 +1,69 @@ +#!/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 $PDFLATEXCOM construction variable. +""" + +import os +import string +import sys +import TestSCons + +python = TestSCons.python +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +test.write('mypdflatex.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +infile = open(sys.argv[2], 'rb') +for l in filter(lambda l: l != '/*latex*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['pdflatex'], + PDFLATEXCOM = r'%(python)s mypdflatex.py $TARGET $SOURCE') +env.PDF('test1', 'test1.latex') +""" % locals()) + +test.write('test1.latex', """\ +test1.latex +/*latex*/ +""") + +test.run() + +test.must_match('test1.pdf', "test1.latex\n") + + + +test.pass_test() diff --git a/test/TEX/PDFLATEXCOMSTR.py b/test/TEX/PDFLATEXCOMSTR.py new file mode 100644 index 0000000..94cf121 --- /dev/null +++ b/test/TEX/PDFLATEXCOMSTR.py @@ -0,0 +1,74 @@ + +#!/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 $PDFLATEXCOMSTR construction variable allows you to configure +the C compilation output. +""" + +import os +import string +import sys +import TestSCons + +python = TestSCons.python +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +test.write('mypdflatex.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +infile = open(sys.argv[2], 'rb') +for l in filter(lambda l: l != '/*latex*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['pdflatex'], + PDFLATEXCOM = r'%(python)s mypdflatex.py $TARGET $SOURCE', + PDFLATEXCOMSTR = 'Building $TARGET from $SOURCE') +env.PDF('test1', 'test1.latex') +""" % locals()) + +test.write('test1.latex', """\ +test1.latex +/*latex*/ +""") + +test.run(stdout = test.wrap_stdout("""\ +Building test1.pdf from test1.latex +""" % locals())) + +test.must_match('test1.pdf', "test1.latex\n") + + + +test.pass_test() diff --git a/test/PDFLATEXFLAGS.py b/test/TEX/PDFLATEXFLAGS.py index 880d6d0..880d6d0 100644 --- a/test/PDFLATEXFLAGS.py +++ b/test/TEX/PDFLATEXFLAGS.py diff --git a/test/PDFTEX.py b/test/TEX/PDFTEX.py index 2015c33..2015c33 100644 --- a/test/PDFTEX.py +++ b/test/TEX/PDFTEX.py diff --git a/test/TEX/PDFTEXCOM.py b/test/TEX/PDFTEXCOM.py new file mode 100644 index 0000000..2a7f06b --- /dev/null +++ b/test/TEX/PDFTEXCOM.py @@ -0,0 +1,69 @@ +#!/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 $PDFTEXCOM construction variable. +""" + +import os +import string +import sys +import TestSCons + +python = TestSCons.python +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +test.write('mypdftex.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +infile = open(sys.argv[2], 'rb') +for l in filter(lambda l: l != '/*tex*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['pdftex'], + PDFTEXCOM = r'%(python)s mypdftex.py $TARGET $SOURCE') +env.PDF('test1') +""" % locals()) + +test.write('test1.tex', """\ +test1.tex +/*tex*/ +""") + +test.run() + +test.must_match('test1.pdf', "test1.tex\n") + + + +test.pass_test() diff --git a/test/TEX/PDFTEXCOMSTR.py b/test/TEX/PDFTEXCOMSTR.py new file mode 100644 index 0000000..dbb7b39 --- /dev/null +++ b/test/TEX/PDFTEXCOMSTR.py @@ -0,0 +1,74 @@ + +#!/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 $PDFTEXCOMSTR construction variable allows you to configure +the C compilation output. +""" + +import os +import string +import sys +import TestSCons + +python = TestSCons.python +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +test.write('mypdftex.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +infile = open(sys.argv[2], 'rb') +for l in filter(lambda l: l != '/*tex*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['pdftex'], + PDFTEXCOM = r'%(python)s mypdftex.py $TARGET $SOURCE', + PDFTEXCOMSTR = 'Building $TARGET from $SOURCE') +env.PDF('test1') +""" % locals()) + +test.write('test1.tex', """\ +test1.tex +/*tex*/ +""") + +test.run(stdout = test.wrap_stdout("""\ +Building test1.pdf from test1.tex +""" % locals())) + +test.must_match('test1.pdf', "test1.tex\n") + + + +test.pass_test() diff --git a/test/PDFTEXFLAGS.py b/test/TEX/PDFTEXFLAGS.py index fb1fbf0..fb1fbf0 100644 --- a/test/PDFTEXFLAGS.py +++ b/test/TEX/PDFTEXFLAGS.py diff --git a/test/TEX.py b/test/TEX/TEX.py index a2e69fa..a2e69fa 100644 --- a/test/TEX.py +++ b/test/TEX/TEX.py diff --git a/test/TEX/TEXCOM.py b/test/TEX/TEXCOM.py new file mode 100644 index 0000000..4957427 --- /dev/null +++ b/test/TEX/TEXCOM.py @@ -0,0 +1,69 @@ +#!/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 $TEXCOM construction variable. +""" + +import os +import string +import sys +import TestSCons + +python = TestSCons.python +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +test.write('mytex.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +infile = open(sys.argv[2], 'rb') +for l in filter(lambda l: l != '/*tex*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['tex'], + TEXCOM = r'%(python)s mytex.py $TARGET $SOURCE') +env.DVI('test1') +""" % locals()) + +test.write('test1.tex', """\ +test1.tex +/*tex*/ +""") + +test.run() + +test.must_match('test1.dvi', "test1.tex\n") + + + +test.pass_test() diff --git a/test/TEX/TEXCOMSTR.py b/test/TEX/TEXCOMSTR.py new file mode 100644 index 0000000..81e7123 --- /dev/null +++ b/test/TEX/TEXCOMSTR.py @@ -0,0 +1,73 @@ +#!/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 $TEXCOMSTR construction variable allows you to configure +the C compilation output. +""" + +import os +import string +import sys +import TestSCons + +python = TestSCons.python +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +test.write('mytex.py', r""" +import sys +outfile = open(sys.argv[1], 'wb') +infile = open(sys.argv[2], 'rb') +for l in filter(lambda l: l != '/*tex*/\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(TOOLS = ['tex'], + TEXCOM = r'%(python)s mytex.py $TARGET $SOURCE', + TEXCOMSTR = 'Building $TARGET from $SOURCE') +env.DVI('test1') +""" % locals()) + +test.write('test1.tex', """\ +test1.tex +/*tex*/ +""") + +test.run(stdout = test.wrap_stdout("""\ +Building test1.dvi from test1.tex +""" % locals())) + +test.must_match('test1.dvi', "test1.tex\n") + + + +test.pass_test() diff --git a/test/TEXFLAGS.py b/test/TEX/TEXFLAGS.py index fa5edb6..fa5edb6 100644 --- a/test/TEXFLAGS.py +++ b/test/TEX/TEXFLAGS.py |