PageRenderTime 17ms CodeModel.GetById 14ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/setup/build_docs.py

http://blogmaker.googlecode.com/
Python | 31 lines | 24 code | 5 blank | 2 comment | 2 complexity | 9d3383a9bd6f2a5dd6862203e610649b MD5 | raw file
 1import os
 2
 3from distutils.cmd import Command
 4from distutils import log
 5from docutils.core import publish_file
 6
 7class build_docs(Command):
 8    description = "build documentation"
 9    user_options = [
10        # ('optname=', None, ""),
11    ]
12    def initialize_options(self):
13        pass
14        
15    def finalize_options(self):
16        pass
17        
18    def run(self):
19        """build end-user documentation."""
20        readmeDir = "./release/"
21        if not os.path.isdir(readmeDir):
22            os.makedirs(readmeDir)
23        readmeFile = os.path.join(readmeDir, "README.html")
24        body = publish_file(open("./README.txt", 'r'),
25                    destination=open(readmeFile, 'w'),
26                    writer_name='html',
27                    settings_overrides=dict(stylesheet_path='./setup/blogmaker.css',
28                        strip_comments=True),
29                    )
30        log.info("published docs to: " + readmeFile)
31