blob: 673a969db3fcdcc878ec03087d71282237c666be [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
37TEXINPUTS=$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 Drake58ff1121998-05-11 19:06:26 +000042echo "$latex $part"
Fred Drakebf332691998-05-07 17:28:42 +000043$latex $part || exit $?
Fred Drakeefa641c1999-02-15 19:27:07 +000044if [ "$aux" ] ; then
45 # make sure the .dvi isn't interpreted as useful:
46 rm $part.dvi
Fred Drake53608791998-05-07 01:38:16 +000047else
Fred Drakeefa641c1999-02-15 19:27:07 +000048 if [ -f $part.idx ] ; then
49 # using the index
50 echo $srcdir'/tools/fix_hack '$part'.idx'
51 $srcdir/tools/fix_hack $part.idx || exit $?
52 echo 'makeindex -s '$srcdir'/texinputs/python.ist '$part'.idx'
53 makeindex -s $srcdir/texinputs/python.ist $part.idx || exit $?
54 else
55 # skipping the index; clean up the unused file
56 rm -f $part.ind
57 fi
58 if [ "$pdf" ] ; then
59 echo $srcdir'/tools/toc2bkm.py '$part
60 $srcdir/tools/toc2bkm.py $part
61 fi
62 echo "$latex $part"
63 $latex $part || exit $?
Fred Drake53608791998-05-07 01:38:16 +000064fi