blob: 880192d1c3fa4a5fb7c72f6ba91d4a32089e86d1 [file] [log] [blame]
Fred Drake53608791998-05-07 01:38:16 +00001#! /bin/sh
2#
Fred Drakeefa641c1999-02-15 19:27:07 +00003# Build one of the simple documents. This can be used to create the DVI,
4# PDF, or LaTeX "aux" files. It can accept one of three optional parameters:
5#
6# --aux Create only the LaTeX .aux file
7# --dvi Create the DeVice Independent output
8# --pdf Create Adobe PDF output
9#
10# If no parameter is given, DVI output is produced.
11#
12# One positional parameter is required: the "base" of the document to
13# format. For the standard Python documentation, this will be api, ext,
14# lib, mac, ref, or tut.
Fred Drake53608791998-05-07 01:38:16 +000015
16WORKDIR=`pwd`
17cd `dirname $0`/..
18srcdir=`pwd`
19cd $WORKDIR
20
Fred Drakebf332691998-05-07 17:28:42 +000021latex=latex
Fred Drakeefa641c1999-02-15 19:27:07 +000022aux=''
23pdf=''
Fred Drakebf332691998-05-07 17:28:42 +000024if [ "$1" = "--pdf" ] ; then
25 pdf=true
26 latex=pdflatex
27 shift 1
Fred Drakeefa641c1999-02-15 19:27:07 +000028elif [ "$1" = "--aux" ] ; then
29 aux=true
30 shift 1
31elif [ "$1" = "--dvi" ] ; then
32 shift 1
Fred Drakebf332691998-05-07 17:28:42 +000033fi
Fred Drake53608791998-05-07 01:38:16 +000034
Fred Drakebf332691998-05-07 17:28:42 +000035part=$1; shift 1
36
Fred Drakeba828782000-04-03 04:19:14 +000037TEXINPUTS=.:$srcdir/$part:$TEXINPUTS
Fred Drake53608791998-05-07 01:38:16 +000038export TEXINPUTS
39
Fred Drake58ff1121998-05-11 19:06:26 +000040echo $srcdir'/tools/newind.py >'$part'.ind'
Fred Drakebf332691998-05-07 17:28:42 +000041$srcdir/tools/newind.py >$part.ind || exit $?
Fred Drake79d41cc1999-04-14 05:02:06 +000042echo $srcdir'/tools/newind.py modindex >mod'$part'.ind'
43$srcdir/tools/newind.py modindex >mod$part.ind || exit $?
Fred Drake58ff1121998-05-11 19:06:26 +000044echo "$latex $part"
Fred Drakebf332691998-05-07 17:28:42 +000045$latex $part || exit $?
Fred Drake79d41cc1999-04-14 05:02:06 +000046if [ ! -f mod$part.idx ] ; then
47 echo "Not using module index; removing mod$part.ind"
Fred Drakec260c0b1999-04-14 13:13:32 +000048 rm mod$part.ind || exit $?
Fred Drake79d41cc1999-04-14 05:02:06 +000049fi
Fred Drakeefa641c1999-02-15 19:27:07 +000050if [ "$aux" ] ; then
51 # make sure the .dvi isn't interpreted as useful:
Fred Drakec260c0b1999-04-14 13:13:32 +000052 rm $part.dvi || exit $?
Fred Drake53608791998-05-07 01:38:16 +000053else
Fred Drakeefa641c1999-02-15 19:27:07 +000054 if [ -f $part.idx ] ; then
55 # using the index
56 echo $srcdir'/tools/fix_hack '$part'.idx'
57 $srcdir/tools/fix_hack $part.idx || exit $?
58 echo 'makeindex -s '$srcdir'/texinputs/python.ist '$part'.idx'
59 makeindex -s $srcdir/texinputs/python.ist $part.idx || exit $?
Fred Drakec260c0b1999-04-14 13:13:32 +000060 echo $srcdir'/tools/indfix.py '$part'.ind'
61 $srcdir/tools/indfix.py $part.ind || exit $?
Fred Drakeefa641c1999-02-15 19:27:07 +000062 else
63 # skipping the index; clean up the unused file
64 rm -f $part.ind
65 fi
Fred Drake79d41cc1999-04-14 05:02:06 +000066 if [ -f mod$part.idx ] ; then
67 # using the index
Fred Drake79d41cc1999-04-14 05:02:06 +000068 echo 'makeindex -s '$srcdir'/texinputs/python.ist mod'$part'.idx'
69 makeindex -s $srcdir/texinputs/python.ist mod$part.idx || exit $?
70 fi
Fred Drakeefa641c1999-02-15 19:27:07 +000071 if [ "$pdf" ] ; then
72 echo $srcdir'/tools/toc2bkm.py '$part
Fred Drakec260c0b1999-04-14 13:13:32 +000073 $srcdir/tools/toc2bkm.py $part || exit $?
Fred Drakeefa641c1999-02-15 19:27:07 +000074 fi
75 echo "$latex $part"
76 $latex $part || exit $?
Fred Drake53608791998-05-07 01:38:16 +000077fi