TOOLSDIR=$(TOPDIR)/tools
HTMLDIR=$(TOPDIR)/html
+# The emacs binary used to build the info docs. GNU Emacs 21 is required.
+EMACS=emacs
+
MKINFO=$(TOOLSDIR)/mkinfo
-SCRIPTS=$(TOOLSDIR)/html2texi.pl $(TOOLSDIR)/checkargs.pm $(TOOLSDIR)/mkinfo \
- $(TOOLSDIR)/fixinfo.el
+SCRIPTS=$(TOOLSDIR)/checkargs.pm $(TOOLSDIR)/mkinfo $(TOOLSDIR)/py2texi.el
+
+# set VERSION to code the VERSION number into the info file name
+# allowing installation of more than one set of python info docs
+# into the same directory
+VERSION=
-all: python-api.info python-ext.info python-lib.info \
- python-ref.info python-tut.info \
- python-dist.info python-inst.info
+all: check-emacs-version \
+ python$(VERSION)-api.info python$(VERSION)-ext.info \
+ python$(VERSION)-lib.info python$(VERSION)-ref.info \
+ python$(VERSION)-tut.info python$(VERSION)-dist.info
+# python$(VERSION)-doc.info python$(VERSION)-inst.info
+# python$(VERSION)-mac.info
-python-api.info: $(HTMLDIR)/api/api.html $(SCRIPTS)
- $(MKINFO) $<
+check-emacs-version:
+ @v="`$(EMACS) --version 2>&1 | egrep '^(GNU |X)Emacs [12]*'`"; \
+ if `echo "$$v" | grep '^GNU Emacs 21' >/dev/null 2>&1`; then \
+ echo "Using $(EMACS) to build the info docs"; \
+ else \
+ echo "GNU Emacs 21 is required to build the info docs"; \
+ echo "Found $$v"; \
+ false; \
+ fi
-python-ext.info: $(HTMLDIR)/ext/ext.html $(SCRIPTS)
- $(MKINFO) $<
+python$(VERSION)-api.info: ../api/api.tex $(SCRIPTS)
+ EMACS=$(EMACS) $(MKINFO) $< $@
-python-lib.info: $(HTMLDIR)/lib/lib.html $(SCRIPTS)
- $(MKINFO) $<
+python$(VERSION)-ext.info: ../ext/ext.tex $(SCRIPTS)
+ EMACS=$(EMACS) $(MKINFO) $< $@
+
+python$(VERSION)-lib.info: ../lib/lib.tex $(SCRIPTS)
+ EMACS=$(EMACS) $(MKINFO) $< $@
# Not built by default; the conversion doesn't really handle it well.
-python-mac.info: $(HTMLDIR)/mac/mac.html $(SCRIPTS)
- $(MKINFO) $<
+python$(VERSION)-mac.info: ../mac/mac.tex $(SCRIPTS)
+ EMACS=$(EMACS) $(MKINFO) $< $@
+
+python$(VERSION)-ref.info: ../ref/ref.tex $(SCRIPTS)
+ EMACS=$(EMACS) $(MKINFO) $< $@
-python-ref.info: $(HTMLDIR)/ref/ref.html $(SCRIPTS)
- $(MKINFO) $<
+python$(VERSION)-tut.info: ../tut/tut.tex $(SCRIPTS)
+ EMACS=$(EMACS) $(MKINFO) $< $@
-python-tut.info: $(HTMLDIR)/tut/tut.html $(SCRIPTS)
- $(MKINFO) $<
+# Not built by default; the conversion doesn't handle it at all.
+python$(VERSION)-doc.info: ../doc/doc.tex $(SCRIPTS)
+ EMACS=$(EMACS) $(MKINFO) $< $@
-python-dist.info: $(HTMLDIR)/dist/dist.html $(SCRIPTS)
- $(MKINFO) $<
+python$(VERSION)-dist.info: ../dist/dist.tex $(SCRIPTS)
+ EMACS=$(EMACS) $(MKINFO) $< $@
-python-inst.info: $(HTMLDIR)/inst/inst.html $(SCRIPTS)
- $(MKINFO) $<
+# Not built by default; the conversion chokes on two @end multitable's
+python$(VERSION)-inst.info: ../inst/inst.tex $(SCRIPTS)
+ EMACS=$(EMACS) $(MKINFO) $< $@
clean:
rm -f *.texi~ *.texi
clobber: clean
- rm -f *.texi python-*.info python-*.info-[0-9]*
-
-
-# This makes sure we can build info files from a "clean" tree,
-# in case we haven't already built the HTML:
-
-$(HTMLDIR)/api/api.html:
- cd $(HTMLDIR) && $(MAKE) api
-
-$(HTMLDIR)/ext/ext.html:
- cd $(HTMLDIR) && $(MAKE) ext
-
-$(HTMLDIR)/lib/lib.html:
- cd $(HTMLDIR) && $(MAKE) lib
-
-$(HTMLDIR)/mac/mac.html:
- cd $(HTMLDIR) && $(MAKE) mac
-
-$(HTMLDIR)/ref/ref.html:
- cd $(HTMLDIR) && $(MAKE) ref
-
-$(HTMLDIR)/tut/tut.html:
- cd $(HTMLDIR) && $(MAKE) tut
-
-$(HTMLDIR)/dist/dist.html:
- cd $(HTMLDIR) && $(MAKE) dist
-
-$(HTMLDIR)/inst/inst.html:
- cd $(HTMLDIR) && $(MAKE) inst
+ rm -f *.texi python*-*.info python*-*.info-[0-9]*
FILENAME="$1"
DOCDIR=`dirname "$FILENAME"`
DOCFILE=`basename "$FILENAME"`
-DOCNAME=`basename "$FILENAME" .html`
+DOCNAME=`basename "$FILENAME" .tex`
+if [ $# -gt 1 ]; then
+ INFONAME="$2"
+else
+ INFONAME="python-$DOCNAME.info"
+fi
# Now build the real directory names, and locate our support stuff:
WORKDIR=`pwd`
run() {
# show what we're doing, like make does:
echo "$*"
- $* || exit $?
+ "$@" || exit $?
}
# generate the Texinfo file:
-run $PERL -I$TOOLSDIR $TOOLSDIR/html2texi.pl $DOCDIR/$DOCFILE
-run $EMACS -batch -l $TOOLSDIR/fixinfo.el $DOCNAME.texi
-rm -f $DOCNAME.texi~
+run $EMACS -batch -q --no-site-file -l $TOOLSDIR/py2texi.el \
+ --eval "(setq py2texi-dirs '(\"./\" \"../texinputs/\" \"$DOCDIR\"))" \
+ --eval "(py2texi \"$DOCDIR/$DOCFILE\")" \
+ -f kill-emacs
+echo Done
# generate the .info files:
run $MAKEINFO --footnote-style end --fill-column 72 \
- --paragraph-indent 0 $DOCNAME.texi
+ --paragraph-indent 0 --output=$INFONAME $DOCNAME.texi