Code

Enhance documentation generation.
[roundup.git] / roundup / dist / command / build_doc.py
1 #
2 # Copyright (C) 2009 Stefan Seefeld
3 # All rights reserved.
4 # For license terms see the file COPYING.txt.
5 #
7 import os, sys
8 from stat import *
9 import os.path
10 from shutil import *
11 import glob
13 from distutils.command import build
14 from distutils.spawn import spawn, find_executable
15 from distutils.dep_util import newer, newer_group
16 from distutils.dir_util import copy_tree, remove_tree, mkpath
17 from distutils.file_util import copy_file
18 from distutils import sysconfig
20 class build_doc(build.build):
21     """Defines the specific procedure to build roundup's documentation."""
23     description = "build documentation"
25     def run(self):
26         """Run this command, i.e. do the actual document generation."""
28         sphinx = find_executable('sphinx-build')
29         if not sphinx:
30             self.warn("could not find sphinx-build in PATH")
31             self.warn("cannot build documentation")
32             return
34         doc_dir = os.path.join('share', 'doc', 'roundup', 'html')
35         temp_dir = os.path.join(self.build_temp, 'doc')
36         cmd = [sphinx, '-d', temp_dir, 'doc', doc_dir]
37         spawn(cmd)