diff options
author | Georg Brandl <georg@python.org> | 2014-01-19 11:14:38 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-01-19 11:14:38 +0100 |
commit | 8b986fe4db94b391b5b58d29f1e96ea2af5204cb (patch) | |
tree | 978f112347f4cde23a33772a374d8fccfa5c694a /sphinx/apidoc.py | |
parent | 644c87c9d56439f636669e64c40fe7c509b30e62 (diff) | |
download | sphinx-git-8b986fe4db94b391b5b58d29f1e96ea2af5204cb.tar.gz |
Closes #1266: include private modules if includeprivate is true.
Diffstat (limited to 'sphinx/apidoc.py')
-rw-r--r-- | sphinx/apidoc.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sphinx/apidoc.py b/sphinx/apidoc.py index 4430cdd00..7e95cdaed 100644 --- a/sphinx/apidoc.py +++ b/sphinx/apidoc.py @@ -182,6 +182,7 @@ def recurse_tree(rootpath, excludes, opts): toplevels = [] followlinks = getattr(opts, 'followlinks', False) + includeprivate = getattr(opts, 'includeprivate', False) for root, subs, files in os.walk(rootpath, followlinks=followlinks): # document only Python module files (that aren't excluded) py_files = sorted(f for f in files @@ -197,7 +198,11 @@ def recurse_tree(rootpath, excludes, opts): continue # remove hidden ('.') and private ('_') directories, as well as # excluded dirs - subs[:] = sorted(sub for sub in subs if sub[0] not in ['.', '_'] + if includeprivate: + exclude_prefixes = ('.',) + else: + exclude_prefixes = ('.', '_') + subs[:] = sorted(sub for sub in subs if not sub.startswith(exclude_prefixes) and not is_excluded(path.join(root, sub), excludes)) if is_pkg: |