From 10a05d7b772f893c1d47bd064b9c87570f28bf13 Mon Sep 17 00:00:00 2001 From: Peter Cock Date: Tue, 14 Sep 2021 22:41:18 +0100 Subject: [PATCH] Exclude rather than mock Bio.Alphabet etc See suggestion here: https://github.com/sphinx-doc/sphinx/issues/9631 --- Doc/api/conf.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Doc/api/conf.py b/Doc/api/conf.py index af866d1c061..54ae6d96b85 100644 --- a/Doc/api/conf.py +++ b/Doc/api/conf.py @@ -114,9 +114,7 @@ autodoc_preserve_defaults = True # To avoid import errors. -autodoc_mock_imports = ["MySQLdb", "Bio.Restriction.Restriction"] -if version > "1.77": - autodoc_mock_imports.append("Bio.Alphabet") +autodoc_mock_imports = ["MySQLdb"] # -- Options for HTML output ---------------------------------------------- @@ -305,7 +303,19 @@ def run_apidoc(_): # $ sphinx-apidoc -e -F -o /tmp/api/Bio Bio tmp_path = tempfile.mkdtemp() apidoc_main(["-e", "-F", "-o", tmp_path, "../../BioSQL"]) - apidoc_main(["-e", "-F", "-o", tmp_path, "../../Bio"]) + apidoc_main( + [ + "-e", + "-F", + "-o", + tmp_path, + # The input path: + "../../Bio", + # These are patterns to exclude: + "../../Bio/Alphabet/", + "../../Bio/Restriction/Restriction.py", + ] + ) os.remove(os.path.join(tmp_path, "index.rst")) # Using our own for filename in os.listdir(tmp_path): if filename.endswith(".rst"):