blob: c0f45ebc27318dd3714a196eaef885875ad11041 [file] [log] [blame]
Georg Brandl34465832010-03-13 10:12:39 +00001#!/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
26import os
27import sys
28import getopt
29
30
31BUILDROOT = '/home/gbrandl/docbuild'
32WWWROOT = '/data/ftp.python.org/pub/docs.python.org'
33
34BRANCHES = [
35 # checkout, target, isdev
36 (BUILDROOT + '/python26', WWWROOT, False),
37 (BUILDROOT + '/python31', WWWROOT + '/py3k', False),
38 (BUILDROOT + '/python27', WWWROOT + '/dev', True),
39 (BUILDROOT + '/python32', WWWROOT + '/dev/py3k', True),
40]
41
42
43def build_one(checkout, target, isdev):
44 print 'Doc autobuild started in %s' % checkout
45 os.chdir(checkout)
46 print 'Running svn update'
47 os.system('svn update')
48 print 'Running make autobuild'
49 if os.WEXITSTATUS(os.system(
50 'cd Doc; make autobuild-%s' % (isdev and 'dev' or 'stable'))) == 2:
51 print '*' * 80
52 return
53 print 'Copying HTML files'
54 os.system('cp -a Doc/build/html/* %s' % target)
55 print 'Copying dist files'
Georg Brandl45534ce2010-03-13 13:41:58 +000056 os.system('mkdir %s/archives' % target)
57 os.system('cp -a Doc/dist/* %s/archives' % target)
Georg Brandl34465832010-03-13 10:12:39 +000058 print 'Finished'
59 print '=' * 80
60
61def usage():
62 print 'Usage:'
63 print ' %s' % sys.argv[0]
64 print 'or'
65 print ' %s [-d] <checkout> <target>' % sys.argv[0]
66 sys.exit(1)
67
68
69if __name__ == '__main__':
70 try:
71 opts, args = getopt.getopt(sys.argv[1:], 'd')
72 except getopt.error:
73 usage()
74 if opts and not args:
75 usage()
76 if args:
77 if len(args) != 2:
78 usage()
79 build_one(args[0], args[1], bool(opts))
80 else:
81 for branch in BRANCHES:
82 build_one(*branch)