Closes #930: sphinx-apidoc allow wildcards for excluding paths.

This commit is contained in:
shimizukawa 2016-11-06 09:36:33 +09:00
parent 2de1cd7fde
commit 86c54575be
2 changed files with 6 additions and 4 deletions

View File

@ -20,6 +20,7 @@ Features added
:confval:`linkcheck_anchors_ignore` :confval:`linkcheck_anchors_ignore`
* #3083: let Unicode no-break space act like LaTeX ``~`` (fixed #3019) * #3083: let Unicode no-break space act like LaTeX ``~`` (fixed #3019)
* #3116: allow word wrap in PDF output for inline literals (ref #3110) * #3116: allow word wrap in PDF output for inline literals (ref #3110)
* #930: sphinx-apidoc allow wildcards for excluding paths. Thanks to Nick Coghlan.
Bugs fixed Bugs fixed
---------- ----------

View File

@ -21,6 +21,7 @@ import sys
import optparse import optparse
from os import path from os import path
from six import binary_type from six import binary_type
from fnmatch import fnmatch
from sphinx.util.osutil import FileAvoidWrite, walk from sphinx.util.osutil import FileAvoidWrite, walk
from sphinx import __display_version__ from sphinx import __display_version__
@ -257,7 +258,7 @@ def is_excluded(root, excludes):
e.g. an exlude "foo" also accidentally excluding "foobar". e.g. an exlude "foo" also accidentally excluding "foobar".
""" """
for exclude in excludes: for exclude in excludes:
if root == exclude: if fnmatch(root, exclude):
return True return True
return False return False
@ -266,13 +267,13 @@ def main(argv=sys.argv):
"""Parse and check the command line arguments.""" """Parse and check the command line arguments."""
parser = optparse.OptionParser( parser = optparse.OptionParser(
usage="""\ usage="""\
usage: %prog [options] -o <output_path> <module_path> [exclude_path, ...] usage: %prog [options] -o <output_path> <module_path> [exclude_pattern, ...]
Look recursively in <module_path> for Python modules and packages and create Look recursively in <module_path> for Python modules and packages and create
one reST file with automodule directives per package in the <output_path>. one reST file with automodule directives per package in the <output_path>.
The <exclude_path>s can be files and/or directories that will be excluded The <exclude_pattern>s can be file and/or directory patterns that will be
from generation. excluded from generation.
Note: By default this script will not overwrite already created files.""") Note: By default this script will not overwrite already created files.""")