source: vendor/python/2.5/Doc/tools/push-docs.sh

Last change on this file was 3225, checked in by bird, 18 years ago

Python 2.5

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