summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshimizukawa <shimizukawa@gmail.com>2016-11-06 09:36:33 +0900
committershimizukawa <shimizukawa@gmail.com>2016-11-06 09:38:37 +0900
commit86c54575bef74c4140e2c2efcb88e953ea76c28b (patch)
tree195b8bfe48b5202f0c3759131b14c56aec0b21ce
parent2de1cd7fde3961352cfcc94743592c4a5b592e97 (diff)
downloadsphinx-git-86c54575bef74c4140e2c2efcb88e953ea76c28b.tar.gz
Closes #930: sphinx-apidoc allow wildcards for excluding paths.
-rw-r--r--CHANGES1
-rw-r--r--sphinx/apidoc.py9
2 files changed, 6 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index cd00371d9..2ab276671 100644
--- a/CHANGES
+++ b/CHANGES
@@ -20,6 +20,7 @@ Features added
:confval:`linkcheck_anchors_ignore`
* #3083: let Unicode no-break space act like LaTeX ``~`` (fixed #3019)
* #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
----------
diff --git a/sphinx/apidoc.py b/sphinx/apidoc.py
index 6b140260d..05928be81 100644
--- a/sphinx/apidoc.py
+++ b/sphinx/apidoc.py
@@ -21,6 +21,7 @@ import sys
import optparse
from os import path
from six import binary_type
+from fnmatch import fnmatch
from sphinx.util.osutil import FileAvoidWrite, walk
from sphinx import __display_version__
@@ -257,7 +258,7 @@ def is_excluded(root, excludes):
e.g. an exlude "foo" also accidentally excluding "foobar".
"""
for exclude in excludes:
- if root == exclude:
+ if fnmatch(root, exclude):
return True
return False
@@ -266,13 +267,13 @@ def main(argv=sys.argv):
"""Parse and check the command line arguments."""
parser = optparse.OptionParser(
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
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
-from generation.
+The <exclude_pattern>s can be file and/or directory patterns that will be
+excluded from generation.
Note: By default this script will not overwrite already created files.""")