Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # -*- coding: utf-8 -*- |
| 3 | |
| 4 | # Runs the daily build of the Python docs on dinsdale.python.org. |
| 5 | # |
| 6 | # Usages: |
| 7 | # |
| 8 | # dailybuild.py |
| 9 | # |
| 10 | # without any arguments builds docs for all branches configured in the global |
| 11 | # BRANCHES value. |
| 12 | # |
| 13 | # dailybuild.py [-d] <checkout> <target> |
| 14 | # |
| 15 | # builds one version, where <checkout> is an SVN checkout directory of the |
| 16 | # Python branch to build docs for, and <target> is the directory where the |
| 17 | # result should be placed. If -d is given, the docs are built even if the |
| 18 | # branch is in development mode (i.e. version contains a, b or c). |
| 19 | # |
| 20 | # This script is not run from the checkout, so if you want to change how the |
| 21 | # daily build is run, you must replace it on dinsdale. This is necessary, for |
| 22 | # example, after the release of a new minor version. |
| 23 | # |
| 24 | # 03/2010, Georg Brandl |
| 25 | |
| 26 | import os |
| 27 | import sys |
| 28 | import getopt |
| 29 | |
| 30 | |
| 31 | BUILDROOT = '/home/gbrandl/docbuild' |
| 32 | WWWROOT = '/data/ftp.python.org/pub/docs.python.org' |
| 33 | |
| 34 | BRANCHES = [ |
| 35 | # checkout, target, isdev |
Georg Brandl | 3c6985b | 2011-02-20 14:42:33 +0000 | [diff] [blame] | 36 | (BUILDROOT + '/python33', WWWROOT + '/dev', True), |
Georg Brandl | 5ebb3be | 2010-08-03 12:39:02 +0000 | [diff] [blame] | 37 | (BUILDROOT + '/python27', WWWROOT, False), |
Georg Brandl | 3c6985b | 2011-02-20 14:42:33 +0000 | [diff] [blame] | 38 | (BUILDROOT + '/python32', WWWROOT + '/py3k', False), |
Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 39 | ] |
| 40 | |
| 41 | |
| 42 | def build_one(checkout, target, isdev): |
| 43 | print 'Doc autobuild started in %s' % checkout |
| 44 | os.chdir(checkout) |
| 45 | print 'Running svn update' |
| 46 | os.system('svn update') |
| 47 | print 'Running make autobuild' |
| 48 | if os.WEXITSTATUS(os.system( |
| 49 | 'cd Doc; make autobuild-%s' % (isdev and 'dev' or 'stable'))) == 2: |
| 50 | print '*' * 80 |
| 51 | return |
| 52 | print 'Copying HTML files' |
| 53 | os.system('cp -a Doc/build/html/* %s' % target) |
| 54 | print 'Copying dist files' |
Georg Brandl | 5ebb3be | 2010-08-03 12:39:02 +0000 | [diff] [blame] | 55 | os.system('mkdir -p %s/archives' % target) |
Georg Brandl | 45534ce | 2010-03-13 13:41:58 +0000 | [diff] [blame] | 56 | os.system('cp -a Doc/dist/* %s/archives' % target) |
Georg Brandl | 3446583 | 2010-03-13 10:12:39 +0000 | [diff] [blame] | 57 | print 'Finished' |
| 58 | print '=' * 80 |
| 59 | |
| 60 | def usage(): |
| 61 | print 'Usage:' |
| 62 | print ' %s' % sys.argv[0] |
| 63 | print 'or' |
| 64 | print ' %s [-d] <checkout> <target>' % sys.argv[0] |
| 65 | sys.exit(1) |
| 66 | |
| 67 | |
| 68 | if __name__ == '__main__': |
| 69 | try: |
| 70 | opts, args = getopt.getopt(sys.argv[1:], 'd') |
| 71 | except getopt.error: |
| 72 | usage() |
| 73 | if opts and not args: |
| 74 | usage() |
| 75 | if args: |
| 76 | if len(args) != 2: |
| 77 | usage() |
| 78 | build_one(args[0], args[1], bool(opts)) |
| 79 | else: |
| 80 | for branch in BRANCHES: |
| 81 | build_one(*branch) |