diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-01-08 20:19:36 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-01-08 20:19:36 +0900 |
commit | 326d7e64cedb5280a9cf51a90c00266e1dab9e7b (patch) | |
tree | 0ce4e7845e09aa822da027fbe6401174458c47d9 /sphinx/ext/apidoc.py | |
parent | 7a194f52960fe5ace04ef7daa72563e6d3bf094f (diff) | |
parent | 3965b1f023bbac932d0dfbf414386f0667ec002a (diff) | |
download | sphinx-git-326d7e64cedb5280a9cf51a90c00266e1dab9e7b.tar.gz |
Merge branch 'master' into dont_emit_system_message_on_autodoc_warning
Diffstat (limited to 'sphinx/ext/apidoc.py')
-rw-r--r-- | sphinx/ext/apidoc.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sphinx/ext/apidoc.py b/sphinx/ext/apidoc.py index 0bdeb9865..cec9d8138 100644 --- a/sphinx/ext/apidoc.py +++ b/sphinx/ext/apidoc.py @@ -11,7 +11,7 @@ Copyright 2008 Société des arts technologiques (SAT), http://www.sat.qc.ca/ - :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. + :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -27,7 +27,7 @@ from fnmatch import fnmatch from sphinx import __display_version__ from sphinx.cmd.quickstart import EXTENSIONS from sphinx.util import rst -from sphinx.util.osutil import FileAvoidWrite, walk +from sphinx.util.osutil import FileAvoidWrite, ensuredir, walk if False: # For type annotation @@ -117,7 +117,11 @@ def create_package_file(root, master_package, subroot, py_files, opts, subs, is_ text += '\n' # build a list of directories that are szvpackages (contain an INITPY file) - subs = [sub for sub in subs if path.isfile(path.join(root, sub, INITPY))] + # and also checks the INITPY file is not empty, or there are other python + # source files in that folder. + # (depending on settings - but shall_skip() takes care of that) + subs = [sub for sub in subs if not + shall_skip(path.join(root, sub, INITPY), opts)] # if there are some package directories, add a TOC for theses subpackages if subs: text += format_heading(2, 'Subpackages') @@ -382,8 +386,8 @@ def main(argv=sys.argv[1:]): if not path.isdir(rootpath): print('%s is not a directory.' % rootpath, file=sys.stderr) sys.exit(1) - if not path.isdir(args.destdir) and not args.dryrun: - os.makedirs(args.destdir) + if not args.dryrun: + ensuredir(args.destdir) excludes = [path.abspath(exclude) for exclude in args.exclude_pattern] modules = recurse_tree(rootpath, excludes, args) |