/setup/build_docs.py

http://blogmaker.googlecode.com/ · Python · 31 lines · 24 code · 5 blank · 2 comment · 1 complexity · 9d3383a9bd6f2a5dd6862203e610649b MD5 · raw file

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