[Scons-users] TeX newglossary and variant_dir

Kendrick Boyd kendrick.boyd at gmail.com
Sat Aug 9 18:18:17 EDT 2014


Hello,

When using the \newglossary command from the TeX package glossaries, also
using a variant_dir causes the SCons build to fail because makeindex isn't
looking in the correct directory:

makeindex dissertation.nto -s dissertation.ist -t dissertation.ntg -o
dissertation.nts
Input index file dissertation.nto not found.
Usage: makeindex [-ilqrcgLT] [-s sty] [-o ind] [-t log] [-p num] [idx0 idx1
...]
makeindex (newglossary) returned an error, check the .ntg file
pdflatex returned an error, check the log file
scons: *** [build/report/dissertation.pdf] Error 1
scons: building terminated because of errors.

The bug appears to be a simple typo in the MakeNewGlossaryAction in tex.py.
The attached patch fixes the problem for me and also includes a simple test
for the buggy behavior.

Regards,
Kendrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140809/94649b31/attachment-0001.html>
-------------- next part --------------
# HG changeset patch
# User Kendrick Boyd <kendrick.boyd at gmail.com>
# Date 1407620731 18000
#      Sat Aug 09 16:45:31 2014 -0500
# Node ID 20b5eeffe4d645064f00fa48ef6618a2ca5e0882
# Parent  4d0047e4dd50273ce5e187b7c2edb9ed24dc9d8d
Adds test for TeX newglossary with variant_dir.

diff -r 4d0047e4dd50 -r 20b5eeffe4d6 test/TEX/variant_dir_newglossary.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/TEX/variant_dir_newglossary.py	Sat Aug 09 16:45:31 2014 -0500
@@ -0,0 +1,109 @@
+#!/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__"
+
+"""
+Validate the use of \newglossary in TeX source files in conjuction
+with variant_dir. 
+
+Test configuration contributed by Kendrick Boyd.
+"""
+
+import os
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+latex = test.where_is('latex')
+
+if not latex:
+    test.skip_test("Could not find latex; skipping test(s).\n")
+
+gloss = os.system('kpsewhich glossaries.sty')
+if not gloss==0:
+    test.skip_test("glossaries.sty not installed; skipping test(s).\n")
+
+
+test.subdir(['src'])
+
+test.write(['SConstruct'], r"""
+import os
+
+env = Environment(TOOLS = ['tex', 'latex'])
+Export(['env'])
+
+SConscript(os.path.join('src','SConscript'), variant_dir='build/', duplicate=1)
+""")
+
+test.write(['src', 'SConscript'], r"""
+Import('env')
+
+test_pdf = env.PDF(source='test.tex')
+
+""")
+
+test.write(['src', 'test.tex'], r"""
+\documentclass{report}
+
+\usepackage{glossaries}
+
+\newglossary[ntg]{notation}{nts}{nto}{List of Notation}
+
+\makeglossary
+
+\newglossaryentry{pi}{type=notation, name={$\pi$}, description={ratio
+    of circumference to diameter of a circle}}
+
+\begin{document}
+
+\glsaddall
+
+\printglossary[type=notation, style=list]
+
+\end{document}
+""")
+
+test.run(arguments = '.', stderr = None)
+
+files = [
+    'test.aux',
+    'test.fls',
+    'test.glg',
+    'test.glo',
+    'test.gls',
+    'test.ist',
+    'test.log',
+    'test.ntg',
+    'test.nto',
+    'test.nts',
+    'test.pdf',
+]
+
+for f in files:
+    test.must_exist(['build',f])
+    test.must_not_exist(['src',f])
+    
+
+test.pass_test()
# HG changeset patch
# User Kendrick Boyd <kendrick.boyd at gmail.com>
# Date 1407620777 18000
#      Sat Aug 09 16:46:17 2014 -0500
# Node ID ac169967f441f35a9832498655d8ac10e253172a
# Parent  20b5eeffe4d645064f00fa48ef6618a2ca5e0882
Fixes TeX newglossary command to work with variant_dir.

diff -r 20b5eeffe4d6 -r ac169967f441 src/engine/SCons/Tool/tex.py
--- a/src/engine/SCons/Tool/tex.py	Sat Aug 09 16:45:31 2014 -0500
+++ b/src/engine/SCons/Tool/tex.py	Sat Aug 09 16:46:17 2014 -0500
@@ -431,7 +431,7 @@
                 if Verbose:
                     print "Need to run makeindex for newglossary"
                 newglfile = suffix_nodes[newglossary_suffix[ig][2]]
-                MakeNewGlossaryAction = SCons.Action.Action("$MAKENEWGLOSSARY ${SOURCE.filebase}%s -s ${SOURCE.filebase}.ist -t ${SOURCE.filebase}%s -o ${SOURCE.filebase}%s" % (newglossary_suffix[ig][2],newglossary_suffix[ig][0],newglossary_suffix[ig][1]), "$MAKENEWGLOSSARYCOMSTR")
+                MakeNewGlossaryAction = SCons.Action.Action("$MAKENEWGLOSSARYCOM ${SOURCE.filebase}%s -s ${SOURCE.filebase}.ist -t ${SOURCE.filebase}%s -o ${SOURCE.filebase}%s" % (newglossary_suffix[ig][2],newglossary_suffix[ig][0],newglossary_suffix[ig][1]), "$MAKENEWGLOSSARYCOMSTR")
 
                 result = MakeNewGlossaryAction(newglfile, newglfile, env)
                 if result != 0:


More information about the Scons-users mailing list