Merge pull request #2749 from MycroftAI/bugfix/readthedocs

Fix readthedocs build
refactor/optimize-skill-boot
Kris Gesling 2020-11-09 14:52:44 +09:30 committed by GitHub
commit b3675f157e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 5 deletions

View File

@ -16,4 +16,4 @@ formats: all
python:
version: 3.7
install:
- requirements: docs/requirements.txt
- requirements: doc/requirements.txt

View File

@ -45,13 +45,19 @@ extensions = [
req_path = os.path.join(os.path.dirname(os.path.dirname(
os.path.realpath(__file__))), 'requirements', 'requirements.txt')
# To easily run sphinx without additional installation autodoc_mock_imports
# sets modules to mock.
# Step 1: Pull module names to mock from requirements
# Assuming package name is the same as the module name
with open(req_path) 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
# Step 2: Add custom names
# Not all module names match the package name (as stated in requirements.txt)
# this adds the modules whose names don't match the package name.
autodoc_mock_imports = list(autodoc_mock_imports) + [
'adapt',
'alsaaudio',
@ -59,7 +65,9 @@ autodoc_mock_imports = list(autodoc_mock_imports) + [
'past',
'serial',
'websocket',
'speech_recognition'
'speech_recognition',
'xdg',
'yaml'
]
templates_path = ['_templates']

View File

@ -61,6 +61,8 @@ import re
from pathlib import Path
from threading import Timer
import yaml
from mycroft.api import DeviceApi, is_paired
from mycroft.configuration import Configuration
from mycroft.messagebus.message import Message
@ -249,8 +251,6 @@ class SettingsMetaUploader:
def _load_settings_meta_file(self):
"""Read the contents of the settingsmeta file into memory."""
# Imported here do handle issue with readthedocs build
import yaml
_, ext = os.path.splitext(str(self.settings_meta_path))
is_json_file = self.settings_meta_path.suffix == ".json"
try: