Fred Drake | 5360879 | 1998-05-07 01:38:16 +0000 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | # |
Fred Drake | efa641c | 1999-02-15 19:27:07 +0000 | [diff] [blame] | 3 | # 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 Drake | 5360879 | 1998-05-07 01:38:16 +0000 | [diff] [blame] | 15 | |
| 16 | WORKDIR=`pwd` |
| 17 | cd `dirname $0`/.. |
| 18 | srcdir=`pwd` |
| 19 | cd $WORKDIR |
| 20 | |
Fred Drake | bf33269 | 1998-05-07 17:28:42 +0000 | [diff] [blame] | 21 | latex=latex |
Fred Drake | efa641c | 1999-02-15 19:27:07 +0000 | [diff] [blame] | 22 | aux='' |
| 23 | pdf='' |
Fred Drake | bf33269 | 1998-05-07 17:28:42 +0000 | [diff] [blame] | 24 | if [ "$1" = "--pdf" ] ; then |
| 25 | pdf=true |
| 26 | latex=pdflatex |
| 27 | shift 1 |
Fred Drake | efa641c | 1999-02-15 19:27:07 +0000 | [diff] [blame] | 28 | elif [ "$1" = "--aux" ] ; then |
| 29 | aux=true |
| 30 | shift 1 |
| 31 | elif [ "$1" = "--dvi" ] ; then |
| 32 | shift 1 |
Fred Drake | bf33269 | 1998-05-07 17:28:42 +0000 | [diff] [blame] | 33 | fi |
Fred Drake | 5360879 | 1998-05-07 01:38:16 +0000 | [diff] [blame] | 34 | |
Fred Drake | bf33269 | 1998-05-07 17:28:42 +0000 | [diff] [blame] | 35 | part=$1; shift 1 |
| 36 | |
| 37 | TEXINPUTS=$srcdir/$part:$TEXINPUTS |
Fred Drake | 5360879 | 1998-05-07 01:38:16 +0000 | [diff] [blame] | 38 | export TEXINPUTS |
| 39 | |
Fred Drake | 58ff112 | 1998-05-11 19:06:26 +0000 | [diff] [blame] | 40 | echo $srcdir'/tools/newind.py >'$part'.ind' |
Fred Drake | bf33269 | 1998-05-07 17:28:42 +0000 | [diff] [blame] | 41 | $srcdir/tools/newind.py >$part.ind || exit $? |
Fred Drake | 79d41cc | 1999-04-14 05:02:06 +0000 | [diff] [blame^] | 42 | echo $srcdir'/tools/newind.py modindex >mod'$part'.ind' |
| 43 | $srcdir/tools/newind.py modindex >mod$part.ind || exit $? |
Fred Drake | 58ff112 | 1998-05-11 19:06:26 +0000 | [diff] [blame] | 44 | echo "$latex $part" |
Fred Drake | bf33269 | 1998-05-07 17:28:42 +0000 | [diff] [blame] | 45 | $latex $part || exit $? |
Fred Drake | 79d41cc | 1999-04-14 05:02:06 +0000 | [diff] [blame^] | 46 | if [ ! -f mod$part.idx ] ; then |
| 47 | echo "Not using module index; removing mod$part.ind" |
| 48 | rm mod$part.ind |
| 49 | fi |
Fred Drake | efa641c | 1999-02-15 19:27:07 +0000 | [diff] [blame] | 50 | if [ "$aux" ] ; then |
| 51 | # make sure the .dvi isn't interpreted as useful: |
| 52 | rm $part.dvi |
Fred Drake | 5360879 | 1998-05-07 01:38:16 +0000 | [diff] [blame] | 53 | else |
Fred Drake | efa641c | 1999-02-15 19:27:07 +0000 | [diff] [blame] | 54 | 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 $? |
| 60 | else |
| 61 | # skipping the index; clean up the unused file |
| 62 | rm -f $part.ind |
| 63 | fi |
Fred Drake | 79d41cc | 1999-04-14 05:02:06 +0000 | [diff] [blame^] | 64 | if [ -f mod$part.idx ] ; then |
| 65 | # using the index |
| 66 | echo $srcdir'/tools/fix_hack mod'$part'.idx' |
| 67 | $srcdir/tools/fix_hack mod$part.idx || exit $? |
| 68 | echo 'makeindex -s '$srcdir'/texinputs/python.ist mod'$part'.idx' |
| 69 | makeindex -s $srcdir/texinputs/python.ist mod$part.idx || exit $? |
| 70 | fi |
Fred Drake | efa641c | 1999-02-15 19:27:07 +0000 | [diff] [blame] | 71 | if [ "$pdf" ] ; then |
| 72 | echo $srcdir'/tools/toc2bkm.py '$part |
| 73 | $srcdir/tools/toc2bkm.py $part |
| 74 | fi |
| 75 | echo "$latex $part" |
| 76 | $latex $part || exit $? |
Fred Drake | 5360879 | 1998-05-07 01:38:16 +0000 | [diff] [blame] | 77 | fi |