comparison setup.py @ 426:a1955bc39924 trunk

Add epydoc-based API doc generation to the build.
author cmlenz
date Thu, 22 Mar 2007 13:10:55 +0000
parents cab6b0256019
children a89368769b82
comparison
equal deleted inserted replaced
425:073640758a42 426:a1955bc39924
18 import os 18 import os
19 try: 19 try:
20 from setuptools import setup 20 from setuptools import setup
21 except ImportError: 21 except ImportError:
22 from distutils.core import setup 22 from distutils.core import setup
23 import sys
23 24
24 25
25 class build_doc(Command): 26 class build_doc(Command):
26 description = 'Builds the documentation' 27 description = 'Builds the documentation'
27 user_options = [] 28 user_options = []
32 def finalize_options(self): 33 def finalize_options(self):
33 pass 34 pass
34 35
35 def run(self): 36 def run(self):
36 from docutils.core import publish_cmdline 37 from docutils.core import publish_cmdline
37 conf = os.path.join('doc', 'docutils.conf') 38 docutils_conf = os.path.join('doc', 'docutils.conf')
39 epydoc_conf = os.path.join('doc', 'epydoc.conf')
38 40
39 for source in glob('doc/*.txt'): 41 for source in glob('doc/*.txt'):
40 dest = os.path.splitext(source)[0] + '.html' 42 dest = os.path.splitext(source)[0] + '.html'
41 if not os.path.exists(dest) or \ 43 if not os.path.exists(dest) or \
42 os.path.getmtime(dest) < os.path.getmtime(source): 44 os.path.getmtime(dest) < os.path.getmtime(source):
43 print 'building documentation file %s' % dest 45 print 'building documentation file %s' % dest
44 publish_cmdline(writer_name='html', 46 publish_cmdline(writer_name='html',
45 argv=['--config=%s' % conf, source, dest]) 47 argv=['--config=%s' % docutils_conf, source,
48 dest])
49
50 try:
51 from epydoc import cli
52 old_argv = sys.argv[1:]
53 sys.argv[1:] = [
54 '--config=%s' % epydoc_conf,
55 '--no-private', # epydoc bug, not read from config
56 '--simple-term',
57 '--verbose'
58 ]
59 cli.cli()
60 sys.argv[1:] = old_argv
61
62 except ImportError:
63 print 'epydoc not installed, skipping API documentation.'
46 64
47 65
48 class test_doc(Command): 66 class test_doc(Command):
49 description = 'Tests the code examples in the documentation' 67 description = 'Tests the code examples in the documentation'
50 user_options = [] 68 user_options = []
Copyright (C) 2012-2017 Edgewall Software