diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-01-28 00:18:33 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-01-28 00:18:33 +0900 |
commit | af25fa123d2d2cf0ea8073b61120f5205f07deb8 (patch) | |
tree | 8c94fcdb0b30527b68bc2c33918655e5f3b05d1a /sphinx/ext/apidoc.py | |
parent | 6897b80fc4357ef99d2f5398d872f35e06c15af6 (diff) | |
parent | b6efff799069666d035932f1b413ae58627a1375 (diff) | |
download | sphinx-git-af25fa123d2d2cf0ea8073b61120f5205f07deb8.tar.gz |
Merge branch 'stable' into 1.7-release
Diffstat (limited to 'sphinx/ext/apidoc.py')
-rw-r--r-- | sphinx/ext/apidoc.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sphinx/ext/apidoc.py b/sphinx/ext/apidoc.py index cec9d8138..efe8b780a 100644 --- a/sphinx/ext/apidoc.py +++ b/sphinx/ext/apidoc.py @@ -18,6 +18,7 @@ from __future__ import print_function import argparse +import glob import os import sys from os import path @@ -194,7 +195,17 @@ def shall_skip(module, opts): # skip it if there is nothing (or just \n or \r\n) in the file if path.exists(module) and path.getsize(module) <= 2: - return True + skip = True + if os.path.basename(module) == '__init__.py': + pattern = path.join(path.dirname(module), '*.py') + # We only want to skip packages if they do not contain any + # .py files other than __init__.py. + other_modules = list(glob.glob(pattern)) + other_modules.remove(module) + skip = not other_modules + + if skip: + return True # skip if it has a "private" name and this is selected filename = path.basename(module) |