Expanded SCons.Scanner.LaTeX.comment_re to not break on \%
[scons.git] / test / TEX / PDFTEXCOMSTR.py
1
2 #!/usr/bin/env python
3 #
4 # __COPYRIGHT__
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining
7 # a copy of this software and associated documentation files (the
8 # "Software"), to deal in the Software without restriction, including
9 # without limitation the rights to use, copy, modify, merge, publish,
10 # distribute, sublicense, and/or sell copies of the Software, and to
11 # permit persons to whom the Software is furnished to do so, subject to
12 # the following conditions:
13 #
14 # The above copyright notice and this permission notice shall be included
15 # in all copies or substantial portions of the Software.
16 #
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
18 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
19 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 #
25
26 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
27
28 """
29 Test that the $PDFTEXCOMSTR construction variable allows you to configure
30 the C compilation output.
31 """
32
33 import TestSCons
34
35 _python_ = TestSCons._python_
36 _exe   = TestSCons._exe
37
38 test = TestSCons.TestSCons()
39
40
41
42 test.write('mypdftex.py', r"""
43 import sys
44 outfile = open(sys.argv[1], 'wb')
45 infile = open(sys.argv[2], 'rb')
46 for l in [l for l in infile.readlines() if l != '/*tex*/\n']:
47     outfile.write(l)
48 sys.exit(0)
49 """)
50
51 test.write('SConstruct', """
52 env = Environment(TOOLS = ['pdftex'],
53                   PDFTEXCOM = r'%(_python_)s mypdftex.py $TARGET $SOURCE',
54                   PDFTEXCOMSTR = 'Building $TARGET from $SOURCE')
55 env.PDF('test1')
56 """ % locals())
57
58 test.write('test1.tex', """\
59 test1.tex
60 /*tex*/
61 """)
62
63 test.run(stdout = test.wrap_stdout("""\
64 Building test1.pdf from test1.tex
65 """ % locals()))
66
67 test.must_match('test1.pdf', "test1.tex\n")
68
69
70
71 test.pass_test()
72
73 # Local Variables:
74 # tab-width:4
75 # indent-tabs-mode:nil
76 # End:
77 # vim: set expandtab tabstop=4 shiftwidth=4: