From 86c54575bef74c4140e2c2efcb88e953ea76c28b Mon Sep 17 00:00:00 2001 From: shimizukawa Date: Sun, 6 Nov 2016 09:36:33 +0900 Subject: Closes #930: sphinx-apidoc allow wildcards for excluding paths. --- sphinx/apidoc.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sphinx/apidoc.py') 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 [exclude_path, ...] +usage: %prog [options] -o [exclude_pattern, ...] Look recursively in for Python modules and packages and create one reST file with automodule directives per package in the . -The s can be files and/or directories that will be excluded -from generation. +The 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.""") -- cgit v1.2.1