From: stevenknight Date: Fri, 3 Dec 2004 04:09:35 +0000 (+0000) Subject: More command-line customizability: , , , , . X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=b289a2ac3fb18473084895214bec7d4527f0c2ca;p=scons.git More command-line customizability: , , , , . git-svn-id: http://scons.tigris.org/svn/scons/trunk@1179 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/doc/man/scons.1 b/doc/man/scons.1 index f620a9f6..f83fc969 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 40d84541..ebfc13c2 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 7bbec6f5..f182b359 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 b1a559a9..57c6e2de 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 3d2add0d..366151e6 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 b9257ea3..db2664a3 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 similarity index 100% rename from test/LATEX.py rename to test/TEX/LATEX.py diff --git a/test/TEX/LATEXCOM.py b/test/TEX/LATEXCOM.py new file mode 100644 index 00000000..803d26d2 --- /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 00000000..5e31301e --- /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 similarity index 100% rename from test/LATEXFLAGS.py rename to test/TEX/LATEXFLAGS.py diff --git a/test/PDFLATEX.py b/test/TEX/PDFLATEX.py similarity index 100% rename from test/PDFLATEX.py rename to test/TEX/PDFLATEX.py diff --git a/test/TEX/PDFLATEXCOM.py b/test/TEX/PDFLATEXCOM.py new file mode 100644 index 00000000..f46ed37a --- /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 00000000..94cf1213 --- /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 similarity index 100% rename from test/PDFLATEXFLAGS.py rename to test/TEX/PDFLATEXFLAGS.py diff --git a/test/PDFTEX.py b/test/TEX/PDFTEX.py similarity index 100% rename from test/PDFTEX.py rename to test/TEX/PDFTEX.py diff --git a/test/TEX/PDFTEXCOM.py b/test/TEX/PDFTEXCOM.py new file mode 100644 index 00000000..2a7f06be --- /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 00000000..dbb7b39d --- /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 similarity index 100% rename from test/PDFTEXFLAGS.py rename to test/TEX/PDFTEXFLAGS.py diff --git a/test/TEX.py b/test/TEX/TEX.py similarity index 100% rename from test/TEX.py rename to test/TEX/TEX.py diff --git a/test/TEX/TEXCOM.py b/test/TEX/TEXCOM.py new file mode 100644 index 00000000..4957427a --- /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 00000000..81e71234 --- /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 similarity index 100% rename from test/TEXFLAGS.py rename to test/TEX/TEXFLAGS.py