From cc65e045e6b7563c5bc9e4d2c82be6341766ddad Mon Sep 17 00:00:00 2001 From: "Matthew D. Scholefield" Date: Fri, 12 Jan 2018 13:47:42 -0600 Subject: [PATCH] Fix Sphinx documentation --- doc/conf.py | 24 ++++++++++++++--------- doc/requirements.txt | 39 +------------------------------------ doc/source/mycroft.util.rst | 6 +++--- mycroft/util/log.py | 6 ++++-- 4 files changed, 23 insertions(+), 52 deletions(-) mode change 100644 => 100755 doc/requirements.txt diff --git a/doc/conf.py b/doc/conf.py index afc2e23bad..422d780d0b 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -19,7 +19,7 @@ # Mycroft documentation build configuration file # import sys - +import re import os @@ -28,20 +28,26 @@ sys.path.insert(0, os.path.abspath('../')) # General Configuration extensions = [ - 'sphinx.ext.autodoc', + 'sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.viewcode', 'sphinx.ext.githubpages', 'sphinx.ext.napoleon' ] -autodoc_mock_imports = [ - 'speech_recognition', - 'pyaudio', - 'pyalsaaudio', - 'pocketsphinx', - 'padatious', - 'alsaaudio' +# Assuming package name is the same as the module name +with open(os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'requirements.txt')) as f: + autodoc_mock_imports = map(str.strip, re.findall(r'^\s*[a-zA-Z_]*', f.read().lower().replace('-', '_'), flags=re.MULTILINE)) + +# Dependencies with different module names +autodoc_mock_imports += [ + 'adapt', + 'alsaaudio', + 'dateutil', + 'past', + 'serial', + 'websocket', + 'speech_recognition' ] templates_path = ['_templates'] diff --git a/doc/requirements.txt b/doc/requirements.txt old mode 100644 new mode 100755 index c05a26cb07..ffe2fce498 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,38 +1 @@ -# Requirements that don't require C extensions - -pystache==0.5.4 -wikipedia==1.4.0 -requests==2.13.0 -gTTS==1.1.7 -gTTS-token==1.1.1 -backports.ssl-match-hostname==3.4.0.2 -pyee==1.0.1 -tornado==4.2.1 -websocket-client==0.32.0 -adapt-parser==0.3.0 -pyowm==2.6.1 -wolframalpha==3.0 -futures==3.0.3 -requests-futures==0.9.5 -astral==1.4 -tzlocal==1.3 -parsedatetime==1.5 -pyyaml==3.11 -feedparser==5.2.1 -xmlrunner==1.7.7 -pyserial==3.0 -netifaces==0.10.6 -pyjokes==0.5.0 -psutil==5.2.1 -pep8==1.7.0 -multi_key_dict==2.0.3 -wifi==0.3.8 -pyric==0.1.6 -inflection==0.3.1 -pytz==2017.2 -pillow==4.1.1 -python-dateutil==2.6.0 -pychromecast==0.7.7 -python-vlc==1.1.2 -pulsectl==17.7.4 -aiml==0.8.6 +six diff --git a/doc/source/mycroft.util.rst b/doc/source/mycroft.util.rst index 623068c44e..88d12e89f2 100644 --- a/doc/source/mycroft.util.rst +++ b/doc/source/mycroft.util.rst @@ -1,9 +1,9 @@ mycroft.util package ==================== -getLogger ---------- -.. autofunction:: mycroft.util.getLogger +LOG +--- +.. autofunction:: mycroft.util.LOG wait_while_speaking ------------------- diff --git a/mycroft/util/log.py b/mycroft/util/log.py index 46ed06004c..5de3f994f7 100644 --- a/mycroft/util/log.py +++ b/mycroft/util/log.py @@ -41,8 +41,10 @@ class LOG: The logger name is automatically generated by the module of the caller Usage: - LOG.debug('My message: %s', debug_str) - LOG('custom_name').debug('Another message') + >>> LOG.debug('My message: %s', debug_str) + 13:12:43.673 - ::1 - DEBUG - My message: hi + >>> LOG('custom_name').debug('Another message') + 13:13:10.462 - custom_name - DEBUG - Another message """ _custom_name = None