added test of len() method for SQLTable
[pygr.git] / doc / tools / push-docs.sh
blob28a4b31589d1cf61bfab69224b28601b8af21814
1 #! /bin/sh
3 # Script to push docs from my development area to SourceForge, where the
4 # update-docs.sh script unpacks them into their final destination.
6 TARGETHOST=www.python.org
7 TARGETDIR=/usr/home/fdrake/tmp
9 PKGTYPE="bzip" # must be one of: bzip, tar, zip ("tar" implies gzip)
11 TARGET="$TARGETHOST:$TARGETDIR"
13 ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org'
15 TOOLDIR="`dirname $0`"
16 VERSION=`$TOOLDIR/getversioninfo`
18 # Set $EXTRA to something non-empty if this is a non-trunk version:
19 EXTRA=`echo "$VERSION" | sed 's/^[0-9][0-9]*\.[0-9][0-9]*//'`
21 if echo "$EXTRA" | grep -q '[.]' ; then
22 DOCLABEL="maintenance"
23 DOCTYPE="maint"
24 else
25 DOCLABEL="development"
26 DOCTYPE="devel"
29 DOCTYPE_SPECIFIED=false
30 EXPLANATION=''
31 ANNOUNCE=true
33 getopt -T >/dev/null
34 if [ $? -eq 4 ] ; then
35 # We have a sufficiently useful getopt(1) implementation.
36 eval "set -- `getopt -ssh m:p:qt:F: \"$@\"`"
37 else
38 # This version of getopt doesn't support quoting of long options
39 # with spaces, so let's not rely on it at all.
43 while [ "$#" -gt 0 ] ; do
44 case "$1" in
45 -m)
46 EXPLANATION="$2"
47 shift 2
49 -p)
50 PKGTYPE="$2"
51 shift 1
53 -q)
54 ANNOUNCE=false
55 shift 1
57 -t)
58 DOCTYPE="$2"
59 DOCTYPE_SPECIFIED=true
60 shift 2
62 -F)
63 EXPLANATION="`cat $2`"
64 shift 2
66 --)
67 shift 1
68 break
70 -*)
71 echo "Unknown option: $1" >&2
72 exit 2
75 break
77 esac
78 done
79 if [ "$1" ] ; then
80 if [ "$EXPLANATION" ] ; then
81 echo "Explanation may only be given once!" >&2
82 exit 2
84 EXPLANATION="$1"
85 shift
88 START="`pwd`"
89 MYDIR="`dirname $0`"
90 cd "$MYDIR"
91 MYDIR="`pwd`"
93 if [ "$PKGTYPE" = bzip ] ; then
94 PKGEXT=tar.bz2
95 elif [ "$PKGTYPE" = tar ] ; then
96 PKGEXT=tgz
97 elif [ "$PKGTYPE" = zip ] ; then
98 PKGEXT=zip
99 else
100 echo 1>&2 "unsupported package type: $PKGTYPE"
101 exit 2
104 # switch to .../Doc/
105 cd ..
107 # If $DOCTYPE was not specified explicitly, look for .doctype in
108 # .../Doc/ and use the content of that file if present.
109 if $DOCTYPE_SPECIFIED ; then
111 elif [ -f .doctype ] ; then
112 DOCTYPE="`cat .doctype`"
115 make --no-print-directory ${PKGTYPE}html || exit $?
116 PACKAGE="html-$VERSION.$PKGEXT"
117 scp "$PACKAGE" tools/update-docs.sh $TARGET/ || exit $?
118 ssh "$TARGETHOST" tmp/update-docs.sh $DOCTYPE $PACKAGE '&&' rm tmp/update-docs.sh || exit $?
120 if $ANNOUNCE ; then
121 sendmail $ADDRESSES <<EOF
122 To: $ADDRESSES
123 From: "Fred L. Drake" <fdrake@acm.org>
124 Subject: [$DOCLABEL doc updates]
125 X-No-Archive: yes
127 The $DOCLABEL version of the documentation has been updated:
129 http://$TARGETHOST/dev/doc/$DOCTYPE/
131 $EXPLANATION
133 A downloadable package containing the HTML is also available:
135 http://$TARGETHOST/dev/doc/python-docs-$DOCTYPE.$PKGEXT
137 exit $?