From c659faaf92de928a885f04d982b71c14037528c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Forslund?= <ake.forslund@gmail.com> Date: Thu, 15 Nov 2018 17:49:53 +0100 Subject: [PATCH] remove the old generate_sdk_docs.py replace it with sphinxdoc ./start-mycroft.sh sdkdoc html will generate the same documentation as on readthedocs.org --- doc/generate_sdk_docs.py | 66 ---------------------------------------- start-mycroft.sh | 4 ++- test-requirements.txt | 2 ++ 3 files changed, 5 insertions(+), 67 deletions(-) delete mode 100644 doc/generate_sdk_docs.py diff --git a/doc/generate_sdk_docs.py b/doc/generate_sdk_docs.py deleted file mode 100644 index d34f445663..0000000000 --- a/doc/generate_sdk_docs.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 2017 Mycroft AI Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -import pdoc - - -DOCS_NAME = "mycroft-skills-sdk" - -DOC_OUTPUT_DIR = "build/doc/%s/html" % DOCS_NAME - -documented_sdk_modules = [ - "mycroft.configuration", - "mycroft.dialog", - "mycroft.filesystem", - "mycroft.session", - "mycroft.util", - "mycroft.util.log" -] - - -def module_to_docpath(module_name): - module_source_dir = module_name.replace(".", "/") - module_doc_dir = os.path.join(DOC_OUTPUT_DIR, module_source_dir) - base_module_name = os.path.basename(module_doc_dir) - if not os.path.isdir(module_source_dir): - d = os.path.dirname(module_doc_dir) - try: - os.makedirs(d) - except OSError: - pass - return os.path.join(d, base_module_name + '.m.html') - else: - try: - os.makedirs(module_doc_dir) - except OSError: - pass - return os.path.join(module_doc_dir, 'index.html') - - -def main(): - for m in documented_sdk_modules: - html = pdoc.html(m, allsubmodules=True) - with open(module_to_docpath(m), 'w') as f: - f.write(html) - import mycroft - mycroft.__all__ = [m[8:] for m in documented_sdk_modules] - root_module = pdoc.Module(mycroft) - html = root_module.html(external_links=False, link_prefix='', source=True) - with open(module_to_docpath("mycroft"), 'w') as f: - f.write(html) - - -if __name__ == "__main__": - main() diff --git a/start-mycroft.sh b/start-mycroft.sh index 44d966d667..3c0da6624d 100755 --- a/start-mycroft.sh +++ b/start-mycroft.sh @@ -217,7 +217,9 @@ case ${_opt} in ;; "sdkdoc") source-venv - python3 "${DIR}/doc/generate_sdk_docs.py" ${_opt} + cd doc + make ${opt} + cd .. ;; "enclosure") launch-background ${_opt} diff --git a/test-requirements.txt b/test-requirements.txt index 2e7076e036..8ada8157c9 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,3 +4,5 @@ pytest==3.5.0 pytest-cov==2.5.1 cov-core==1.15.0 mock==2.0.0 +sphinx==1.8.2 +sphinx-rtd-theme==0.4.2