Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4f4e920

Browse files
committed
Use a Python script to create "empty" indexes. This solves Guido's
corrupted file problem and avoids the shell escape interpretation portability problem. ;-( See comments at top of newind.py for an explanation.
1 parent bdab730 commit 4f4e920

3 files changed

Lines changed: 48 additions & 3 deletions

File tree

Doc/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ DOCDESTDIR= $LIBDEST/doc
6565
EMACS= emacs
6666
PYTHON= python
6767
MAKEINFO= makeinfo
68+
# When debugging partparse.py, make this the pyc file:
6869
PARTPARSEOBJ= partparse.pyc
6970
PARTPARSE= $(PYTHON) $(PARTPARSEOBJ)
7071

@@ -163,8 +164,8 @@ LIBFILES = lib.tex \
163164

164165
# Library document
165166
lib.dvi: modindex.py indfix.py $(LIBFILES)
166-
echo '\\begin{theindex}\end{theindex}' >$*.ind
167-
echo '\\begin{theindex}\label{modindex}\end{theindex}' >mod$*.ind
167+
./newind.py >$*.ind
168+
./newind.py modindex >mod$*.ind
168169
$(LATEX) $*
169170
./modindex.py mod$*.idx
170171
./fix_hack $*.idx
@@ -180,7 +181,7 @@ tut.dvi: tut.tex
180181
# Extending & Embedding, Python/C API documents.
181182
# Done this way to avoid repeated command sets.
182183
.tex.dvi:
183-
echo '\\''begin{theindex}\end{theindex}' >$*.ind
184+
./newind.py >$*.ind
184185
$(LATEX) $*
185186
./fix_hack $*.idx
186187
$(MAKEINDEX) $*.idx

Doc/newind.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#! /usr/bin/env python
2+
3+
"""Really nasty little script to create an empty, labeled index on stdout.
4+
5+
Do it this way since some shells seem to work badly (and differently) with
6+
the leading '\b' for the first output line. Specifically, /bin/sh on
7+
Solaris doesn't seem to get it right. Once the quoting works there, it
8+
doesn't work on Linux any more. ;-(
9+
"""
10+
__version__ = '$Revision$'
11+
# $Source$
12+
13+
import sys
14+
15+
if sys.argv[1:]:
16+
label = sys.argv[1]
17+
else:
18+
label = "genindex"
19+
20+
print "\\begin{theindex}"
21+
print "\\label{%s}" % label
22+
print "\\end{theindex}"

Doc/tools/newind.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#! /usr/bin/env python
2+
3+
"""Really nasty little script to create an empty, labeled index on stdout.
4+
5+
Do it this way since some shells seem to work badly (and differently) with
6+
the leading '\b' for the first output line. Specifically, /bin/sh on
7+
Solaris doesn't seem to get it right. Once the quoting works there, it
8+
doesn't work on Linux any more. ;-(
9+
"""
10+
__version__ = '$Revision$'
11+
# $Source$
12+
13+
import sys
14+
15+
if sys.argv[1:]:
16+
label = sys.argv[1]
17+
else:
18+
label = "genindex"
19+
20+
print "\\begin{theindex}"
21+
print "\\label{%s}" % label
22+
print "\\end{theindex}"

0 commit comments

Comments
 (0)