summaryrefslogtreecommitdiff
path: root/sphinx/ext/apidoc.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-03-21 20:55:30 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2018-03-21 20:55:30 +0900
commitf9753e30deaa2ba6824e624aaf7ec464279123e4 (patch)
treecf2eaf418c78f8bec1e4626c137423ccdd758f4c /sphinx/ext/apidoc.py
parentd7a9c8638bf3fd54f3d0f3fe6f21118620bec238 (diff)
parentce3019821b1f805bc72dfe5ecef727419701c410 (diff)
downloadsphinx-git-f9753e30deaa2ba6824e624aaf7ec464279123e4.tar.gz
Merge branch '1.7'
Diffstat (limited to 'sphinx/ext/apidoc.py')
-rw-r--r--sphinx/ext/apidoc.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/sphinx/ext/apidoc.py b/sphinx/ext/apidoc.py
index 9363387a4..ad024ea54 100644
--- a/sphinx/ext/apidoc.py
+++ b/sphinx/ext/apidoc.py
@@ -197,16 +197,16 @@ def shall_skip(module, opts, excludes=[]):
if not opts.implicit_namespaces and not path.exists(module):
return True
- # skip it if there is nothing (or just \n or \r\n) in the file
- if path.exists(module) and path.getsize(module) <= 2:
- if os.path.basename(module) == '__init__.py':
- # We only want to skip packages if they do not contain any
- # .py files other than __init__.py.
- basemodule = path.dirname(module)
- for module in glob.glob(path.join(basemodule, '*.py')):
- if not is_excluded(path.join(basemodule, module), excludes):
- return True
- else:
+ # Are we a package (here defined as __init__.py, not the folder in itself)
+ if os.path.basename(module) == INITPY:
+ # Yes, check if we have any non-excluded modules at all here
+ all_skipped = True
+ basemodule = path.dirname(module)
+ for module in glob.glob(path.join(basemodule, '*.py')):
+ if not is_excluded(path.join(basemodule, module), excludes):
+ # There's a non-excluded module here, we won't skip
+ all_skipped = False
+ if all_skipped:
return True
# skip if it has a "private" name and this is selected