Fred Drake | 692565c | 2000-10-19 05:54:51 +0000 | [diff] [blame] | 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 | |
Fred Drake | f54519d | 2002-04-01 20:15:05 +0000 | [diff] [blame] | 6 | TARGETHOST=www.python.org |
| 7 | TARGETDIR=/usr/home/fdrake/tmp |
| 8 | |
Fred Drake | 9e1ac24 | 2004-06-17 18:36:54 +0000 | [diff] [blame] | 9 | PKGTYPE="bzip" # must be one of: bzip, tar, zip ("tar" implies gzip) |
| 10 | |
Fred Drake | f54519d | 2002-04-01 20:15:05 +0000 | [diff] [blame] | 11 | TARGET="$TARGETHOST:$TARGETDIR" |
Fred Drake | 827bb9f | 2000-11-30 07:38:59 +0000 | [diff] [blame] | 12 | |
Fred Drake | 3f4e717 | 2001-03-02 21:05:58 +0000 | [diff] [blame] | 13 | ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' |
Fred Drake | 303e30e | 2004-11-02 19:18:20 +0000 | [diff] [blame^] | 14 | ADDRESSES=fdrake01@comcast.net |
Fred Drake | 3f4e717 | 2001-03-02 21:05:58 +0000 | [diff] [blame] | 15 | |
Fred Drake | 69db2b9 | 2003-09-28 22:14:29 +0000 | [diff] [blame] | 16 | TOOLDIR="`dirname $0`" |
| 17 | VERSION=`$TOOLDIR/getversioninfo` |
| 18 | |
| 19 | # Set $EXTRA to something non-empty if this is a non-trunk version: |
Fred Drake | 34b48e8 | 2001-04-22 06:20:31 +0000 | [diff] [blame] | 20 | EXTRA=`echo "$VERSION" | sed 's/^[0-9][0-9]*\.[0-9][0-9]*//'` |
Fred Drake | 69db2b9 | 2003-09-28 22:14:29 +0000 | [diff] [blame] | 21 | |
| 22 | if echo "$EXTRA" | grep -q '[.]' ; then |
Fred Drake | 34b48e8 | 2001-04-22 06:20:31 +0000 | [diff] [blame] | 23 | DOCLABEL="maintenance" |
| 24 | DOCTYPE="maint" |
| 25 | else |
| 26 | DOCLABEL="development" |
| 27 | DOCTYPE="devel" |
| 28 | fi |
| 29 | |
Fred Drake | 3f4e717 | 2001-03-02 21:05:58 +0000 | [diff] [blame] | 30 | EXPLANATION='' |
Fred Drake | e54acfd | 2001-08-08 05:41:01 +0000 | [diff] [blame] | 31 | ANNOUNCE=true |
Fred Drake | 3f4e717 | 2001-03-02 21:05:58 +0000 | [diff] [blame] | 32 | |
Fred Drake | 964c798 | 2004-06-17 22:04:17 +0000 | [diff] [blame] | 33 | getopt -T >/dev/null |
| 34 | if [ $? -eq 4 ] ; then |
| 35 | # We have a sufficiently useful getopt(1) implementation. |
Fred Drake | 303e30e | 2004-11-02 19:18:20 +0000 | [diff] [blame^] | 36 | eval "set -- `getopt -ssh m:p:qt:F: \"$@\"`" |
Fred Drake | 964c798 | 2004-06-17 22:04:17 +0000 | [diff] [blame] | 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. |
| 40 | : |
| 41 | fi |
| 42 | |
Fred Drake | 66a0a0a | 2001-06-12 13:31:37 +0000 | [diff] [blame] | 43 | while [ "$#" -gt 0 ] ; do |
| 44 | case "$1" in |
| 45 | -m) |
| 46 | EXPLANATION="$2" |
| 47 | shift 2 |
| 48 | ;; |
Fred Drake | 9e1ac24 | 2004-06-17 18:36:54 +0000 | [diff] [blame] | 49 | -p) |
| 50 | PKGTYPE="$2" |
| 51 | shift 1 |
| 52 | ;; |
Fred Drake | e54acfd | 2001-08-08 05:41:01 +0000 | [diff] [blame] | 53 | -q) |
| 54 | ANNOUNCE=false |
| 55 | shift 1 |
| 56 | ;; |
Fred Drake | 66a0a0a | 2001-06-12 13:31:37 +0000 | [diff] [blame] | 57 | -t) |
| 58 | DOCTYPE="$2" |
| 59 | shift 2 |
| 60 | ;; |
| 61 | -F) |
| 62 | EXPLANATION="`cat $2`" |
| 63 | shift 2 |
| 64 | ;; |
Fred Drake | 96b935e | 2004-06-29 14:39:06 +0000 | [diff] [blame] | 65 | --) |
| 66 | shift 1 |
| 67 | break |
| 68 | ;; |
Fred Drake | 66a0a0a | 2001-06-12 13:31:37 +0000 | [diff] [blame] | 69 | -*) |
| 70 | echo "Unknown option: $1" >&2 |
| 71 | exit 2 |
| 72 | ;; |
| 73 | *) |
| 74 | break |
| 75 | ;; |
| 76 | esac |
| 77 | done |
| 78 | if [ "$1" ] ; then |
| 79 | if [ "$EXPLANATION" ] ; then |
| 80 | echo "Explanation may only be given once!" >&2 |
| 81 | exit 2 |
| 82 | fi |
| 83 | EXPLANATION="$1" |
| 84 | shift |
Fred Drake | 827bb9f | 2000-11-30 07:38:59 +0000 | [diff] [blame] | 85 | fi |
| 86 | |
Fred Drake | 692565c | 2000-10-19 05:54:51 +0000 | [diff] [blame] | 87 | START="`pwd`" |
| 88 | MYDIR="`dirname $0`" |
| 89 | cd "$MYDIR" |
| 90 | MYDIR="`pwd`" |
Fred Drake | 692565c | 2000-10-19 05:54:51 +0000 | [diff] [blame] | 91 | |
Fred Drake | 9e1ac24 | 2004-06-17 18:36:54 +0000 | [diff] [blame] | 92 | if [ "$PKGTYPE" = bzip ] ; then |
| 93 | PKGEXT=tar.bz2 |
| 94 | elif [ "$PKGTYPE" = tar ] ; then |
| 95 | PKGEXT=tgz |
| 96 | elif [ "$PKGTYPE" = zip ] ; then |
| 97 | PKGEXT=zip |
| 98 | else |
| 99 | echo 1>&2 "unsupported package type: $PKGTYPE" |
| 100 | exit 2 |
| 101 | fi |
| 102 | |
Fred Drake | 7ceab73 | 2000-10-24 19:59:55 +0000 | [diff] [blame] | 103 | cd .. |
Fred Drake | 3f4e717 | 2001-03-02 21:05:58 +0000 | [diff] [blame] | 104 | |
| 105 | # now in .../Doc/ |
Fred Drake | 9e1ac24 | 2004-06-17 18:36:54 +0000 | [diff] [blame] | 106 | make --no-print-directory ${PKGTYPE}html || exit $? |
| 107 | PACKAGE="html-$VERSION.$PKGEXT" |
Fred Drake | e1f3ed6 | 2001-04-13 05:13:55 +0000 | [diff] [blame] | 108 | scp "$PACKAGE" tools/update-docs.sh $TARGET/ || exit $? |
Fred Drake | f54519d | 2002-04-01 20:15:05 +0000 | [diff] [blame] | 109 | ssh "$TARGETHOST" tmp/update-docs.sh $DOCTYPE $PACKAGE '&&' rm tmp/update-docs.sh || exit $? |
Fred Drake | 3f4e717 | 2001-03-02 21:05:58 +0000 | [diff] [blame] | 110 | |
Fred Drake | e54acfd | 2001-08-08 05:41:01 +0000 | [diff] [blame] | 111 | if $ANNOUNCE ; then |
| 112 | sendmail $ADDRESSES <<EOF |
Fred Drake | de6dc1e | 2001-07-06 23:45:16 +0000 | [diff] [blame] | 113 | To: $ADDRESSES |
| 114 | From: "Fred L. Drake" <fdrake@acm.org> |
| 115 | Subject: [$DOCLABEL doc updates] |
Fred Drake | e13602e | 2002-04-04 18:06:06 +0000 | [diff] [blame] | 116 | X-No-Archive: yes |
Fred Drake | de6dc1e | 2001-07-06 23:45:16 +0000 | [diff] [blame] | 117 | |
Fred Drake | 602cf58 | 2001-07-12 21:50:10 +0000 | [diff] [blame] | 118 | The $DOCLABEL version of the documentation has been updated: |
Fred Drake | 3f4e717 | 2001-03-02 21:05:58 +0000 | [diff] [blame] | 119 | |
Fred Drake | f54519d | 2002-04-01 20:15:05 +0000 | [diff] [blame] | 120 | http://$TARGETHOST/dev/doc/$DOCTYPE/ |
Fred Drake | 3f4e717 | 2001-03-02 21:05:58 +0000 | [diff] [blame] | 121 | |
| 122 | $EXPLANATION |
Fred Drake | 9e1ac24 | 2004-06-17 18:36:54 +0000 | [diff] [blame] | 123 | |
| 124 | A downloadable package containing the HTML is also available: |
| 125 | |
| 126 | http://$TARGETHOST/dev/doc/python-docs-$DOCTYPE.$PKGEXT |
Fred Drake | 3f4e717 | 2001-03-02 21:05:58 +0000 | [diff] [blame] | 127 | EOF |
Fred Drake | e54acfd | 2001-08-08 05:41:01 +0000 | [diff] [blame] | 128 | exit $? |
| 129 | fi |