/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tools/package_docs.py

  • Committer: Ian Clatworthy
  • Date: 2009-09-08 16:37:05 UTC
  • mto: (4634.37.2 prepare-2.0)
  • mto: This revision was merged to the branch mainline in revision 4689.
  • Revision ID: ian.clatworthy@canonical.com-20090908163705-50olbndnrr2x2389
moce most of the sphinx configuration settings into a central place

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import os
20
20
import sys
21
 
import tarfile
22
21
from optparse import OptionParser
23
22
from shutil import copy2, copytree, rmtree
24
23
 
40
39
        rmtree(dest_html)
41
40
    copytree(src_html, dest_html)
42
41
 
43
 
    # Package the html as a downloadable archive
44
 
    archive_root = "bzr-%s-html" % (section,)
45
 
    archive_basename = "%s.tar.bz2" % (archive_root,)
46
 
    archive_name = os.path.join(dest_downloads, archive_basename)
47
 
    build_archive(src_html, archive_name, archive_root, 'bz2')
 
42
    # TODO: package the html as a downloadable archive
48
43
 
49
 
    # Copy across the PDF docs, if any, including the quick ref card
 
44
    # TODO: copy across the PDF docs, if any, including the quick ref card
50
45
    pdf_files = []
51
46
    quick_ref = os.path.join(src_html,
52
 
        '_static/%s/bzr-%s-quick-reference.pdf' % (section, section))
 
47
        '_static/%s/bzr-quick-reference.pdf' % (section,))
53
48
    if os.path.exists(quick_ref):
54
49
        pdf_files.append(quick_ref)
55
50
    src_pdf = os.path.join(src_build, 'latex')
67
62
    # TODO: copy across the CHM files, if any
68
63
 
69
64
 
70
 
def build_archive(src_dir, archive_name, archive_root, format):
71
 
    print "creating %s ..." % (archive_name,)
72
 
    tar = tarfile.open(archive_name, "w:%s" % (format,))
73
 
    for relpath in os.listdir(src_dir):
74
 
        src_path = os.path.join(src_dir, relpath)
75
 
        archive_path = os.path.join(archive_root, relpath)
76
 
        tar.add(src_path, arcname=archive_path)
77
 
    tar.close()
78
 
 
79
 
 
80
65
def main(argv):
81
66
    # Check usage. The first argument is the parent directory of
82
67
    # the Sphinx _build directory. It will typically be 'doc/xx'.