diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-11-08 00:07:37 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-11-17 01:09:43 +0900 |
commit | ff079de0100c2dd684d7a3dd0cb7577b6f39e435 (patch) | |
tree | d57e6c6397bf107aee83a02459a0987fbc4c1524 /sphinx/ext/apidoc.py | |
parent | 7d0aa9594d8e544bb2ee8f4551fe404767085468 (diff) | |
download | sphinx-git-ff079de0100c2dd684d7a3dd0cb7577b6f39e435.tar.gz |
Close #2546: apidoc: .so file support
Diffstat (limited to 'sphinx/ext/apidoc.py')
-rw-r--r-- | sphinx/ext/apidoc.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sphinx/ext/apidoc.py b/sphinx/ext/apidoc.py index b1d19e5cb..16eea9c11 100644 --- a/sphinx/ext/apidoc.py +++ b/sphinx/ext/apidoc.py @@ -21,6 +21,7 @@ import os import sys import warnings from fnmatch import fnmatch +from importlib.machinery import EXTENSION_SUFFIXES from os import path from typing import Any, List, Tuple @@ -45,7 +46,7 @@ else: ] INITPY = '__init__.py' -PY_SUFFIXES = {'.py', '.pyx'} +PY_SUFFIXES = ('.py', '.pyx') + tuple(EXTENSION_SUFFIXES) template_dir = path.join(package_dir, 'templates', 'apidoc') @@ -232,7 +233,7 @@ def recurse_tree(rootpath: str, excludes: List[str], opts: Any, 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 - if path.splitext(f)[1] in PY_SUFFIXES and + if f.endswith(PY_SUFFIXES) and not is_excluded(path.join(root, f), excludes)) is_pkg = INITPY in py_files is_namespace = INITPY not in py_files and implicit_namespaces @@ -270,7 +271,7 @@ def recurse_tree(rootpath: str, excludes: List[str], opts: Any, assert root == rootpath and root_package is None for py_file in py_files: if not is_skipped_module(path.join(rootpath, py_file), opts, excludes): - module = path.splitext(py_file)[0] + module = py_file.split('.')[0] create_module_file(root_package, module, opts, user_template_dir) toplevels.append(module) |