Merged in benoitbryon/sphinx/apidoc-symlinks (pull request #75)

This commit is contained in:
Georg Brandl 2012-10-28 17:56:12 +01:00
commit 5d7b75fbb0
2 changed files with 15 additions and 1 deletions

View File

@ -227,6 +227,15 @@ The :program:`sphinx-apidoc` script has several options:
This sets the maximum depth of the table of contents, if one is generated. This sets the maximum depth of the table of contents, if one is generated.
.. option:: -l, --follow-links
This option makes sphinx-apidoc follow symbolic links when recursing the
filesystem to discover packages and modules. You may need it if you want
to generate documentation from a source directory managed by
`collective.recipe.omelette
<http://pypi.python.org/pypi/collective.recipe.omelette/>`_.
By default, symbolic links are skipped.
.. option:: -T, --no-toc .. option:: -T, --no-toc
This prevents the generation of a table-of-contents file ``modules.rst``. This prevents the generation of a table-of-contents file ``modules.rst``.

View File

@ -157,7 +157,8 @@ def recurse_tree(rootpath, excludes, opts):
root_package = None root_package = None
toplevels = [] toplevels = []
for root, subs, files in os.walk(rootpath): followlinks = getattr(opts, 'followlinks', False)
for root, subs, files in os.walk(rootpath, followlinks=followlinks):
if is_excluded(root, excludes): if is_excluded(root, excludes):
del subs[:] del subs[:]
continue continue
@ -246,6 +247,10 @@ Note: By default this script will not overwrite already created files.""")
'(default: 4)', type='int', default=4) '(default: 4)', type='int', default=4)
parser.add_option('-f', '--force', action='store_true', dest='force', parser.add_option('-f', '--force', action='store_true', dest='force',
help='Overwrite all files') help='Overwrite all files')
parser.add_option('-l', '--follow-links', action='store_true',
dest='followlinks', default=False,
help='Follow symbolic links. Powerful when combined ' \
'with collective.recipe.omelette.')
parser.add_option('-n', '--dry-run', action='store_true', dest='dryrun', parser.add_option('-n', '--dry-run', action='store_true', dest='dryrun',
help='Run the script without creating files') help='Run the script without creating files')
parser.add_option('-T', '--no-toc', action='store_true', dest='notoc', parser.add_option('-T', '--no-toc', action='store_true', dest='notoc',