diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2017-07-29 14:59:51 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2017-07-29 16:04:54 +0900 |
commit | 56a47cd9b90fe18615718335b71e62d6615e3720 (patch) | |
tree | 394f91401a055fa23083a3b543d291444bbc5421 /sphinx/apidoc.py | |
parent | abaf1cbb6b22899b770438f4f8eb4c053a703b81 (diff) | |
download | sphinx-git-56a47cd9b90fe18615718335b71e62d6615e3720.tar.gz |
Fix #3962: sphinx-apidoc does not recognize implicit namespace packages correctly
Diffstat (limited to 'sphinx/apidoc.py')
-rw-r--r-- | sphinx/apidoc.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sphinx/apidoc.py b/sphinx/apidoc.py index b9a445c95..da908da04 100644 --- a/sphinx/apidoc.py +++ b/sphinx/apidoc.py @@ -205,17 +205,18 @@ def recurse_tree(rootpath, excludes, opts): Look for every file in the directory tree and create the corresponding ReST files. """ + followlinks = getattr(opts, 'followlinks', False) + includeprivate = getattr(opts, 'includeprivate', False) + implicit_namespaces = getattr(opts, 'implicit_namespaces', False) + # check if the base directory is a package and get its name - if INITPY in os.listdir(rootpath): + if INITPY in os.listdir(rootpath) or implicit_namespaces: root_package = rootpath.split(path.sep)[-1] else: # otherwise, the base is a directory with packages root_package = None toplevels = [] - followlinks = getattr(opts, 'followlinks', False) - includeprivate = getattr(opts, 'includeprivate', False) - implicit_namespaces = getattr(opts, 'implicit_namespaces', False) for root, subs, files in walk(rootpath, followlinks=followlinks): # document only Python module files (that aren't excluded) py_files = sorted(f for f in files |