#!/usr/bin/python
#
# Copyright Glyn Matthews 2008.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
"""
Generates the docs then copies them to a directory so that they can be added
directly to subversion.
"""
__author__ = 'Glyn Matthews'
# constants
root_url = "https://cpp-netlib.svn.sourceforge.net/svnroot/cpp-netlib"
def usage():
""" """
print "Usage: python generate_docs.py --src=<source> --dest=<destination>"
if __name__ == '__main__':
import sys
import getopt
import os, shutil
from subprocess import call
try:
opts, args = getopt.getopt(sys.argv[1:], "", ["src=", "dest="])
for name, value in opts:
if name == '--src':
src = value
elif name == '--dest':
dest = value
if src is None or dest is None:
usage()
sys.exit(-1)
os.chdir(src)
call(['bjam', '-d2'])
if not os.path.exists(dest):
os.mkdir(dest)
shutil.copyfile("boostbook.css", os.path.join(dest, "boostbook.css"))
shutil.copyfile("index.html", os.path.join(dest, "index.html"))
# For the html subdirectory, we'll need to copy each file recursively
for root, dirs, files in os.walk("html"):
for dir in dirs:
if not os.path.exists(os.path.join(root, dir)):
os.mkdir(os.path.join(root, dir))
for fil in files:
print os.path.join(root, fil)
shutil.copyfile(os.path.join(root, fil),
os.path.join(dest, root, fil))
except Exception, err:
print err