3 # Simple little checker for individual libref manual sections
5 # usage: makesec.sh section
8 # This script builds the minimal file necessary to run a single section
9 # through latex, does so, then converts the resulting dvi file to ps or pdf
10 # and feeds the result into a viewer. It's by no means foolproof, but seems
11 # to work okay for me (knock wood). It sure beats manually commenting out
12 # most of the man lib.tex file and running everything manually.
14 # It attempts to locate an appropriate dvi converter and viewer for the
15 # selected output format. It understands the following environment
18 # PYSRC - refers to the root of your build tree (dir containing Doc)
19 # DVICVT - refers to a dvi converter like dvips or dvipdf
20 # VIEWER - refers to an appropriate viewer for the ps/pdf file
22 # Of the three, only PYSRC is currently required. The other two can be set
23 # to specify unusual tools which perform those tasks.
26 # - It would be nice if the script could determine PYSRC on its own.
27 # - Something about \seealso{}s blows the latex stack, so they need
28 # to be commented out for now.
30 if [ x
$PYSRC = x
] ; then
31 echo "PYSRC must refer to the Python source tree" 1>&2
35 if [ ! -d $PYSRC/Doc
] ; then
36 echo "Can't find a Doc subdirectory in $PYSRC" 1>&2
40 if [ "$#" -ne 1 ] ; then
41 echo "Must specify a single libref manual section on cmd line" 1>&2
45 # settle on a dvi converter
46 if [ x
$DVICVT != x
] ; then
48 ext
=`echo $DVICVT | sed -e 's/^dvi//'`
50 elif [ x
`which dvipdf` != x
] ; then
51 converter
=`which dvipdf`
53 elif [ x
`which dvips` != x
] ; then
54 converter
=`which dvips`
57 echo "Can't find a reasonable dvi converter" 1>&2
58 echo "Set DVICVT to refer to one" 1>&2
63 if [ x
$VIEWER != x
] ; then
65 elif [ $ext = ".ps" -a x
`which gv` != x
] ; then
67 elif [ $ext = ".ps" -a x
`which gs` != x
] ; then
69 elif [ $ext = ".pdf" -a x
`which acroread` != x
] ; then
71 elif [ $ext = ".pdf" -a "`uname`" = "Darwin" -a x
`which open` != x
] ; then
73 elif [ $ext = ".pdf" -a x
`which acroread` != x
] ; then
76 echo "Can't find a reasonable viewer" 1>&2
77 echo "Set VIEWER to refer to one" 1>&2
81 # make sure necessary links are in place
82 for f
in howto.cls pypaper.sty
; do
87 export TEXINPUTS
=.
:$PYSRC/Doc
/texinputs
:
89 # strip extension in case they gave full filename
90 inp
=`basename $1 .tex`
92 # create the minimal framework necessary to run section through latex
95 \documentclass{manual}
97 % NOTE: this file controls which chapters/sections of the library
98 % manual are actually printed. It is easy to customize your manual
99 % by commenting out sections that you are not interested in.
101 \title{Python Library Reference}
105 \makeindex % tell \index to actually write the
107 \makemodindex % ... and the module index as well.
115 \chapter*{Front Matter\label{front}}
128 rm -f $tmpf howto.cls pypaper.sty
*.idx
*.syn