From 7be740e01ad0370fd92d7d7d1fcfe92c2ad8b1d5 Mon Sep 17 00:00:00 2001 From: frisco <> Date: Sat, 3 Jan 2009 18:53:36 +0000 Subject: [PATCH] Created script to generate pydoc documentation. Works for me, but has some rough edges. --- scripts/mk_pydoc.sh | 77 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 scripts/mk_pydoc.sh diff --git a/scripts/mk_pydoc.sh b/scripts/mk_pydoc.sh new file mode 100755 index 0000000..48dabe3 --- /dev/null +++ b/scripts/mk_pydoc.sh @@ -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