| | 31 | class build_doc(Command): |
|---|
| | 32 | description = 'Builds the documentation' |
|---|
| | 33 | user_options = [] |
|---|
| | 34 | |
|---|
| | 35 | def initialize_options(self): |
|---|
| | 36 | pass |
|---|
| | 37 | |
|---|
| | 38 | def finalize_options(self): |
|---|
| | 39 | pass |
|---|
| | 40 | |
|---|
| | 41 | def run(self): |
|---|
| | 42 | # from docutils.core import publish_cmdline |
|---|
| | 43 | # docutils_conf = os.path.join('doc', 'docutils.conf') |
|---|
| | 44 | epydoc_conf = os.path.join('doc', 'epydoc.conf') |
|---|
| | 45 | |
|---|
| | 46 | # for source in glob('doc/*.txt'): |
|---|
| | 47 | # dest = os.path.splitext(source)[0] + '.html' |
|---|
| | 48 | # if not os.path.exists(dest) or \ |
|---|
| | 49 | # os.path.getmtime(dest) < os.path.getmtime(source): |
|---|
| | 50 | # print 'building documentation file %s' % dest |
|---|
| | 51 | # publish_cmdline(writer_name='html', |
|---|
| | 52 | # argv=['--config=%s' % docutils_conf, source, |
|---|
| | 53 | # dest]) |
|---|
| | 54 | |
|---|
| | 55 | try: |
|---|
| | 56 | from epydoc import cli |
|---|
| | 57 | old_argv = sys.argv[1:] |
|---|
| | 58 | sys.argv[1:] = [ |
|---|
| | 59 | '--config=%s' % epydoc_conf, |
|---|
| | 60 | '--no-private', # epydoc bug, not read from config |
|---|
| | 61 | '--simple-term', |
|---|
| | 62 | '--verbose' |
|---|
| | 63 | ] |
|---|
| | 64 | cli.cli() |
|---|
| | 65 | sys.argv[1:] = old_argv |
|---|
| | 66 | |
|---|
| | 67 | except ImportError: |
|---|
| | 68 | print 'epydoc not installed, skipping API documentation.' |
|---|