Created script to generate pydoc documentation. Works for me, but has some rough edges.

This commit is contained in:
frisco 2009-01-03 18:53:36 +00:00
parent c1a086f3e4
commit 7be740e01a

77
scripts/mk_pydoc.sh Executable file
View file

@ -0,0 +1,77 @@
#!/bin/bash
#mk_pydocs.sh
#
#This script creates new or updated browsable documentation from the Python
#docstrings in CryptoNAS. It must be run from the "trunk" directory.
#In addition, SVN must know about the "trunk/src" directory (i.e
#"trunk/src" or one of its parents must have been checked out previously).
set -e
##?? which version of epydoc is REALLY required?
PYTHONPATH="src"
##Define variables which name programs
EPYDOC=epydoc
RM="rm"
MV="mv"
MKDIR="mkdir"
TAR="tar"
PYDOC_ACTIONS="--html"
##Output directory (note that this appears to require an absolute path name)
DOCTREE="/home/jcrofts/src/pydoc/"
REVISION="`svn info src | grep -E 'Last Changed Rev: [[:digit:]]' | grep -o -E '[[:digit:]]+'`"
##Version string for html doc output
DOC_VSTRING="cnas-html_r${REVISION}"
##Name of temporary directory used for epydoc output
TEMP_HTML_PATH="${DOCTREE}cnas-html.temp"
##Final name of epydoc output directory
HTML_PATH="${DOCTREE}cnas-html"
##TODO: make sure sandbox is up-to-date
## Assume we are being run from the "trunk" directory
PYDOC_PROJNAME=CryptoNAS
PYDOC_URL="http://devel.cryptobox.org/"
PYDOC_OPTIONS="--show-sourcecode --verbose"
export PYTHONPATH=/home/jcrofts/src/trunk/src
##TODO: save build log somewhere...
#TODO: I bet there's a way to do this more cleanly using find -exec '{}' or something
## (or maybe not. Bash isn't Python.)
SOURCES=`find ${PYTHONPATH} -name '*.py'`
##Make a temporary directory in the doc tree
$MKDIR -p "${TEMP_HTML_PATH}"
##Generate pydocs in the temp directory
$EPYDOC $PYDOC_ACTIONS $PYDOC_OPTIONS --output=${TEMP_HTML_PATH} $SOURCES
##Remove the old docs directory
$RM -rf "${HTML_PATH}"
##Rename the new temp doc directory
$MV "${TEMP_HTML_PATH}" "${HTML_PATH}"
$RM -f ${DOCTREE}*.tgz
##Create compressed archive of newly-created docs
$TAR -czf "${DOCTREE}/${DOC_VSTRING}.tgz" "${HTML_PATH}"
##Not implemented yet (TODO)
#LFTP=
#LFTP_OPTIONS=
#LFTP_HOST=
#LFTP_DIR=
##If LFTP is enabled, perform upload to server