5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Validate that use of \makeindex in TeX source files causes SCons to be
29 aware of the necessary created index files.
31 Test configuration courtesy Joel B. Mohler.
36 test = TestSCons.TestSCons()
38 pdflatex = test.where_is('pdflatex')
39 makeindex = test.where_is('makeindex')
41 if not pdflatex or not makeindex:
42 test.skip_test("Could not find pdflatex or makeindex; skipping test(s).\n")
44 test.write('SConstruct', """\
46 env = Environment(tools = ['pdftex', 'dvipdf', 'tex', 'latex'],
47 ENV = {'PATH' : os.environ['PATH']})
48 env.PDF( "no_index.tex" )
49 env.PDF( "simple.tex" )
52 test.write('no_index.tex', r"""
53 \documentclass{article}
56 Nothing to see here, move along!
60 test.write('simple.tex', r"""
61 \documentclass{article}
67 I would like to \index{index} this.
70 I'll index \index{this} as well.
76 # Bleah, makeindex seems to print a bunch of diagnostic stuff on stderr,
77 # so we have to ignore it.
78 test.run(arguments = '.', stderr=None)
80 test.must_exist(test.workpath('simple.aux'))
81 test.must_exist(test.workpath('simple.idx'))
82 test.must_exist(test.workpath('simple.ilg'))
83 test.must_exist(test.workpath('simple.ind'))
85 test.must_exist(test.workpath('no_index.aux'))
87 test.must_not_exist(test.workpath('no_index.idx'))
88 test.must_not_exist(test.workpath('no_index.ilg'))
89 test.must_not_exist(test.workpath('no_index.ind'))
91 test.run(arguments = '-c .')
93 x = "Could not remove 'no_index.aux': No such file or directory"
94 test.must_not_contain_any_line(test.stdout(), [x])
95 x = "Could not remove 'simple.aux': No such file or directory"
96 test.must_not_contain_any_line(test.stdout(), [x])
98 test.must_not_exist(test.workpath('simple.aux'))
99 test.must_not_exist(test.workpath('simple.idx'))
100 test.must_not_exist(test.workpath('simple.ilg'))
101 test.must_not_exist(test.workpath('simple.ind'))
103 test.must_not_exist(test.workpath('no_index.aux'))