aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/mycroft-core/0001-remove-xmlrunner-dep.patch24
-rw-r--r--testing/mycroft-core/0001-xdg.patch (renamed from testing/mycroft-core/0003-xdg.patch)252
-rw-r--r--testing/mycroft-core/0002-follow-xdg-for-skill-settings.patch204
-rw-r--r--testing/mycroft-core/0004-relax-dep-requirements.patch33
-rw-r--r--testing/mycroft-core/0005-make-some-deps-optional.patch187
-rw-r--r--testing/mycroft-core/APKBUILD23
6 files changed, 141 insertions, 582 deletions
diff --git a/testing/mycroft-core/0001-remove-xmlrunner-dep.patch b/testing/mycroft-core/0001-remove-xmlrunner-dep.patch
deleted file mode 100644
index ba0b0201f0..0000000000
--- a/testing/mycroft-core/0001-remove-xmlrunner-dep.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Upstream pull-request: https://github.com/MycroftAI/mycroft-core/pull/2571
-
-From 81a5025667b6c000e3f87c35d4357f28888c65f8 Mon Sep 17 00:00:00 2001
-From: Bart Ribbers <bribbers@disroot.org>
-Date: Wed, 6 May 2020 13:55:24 +0200
-Subject: [PATCH] Remove the xmlrunner dep from requirements.txt, it isn't
- actually used anymore
-
----
- requirements.txt | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/requirements.txt b/requirements.txt
-index d0c6cc1a5a7..d265e2e2fc4 100644
---- a/requirements.txt
-+++ b/requirements.txt
-@@ -8,7 +8,6 @@ tornado==6.0.3
- websocket-client==0.54.0
- requests-futures==0.9.5
- pyalsaaudio==0.8.2
--xmlrunner==1.7.7
- pyserial==3.0
- psutil==5.6.6
- pocketsphinx==0.1.0
diff --git a/testing/mycroft-core/0003-xdg.patch b/testing/mycroft-core/0001-xdg.patch
index d041b6f938..1d1ec01ca7 100644
--- a/testing/mycroft-core/0003-xdg.patch
+++ b/testing/mycroft-core/0001-xdg.patch
@@ -1,5 +1,34 @@
Upstream pull-request: https://github.com/MycroftAI/mycroft-core/pull/2578
+From 5e4da71cf61ef69aa3306ba0a1bdf7aad3281587 Mon Sep 17 00:00:00 2001
+From: Bart Ribbers <bribbers@disroot.org>
+Date: Fri, 8 May 2020 21:32:33 +0200
+Subject: [PATCH] Use XDG Base directories for settings, cache and runtime data
+
+---
+ README.md | 10 ++--
+ bin/mycroft-config | 6 +--
+ mycroft/api/__init__.py | 17 ++-----
+ mycroft/client/enclosure/__main__.py | 6 +--
+ mycroft/client/enclosure/mark1/__init__.py | 10 +++-
+ mycroft/client/speech/hotword_factory.py | 37 ++++++++++++--
+ mycroft/client/text/text_client.py | 26 +++++++++-
+ mycroft/configuration/__init__.py | 1 -
+ mycroft/configuration/config.py | 53 ++++++++++++++++-----
+ mycroft/configuration/locations.py | 25 +++-------
+ mycroft/configuration/mycroft.conf | 8 ++--
+ mycroft/filesystem/__init__.py | 8 +++-
+ mycroft/messagebus/send_func.py | 7 +--
+ mycroft/skills/event_scheduler.py | 10 +++-
+ mycroft/skills/skill_updater.py | 7 +--
+ mycroft/util/file_utils.py | 21 +++++---
+ mycroft/util/log.py | 11 +++--
+ test/unittests/skills/test_skill_updater.py | 6 ++-
+ test/unittests/util/commented.json | 2 +-
+ test/unittests/util/plain.json | 2 +-
+ test/util.py | 5 +-
+ 21 files changed, 184 insertions(+), 94 deletions(-)
+
diff --git a/README.md b/README.md
index 1665b0a68dd..eaf04259ddb 100644
--- a/README.md
@@ -55,7 +84,7 @@ diff --git a/mycroft/api/__init__.py b/mycroft/api/__init__.py
index 43663ee1270..d2843120ef4 100644
--- a/mycroft/api/__init__.py
+++ b/mycroft/api/__init__.py
-@@ -20,8 +20,6 @@ import requests
+@@ -20,8 +20,6 @@
from requests import HTTPError, RequestException
from mycroft.configuration import Configuration
@@ -79,7 +108,7 @@ index 43663ee1270..d2843120ef4 100644
config_server = config.get("server")
self.url = config_server.get("url")
self.version = config_server.get("version")
-@@ -238,9 +233,7 @@ class DeviceApi(Api):
+@@ -238,9 +233,7 @@ def activate(self, state, token):
platform_build = ""
# load just the local configs to get platform info
@@ -90,7 +119,7 @@ index 43663ee1270..d2843120ef4 100644
if "enclosure" in config:
platform = config.get("enclosure").get("platform", "unknown")
platform_build = config.get("enclosure").get("platform_build", "")
-@@ -262,9 +255,7 @@ class DeviceApi(Api):
+@@ -262,9 +255,7 @@ def update_version(self):
platform_build = ""
# load just the local configs to get platform info
@@ -140,7 +169,7 @@ index 26a7311c791..c02566d3435 100644
import serial
-@@ -29,7 +31,7 @@ from mycroft.client.enclosure.mark1.eyes import EnclosureEyes
+@@ -29,7 +31,7 @@
from mycroft.client.enclosure.mark1.mouth import EnclosureMouth
from mycroft.enclosure.display_manager import \
init_display_manager_bus_connection
@@ -149,7 +178,7 @@ index 26a7311c791..c02566d3435 100644
from mycroft.messagebus.message import Message
from mycroft.util import play_wav, create_signal, connected, check_for_signal
from mycroft.util.audio_test import record
-@@ -163,6 +165,9 @@ class EnclosureReader(Thread):
+@@ -163,6 +165,9 @@ def process(self, data):
if "unit.factory-reset" in data:
self.bus.emit(Message("speak", {
'utterance': mycroft.dialog.get("reset to factory defaults")}))
@@ -159,7 +188,7 @@ index 26a7311c791..c02566d3435 100644
subprocess.call(
'rm ~/.mycroft/identity/identity2.json',
shell=True)
-@@ -193,7 +198,8 @@ class EnclosureReader(Thread):
+@@ -193,7 +198,8 @@ def process(self, data):
LOG.info("Setting opt_in to: " + word)
new_config = {'opt_in': enable}
@@ -173,7 +202,7 @@ diff --git a/mycroft/client/speech/hotword_factory.py b/mycroft/client/speech/ho
index 32011be0095..f5d7d336026 100644
--- a/mycroft/client/speech/hotword_factory.py
+++ b/mycroft/client/speech/hotword_factory.py
-@@ -26,10 +26,11 @@ from os.path import dirname, exists, join, abspath, expanduser, isfile, isdir
+@@ -26,10 +26,11 @@
from shutil import rmtree
from threading import Timer, Event, Thread
from urllib.error import HTTPError
@@ -186,7 +215,7 @@ index 32011be0095..f5d7d336026 100644
from mycroft.util.log import LOG
RECOGNIZER_DIR = join(abspath(dirname(__file__)), "recognizer")
-@@ -137,7 +138,17 @@ class PreciseHotword(HotWordEngine):
+@@ -137,7 +138,17 @@ def __init__(self, key_phrase="hey mycroft", config=None, lang="en-us"):
from precise_runner import (
PreciseRunner, PreciseEngine, ReadWriteStream
)
@@ -205,7 +234,7 @@ index 32011be0095..f5d7d336026 100644
if (local_conf.get('precise', {}).get('dist_url') ==
'http://bootstrap.mycroft.ai/artifacts/static/daily/'):
del local_conf['precise']['dist_url']
-@@ -195,7 +206,10 @@ class PreciseHotword(HotWordEngine):
+@@ -195,7 +206,10 @@ def update_precise(self, precise_config):
@property
def folder(self):
@@ -217,7 +246,7 @@ index 32011be0095..f5d7d336026 100644
@property
def install_destination(self):
-@@ -305,8 +319,23 @@ class SnowboyHotWord(HotWordEngine):
+@@ -305,8 +319,23 @@ def found_wake_word(self, frame_data):
class PorcupineHotWord(HotWordEngine):
def __init__(self, key_phrase="hey mycroft", config=None, lang="en-us"):
super(PorcupineHotWord, self).__init__(key_phrase, config, lang)
@@ -243,7 +272,7 @@ index 32011be0095..f5d7d336026 100644
"keyword_file_path", "hey_mycroft.ppn").split(',')]
sensitivities = self.config.get("sensitivities", 0.5)
diff --git a/mycroft/client/text/text_client.py b/mycroft/client/text/text_client.py
-index 44d11d61087..734e14ca83f 100644
+index 44d11d61087..29ae0817a84 100644
--- a/mycroft/client/text/text_client.py
+++ b/mycroft/client/text/text_client.py
@@ -15,6 +15,7 @@
@@ -254,17 +283,16 @@ index 44d11d61087..734e14ca83f 100644
from .gui_server import start_qml_gui
-@@ -142,8 +143,7 @@ def handleNonAscii(text):
+@@ -142,7 +143,7 @@ def handleNonAscii(text):
##############################################################################
# Settings
-config_file = os.path.join(os.path.expanduser("~"), ".mycroft_cli.conf")
--
+filename = "mycroft_cli.conf"
+
def load_mycroft_config(bus):
- """ Load the mycroft config and connect it to updates over the messagebus.
-@@ -171,6 +171,25 @@ def load_settings():
+@@ -171,6 +172,25 @@ def load_settings():
global max_log_lines
global show_meter
@@ -290,12 +318,10 @@ index 44d11d61087..734e14ca83f 100644
try:
with io.open(config_file, 'r') as f:
config = json.load(f)
-@@ -195,7 +214,11 @@ def save_settings():
- config["cy_chat_area"] = cy_chat_area
+@@ -196,6 +216,10 @@ def save_settings():
config["show_last_key"] = show_last_key
config["max_log_lines"] = max_log_lines
-- config["show_meter"] = show_meter
-+ config["show_meter"] = show_meteri
+ config["show_meter"] = show_meter
+
+ config_file = os.path.join(
+ BaseDirectory.save_config_path("mycroft"), filename)
@@ -313,10 +339,10 @@ index da28826c11d..b920d9c8336 100644
from .config import Configuration, LocalConf, RemoteConf
-from .locations import SYSTEM_CONFIG, USER_CONFIG
diff --git a/mycroft/configuration/config.py b/mycroft/configuration/config.py
-index 4322dfdb92f..fee89e9ad91 100644
+index dd82eae651f..0d89e9fb84d 100644
--- a/mycroft/configuration/config.py
+++ b/mycroft/configuration/config.py
-@@ -17,15 +17,13 @@
+@@ -17,15 +17,14 @@
import re
import json
import inflection
@@ -325,6 +351,7 @@ index 4322dfdb92f..fee89e9ad91 100644
from requests import RequestException
+from xdg import BaseDirectory
++from .locations import DEFAULT_CONFIG, USER_CONFIG, SYSTEM_CONFIG
from mycroft.util.json_helper import load_commented_json, merge_dict
from mycroft.util.log import LOG
@@ -333,8 +360,8 @@ index 4322dfdb92f..fee89e9ad91 100644
-
def is_remote_list(values):
- ''' check if this list corresponds to a backend formatted collection of
-@@ -135,7 +133,8 @@ class RemoteConf(LocalConf):
+ """Check if list corresponds to a backend formatted collection of dicts
+@@ -127,7 +126,8 @@ class RemoteConf(LocalConf):
def __init__(self, cache=None):
super(RemoteConf, self).__init__(None)
@@ -344,22 +371,26 @@ index 4322dfdb92f..fee89e9ad91 100644
from mycroft.api import is_paired
if not is_paired():
self.load_local(cache)
-@@ -180,7 +179,7 @@ class Configuration:
+@@ -173,7 +173,7 @@ class Configuration:
__patch = {} # Patch config that skills can update to override config
@staticmethod
- def get(configs=None, cache=True):
+ def get(configs=None, cache=True, remote=True):
- """
- Get configuration, returns cached instance if available otherwise
- builds a new configuration dict.
-@@ -188,27 +187,55 @@ class Configuration:
- Args:
- configs (list): List of configuration dicts
- cache (boolean): True if the result should be cached
-+ remote (boolean): False if the Mycroft Home settings shouldn't
-+ be loaded
- """
+ """Get configuration
+
+ Returns cached instance if available otherwise builds a new
+@@ -182,6 +182,9 @@ def get(configs=None, cache=True):
+ Arguments:
+ configs (list): List of configuration dicts
+ cache (boolean): True if the result should be cached
++ remote (boolean): False if the Mycroft Home settings shouldn't
++ be loaded
++
+
+ Returns:
+ (dict) configuration dictionary.
+@@ -189,23 +192,49 @@ def get(configs=None, cache=True):
if Configuration.__config:
return Configuration.__config
else:
@@ -369,24 +400,22 @@ index 4322dfdb92f..fee89e9ad91 100644
@staticmethod
- def load_config_stack(configs=None, cache=False):
+ def load_config_stack(configs=None, cache=False, remote=True):
- """
- load a stack of config dicts into a single dict
+ """Load a stack of config dicts into a single dict
- Args:
- configs (list): list of dicts to load
- cache (boolean): True if result should be cached
-+ remote (boolean): False if the Mycroft Home settings shouldn't
-+ be loaded
-
- Returns: merged dict of all configuration files
+ Arguments:
+ configs (list): list of dicts to load
+ cache (boolean): True if result should be cached
+-
++ remote (boolean): False if the Mycroft Home settings shouldn't
++ be loaded
+ Returns:
+ (dict) merged dict of all configuration files
"""
if not configs:
- configs = [LocalConf(DEFAULT_CONFIG), RemoteConf(),
- LocalConf(SYSTEM_CONFIG), LocalConf(USER_CONFIG),
- Configuration.__patch]
-+ # First use patched config
-+ configs = [LocalConf(Configuration.__patch)]
-+
++ configs = []
+ # Then use XDG config
+ # This includes both the user config and
+ # /etc/xdg/mycroft/mycroft.conf
@@ -394,7 +423,7 @@ index 4322dfdb92f..fee89e9ad91 100644
+ configs.append(LocalConf(join(dir, 'mycroft.conf')))
+
+ # Then check the old user config
-+ old_path = join(expanduser('~'), '.mycroft/mycroft.conf')
++ old_path = join(USER_CONFIG)
+ if isfile(old_path):
+ configs.append(LocalConf(old_path))
+
@@ -402,11 +431,14 @@ index 4322dfdb92f..fee89e9ad91 100644
+ if remote:
+ configs.append(RemoteConf())
+
-+ # Then use /etc/mycroft/mycroft.conf
-+ configs.append(LocalConf('/etc/mycroft/mycroft.conf'))
++ # Then use the system config (/etc/mycroft/mycroft.conf)
++ configs.append(LocalConf(SYSTEM_CONFIG))
+
+ # Then use the config that comes with the package
-+ configs.append(LocalConf(join(dirname(__file__), 'mycroft.conf')))
++ configs.append(LocalConf(DEFAULT_CONFIG))
++
++ # Lastly use patched config
++ configs.append(LocalConf(Configuration.__patch))
+
+ # Make sure we reverse the array, as merge_dict will put every new
+ # file on top of the previous one
@@ -415,30 +447,18 @@ index 4322dfdb92f..fee89e9ad91 100644
# Handle strings in stack
for index, item in enumerate(configs):
diff --git a/mycroft/configuration/locations.py b/mycroft/configuration/locations.py
-deleted file mode 100644
-index cbbaab6ca94..00000000000
+index cbbaab6ca94..3c4e608670a 100644
--- a/mycroft/configuration/locations.py
-+++ /dev/null
-@@ -1,38 +0,0 @@
--# Copyright 2018 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
--from os.path import join, dirname, expanduser, exists
--
--DEFAULT_CONFIG = join(dirname(__file__), 'mycroft.conf')
--SYSTEM_CONFIG = os.environ.get('MYCROFT_SYSTEM_CONFIG',
-- '/etc/mycroft/mycroft.conf')
++++ b/mycroft/configuration/locations.py
+@@ -13,26 +13,15 @@
+ # limitations under the License.
+ import os
+ from os.path import join, dirname, expanduser, exists
++from xdg import BaseDirectory
+
+ DEFAULT_CONFIG = join(dirname(__file__), 'mycroft.conf')
+ SYSTEM_CONFIG = os.environ.get('MYCROFT_SYSTEM_CONFIG',
+ '/etc/mycroft/mycroft.conf')
-USER_CONFIG = join(expanduser('~'), '.mycroft/mycroft.conf')
-REMOTE_CONFIG = "mycroft.ai"
-WEB_CONFIG_CACHE = os.environ.get('MYCROFT_WEB_CACHE',
@@ -447,7 +467,7 @@ index cbbaab6ca94..00000000000
-
-def __ensure_folder_exists(path):
- """ Make sure the directory for the specified path exists.
--
+
- Arguments:
- path (str): path to config file
- """
@@ -458,8 +478,14 @@ index cbbaab6ca94..00000000000
-
-__ensure_folder_exists(WEB_CONFIG_CACHE)
-__ensure_folder_exists(USER_CONFIG)
++# Use the old location if it exists, otherwise use the
++# XDG Base Directory specification
++USER_CONFIG = join(expanduser('~'), '.mycroft/mycroft.conf')
++if not os.path.isfile(USER_CONFIG):
++ USER_CONFIG = join(BaseDirectory.save_config_path('mycroft'),
++ 'mycroft.conf')
diff --git a/mycroft/configuration/mycroft.conf b/mycroft/configuration/mycroft.conf
-index b3e324eb553..798a88567cf 100644
+index 4b5b69ee8be..65360118ad5 100644
--- a/mycroft/configuration/mycroft.conf
+++ b/mycroft/configuration/mycroft.conf
@@ -5,7 +5,7 @@
@@ -489,7 +515,7 @@ index b3e324eb553..798a88567cf 100644
// Precise options:
// "sensitivity": 0.5, // Higher = more sensitive
// "trigger_level": 3 // Higher = more delay & less sensitive
-@@ -303,7 +303,7 @@
+@@ -310,7 +310,7 @@
},
"padatious": {
@@ -499,7 +525,7 @@ index b3e324eb553..798a88567cf 100644
"single_thread": false
},
diff --git a/mycroft/filesystem/__init__.py b/mycroft/filesystem/__init__.py
-index 45ec15a4ac5..414069573f4 100644
+index 45ec15a4ac5..8f6b595246f 100644
--- a/mycroft/filesystem/__init__.py
+++ b/mycroft/filesystem/__init__.py
@@ -14,6 +14,7 @@
@@ -510,18 +536,17 @@ index 45ec15a4ac5..414069573f4 100644
class FileSystemAccess:
-@@ -30,7 +31,13 @@ class FileSystemAccess:
+@@ -30,7 +31,12 @@ def __init__(self, path):
def __init_path(path):
if not isinstance(path, str) or len(path) == 0:
raise ValueError("path must be initialized as a non empty string")
- path = join(expanduser('~'), '.mycroft', path)
++ path = join(BaseDirectory.save_config_path('mycroft'), path)
++
++ # Migrate from the old location if it still exists
+ old_path = join(expanduser('~'), '.mycroft', path)
+ if isdir(old_path):
-+ path = old_path
-+ else:
-+ # Use save_config_path rather than load_first_config to make sure
-+ # this directory exists and the skills don't have to deal with it
-+ path = join(BaseDirectory.save_config_path('mycroft'), path)
++ os.rename(old_path, path)
if not isdir(path):
os.makedirs(path)
@@ -554,7 +579,7 @@ diff --git a/mycroft/skills/event_scheduler.py b/mycroft/skills/event_scheduler.
index fe41ac1bedc..cb1c9f3c61d 100644
--- a/mycroft/skills/event_scheduler.py
+++ b/mycroft/skills/event_scheduler.py
-@@ -20,6 +20,7 @@ import time
+@@ -20,6 +20,7 @@
from datetime import datetime, timedelta
from threading import Thread, Lock
from os.path import isfile, join, expanduser
@@ -585,10 +610,10 @@ index fe41ac1bedc..cb1c9f3c61d 100644
self.load()
diff --git a/mycroft/skills/skill_updater.py b/mycroft/skills/skill_updater.py
-index 9535ad90319..bf373ba99f8 100644
+index 9535ad90319..e784f23b047 100644
--- a/mycroft/skills/skill_updater.py
+++ b/mycroft/skills/skill_updater.py
-@@ -17,6 +17,7 @@ import os
+@@ -17,6 +17,7 @@
import sys
from datetime import datetime
from time import time
@@ -596,16 +621,16 @@ index 9535ad90319..bf373ba99f8 100644
from msm import MsmException
-@@ -91,9 +92,9 @@ class SkillUpdater:
+@@ -91,9 +92,9 @@ def installed_skills_file_path(self):
'.mycroft-skills'
)
else:
- self._installed_skills_file_path = os.path.expanduser(
- '~/.mycroft/.mycroft-skills'
- )
-+ self._installed_skills_file_path = join(
++ self._installed_skills_file_path = os.path.join(
+ BaseDirectory.save_data_path('mycroft',
-+ '.mycroft-skills'))
++ 'skills'))
return self._installed_skills_file_path
@@ -613,7 +638,7 @@ diff --git a/mycroft/util/file_utils.py b/mycroft/util/file_utils.py
index 84555fc3bb3..7c09fd226ee 100644
--- a/mycroft/util/file_utils.py
+++ b/mycroft/util/file_utils.py
-@@ -22,6 +22,7 @@ import os
+@@ -22,6 +22,7 @@
import psutil
from stat import S_ISREG, ST_MTIME, ST_MODE, ST_SIZE
import tempfile
@@ -663,7 +688,7 @@ diff --git a/mycroft/util/log.py b/mycroft/util/log.py
index 0ea391f8f79..788f6df1c37 100644
--- a/mycroft/util/log.py
+++ b/mycroft/util/log.py
-@@ -21,7 +21,7 @@ This module provides the LOG pseudo function quickly creating a logger instance
+@@ -21,7 +21,7 @@
for use.
The default log level of the logger created here can ONLY be set in
@@ -672,7 +697,7 @@ index 0ea391f8f79..788f6df1c37 100644
The default log level can also be programatically be changed by setting the
LOG.level parameter.
-@@ -31,10 +31,10 @@ import inspect
+@@ -31,10 +31,10 @@
import logging
import sys
@@ -685,7 +710,7 @@ index 0ea391f8f79..788f6df1c37 100644
def getLogger(name="MYCROFT"):
-@@ -84,7 +84,10 @@ class LOG:
+@@ -84,7 +84,10 @@ def init(cls):
# Check configs manually, the Mycroft configuration system can't be
# used since it uses the LOG system and would cause horrible cyclic
# dependencies.
@@ -698,24 +723,27 @@ index 0ea391f8f79..788f6df1c37 100644
for conf in confs:
try:
diff --git a/test/unittests/skills/test_skill_updater.py b/test/unittests/skills/test_skill_updater.py
-index 38d4083d7f2..a1fda04fb3a 100644
+index 38d4083d7f2..fbcc9254319 100644
--- a/test/unittests/skills/test_skill_updater.py
+++ b/test/unittests/skills/test_skill_updater.py
-@@ -15,6 +15,7 @@
+@@ -13,8 +13,9 @@
+ # limitations under the License.
+ #
"""Unit tests for the SkillUpdater class."""
- from os import path
+-from os import path
++import os
from time import sleep
+from xdg import BaseDirectory
from unittest.mock import Mock, patch, PropertyMock
from mycroft.skills.skill_updater import SkillUpdater
-@@ -143,7 +144,8 @@ class TestSkillUpdater(MycroftUnitTestBase):
+@@ -143,7 +144,8 @@ def test_installed_skills_path_not_virtual_env(self):
os_patch.return_value = False
updater = SkillUpdater(self.message_bus_mock)
self.assertEqual(
- path.expanduser('~/.mycroft/.mycroft-skills'),
-+ join(BaseDirectory.save_data_path('mycroft'),
-+ 'mycroft-skills'),
++ os.path.join(BaseDirectory.save_data_path('mycroft'),
++ 'skills'),
updater.installed_skills_file_path
)
@@ -745,31 +773,17 @@ index f8c474139ce..eec84631d88 100644
},
"server": {
"url": "https://api.mycroft.ai",
-diff --git a/test/unittests/util/test_file_utils.py b/test/unittests/util/test_file_utils.py
-index dcc4d72676c..e409f712950 100644
---- a/test/unittests/util/test_file_utils.py
-+++ b/test/unittests/util/test_file_utils.py
-@@ -33,7 +33,8 @@ class TestResolveResource(TestCase):
-
- mock_isfile.side_effect = files_in_dotmycroft_exists
- self.assertEqual(resolve_resource_file('1984.txt'),
-- expanduser('~/.mycroft/1984.txt'))
-+ join(BaseDirectory.save_data_path('mycroft'),
-+ '1984.txt'))
-
- @mock.patch('os.path.isfile')
- def test_data_dir(self, mock_isfile, mock_conf):
diff --git a/test/util.py b/test/util.py
-index f80c0f9bd40..f657bdb8304 100644
+index f80c0f9bd40..6a6e31bcc85 100644
--- a/test/util.py
+++ b/test/util.py
-@@ -1,7 +1,7 @@
+@@ -1,5 +1,8 @@
-from mycroft.configuration.config import LocalConf, DEFAULT_CONFIG
++from os.path import join, dirname
++from mycroft.configuration.locations import DEFAULT_CONFIG
+from mycroft.configuration.config import LocalConf
from copy import deepcopy
++from xdg import BaseDirectory
--__config = LocalConf(DEFAULT_CONFIG)
-+__config = LocalConf(join(dirname(__file__), 'mycroft.conf'))
-
+ __config = LocalConf(DEFAULT_CONFIG)
- # Base config to use when mocking
diff --git a/testing/mycroft-core/0002-follow-xdg-for-skill-settings.patch b/testing/mycroft-core/0002-follow-xdg-for-skill-settings.patch
deleted file mode 100644
index 6caf837069..0000000000
--- a/testing/mycroft-core/0002-follow-xdg-for-skill-settings.patch
+++ /dev/null
@@ -1,204 +0,0 @@
-Upstream pull-request: https://github.com/MycroftAI/mycroft-core/pull/2559
-
-diff --git a/mycroft/skills/mycroft_skill/mycroft_skill.py b/mycroft/skills/mycroft_skill/mycroft_skill.py
-index 4f3b6d9da6..d60a3279d0 100644
---- a/mycroft/skills/mycroft_skill/mycroft_skill.py
-+++ b/mycroft/skills/mycroft_skill/mycroft_skill.py
-@@ -21,8 +21,11 @@ import traceback
- from itertools import chain
- from os import walk
- from os.path import join, abspath, dirname, basename, exists
-+from pathlib import Path
- from threading import Event, Timer
-
-+from xdg import BaseDirectory
-+
- from adapt.intent import Intent, IntentBuilder
-
- from mycroft import dialog
-@@ -113,6 +116,7 @@ class MycroftSkill:
- bus (MycroftWebsocketClient): Optional bus connection
- use_settings (bool): Set to false to not use skill settings at all
- """
-+
- def __init__(self, name=None, bus=None, use_settings=True):
- self.name = name or self.__class__.__name__
- self.resting_name = None
-@@ -123,16 +127,6 @@ class MycroftSkill:
- #: Member variable containing the absolute path of the skill's root
- #: directory. E.g. /opt/mycroft/skills/my-skill.me/
- self.root_dir = dirname(abspath(sys.modules[self.__module__].__file__))
-- if use_settings:
-- self.settings = get_local_settings(self.root_dir, self.name)
-- self._initial_settings = deepcopy(self.settings)
-- else:
-- self.settings = None
--
-- #: Set to register a callback method that will be called every time
-- #: the skills settings are updated. The referenced method should
-- #: include any logic needed to handle the updated settings.
-- self.settings_change_callback = None
-
- self.gui = SkillGUI(self)
-
-@@ -141,6 +135,19 @@ class MycroftSkill:
- self.bind(bus)
- #: Mycroft global configuration. (dict)
- self.config_core = Configuration.get()
-+
-+ self.settings = None
-+ self.settings_write_path = None
-+ self.settings_read_path = None
-+
-+ if use_settings:
-+ self._init_settings()
-+
-+ #: Set to register a callback method that will be called every time
-+ #: the skills settings are updated. The referenced method should
-+ #: include any logic needed to handle the updated settings.
-+ self.settings_change_callback = None
-+
- self.dialog_renderer = None
-
- #: Filesystem access to skill specific folder.
-@@ -157,6 +164,42 @@ class MycroftSkill:
- self.event_scheduler = EventSchedulerInterface(self.name)
- self.intent_service = IntentServiceInterface()
-
-+ def _init_settings(self):
-+ """Setup skill settings."""
-+
-+ # To not break existing setups,
-+ # save to skill directory if the file exists already
-+ self.settings_write_path = Path(self.root_dir)
-+
-+ # Otherwise save to XDG_CONFIG_DIR
-+ if not self.settings_write_path.joinpath('settings.json').exists():
-+ self.settings_write_path = Path(BaseDirectory.save_config_path(
-+ 'mycroft', 'skills', basename(self.root_dir)))
-+
-+ # To not break existing setups,
-+ # read from skill directory if the settings file exists there
-+ self.settings_read_path = Path(self.root_dir)
-+
-+ # Then, check XDG_CONFIG_DIR
-+ if not self.settings_read_path.joinpath('settings.json').exists():
-+ for dir in BaseDirectory.load_config_paths('mycroft',
-+ 'skills',
-+ basename(
-+ self.root_dir)):
-+ path = Path(dir)
-+ #: If there is a settings file here, use it
-+ if path.joinpath('settings.json').exists():
-+ self.settings_read_path = path
-+ break
-+
-+ # Lastly, check /etc/mycroft
-+ if not self.settings_read_path.joinpath('settings.json').exists():
-+ self.settings_read_path = Path(
-+ '/etc/mycroft/skills/').joinpath(basename(self.root_dir))
-+
-+ self.settings = get_local_settings(self.settings_read_path, self.name)
-+ self._initial_settings = deepcopy(self.settings)
-+
- @property
- def enclosure(self):
- if self._enclosure:
-@@ -271,7 +314,7 @@ class MycroftSkill:
- if remote_settings is not None:
- LOG.info('Updating settings for skill ' + self.name)
- self.settings.update(**remote_settings)
-- save_settings(self.root_dir, self.settings)
-+ save_settings(self.settings_write_path, self.settings)
- if self.settings_change_callback is not None:
- self.settings_change_callback()
-
-@@ -544,7 +587,7 @@ class MycroftSkill:
-
- if not voc or not exists(voc):
- raise FileNotFoundError(
-- 'Could not find {}.voc file'.format(voc_filename))
-+ 'Could not find {}.voc file'.format(voc_filename))
- # load vocab and flatten into a simple list
- vocab = read_vocab_file(voc)
- self.voc_match_cache[cache_key] = list(chain(*vocab))
-@@ -811,7 +854,7 @@ class MycroftSkill:
- """Store settings and indicate that the skill handler has completed
- """
- if self.settings != self._initial_settings:
-- save_settings(self.root_dir, self.settings)
-+ save_settings(self.settings_write_path, self.settings)
- self._initial_settings = self.settings
- if handler_info:
- msg_type = handler_info + '.complete'
-@@ -1233,7 +1276,7 @@ class MycroftSkill:
-
- # Store settings
- if self.settings != self._initial_settings:
-- save_settings(self.root_dir, self.settings)
-+ save_settings(self.settings_write_path, self.settings)
-
- if self.settings_meta:
- self.settings_meta.stop()
-diff --git a/mycroft/skills/settings.py b/mycroft/skills/settings.py
-index c210625f5b..f576b34c9e 100644
---- a/mycroft/skills/settings.py
-+++ b/mycroft/skills/settings.py
-@@ -93,18 +93,22 @@ def get_local_settings(skill_dir, skill_name) -> dict:
- def save_settings(skill_dir, skill_settings):
- """Save skill settings to file."""
- settings_path = Path(skill_dir).joinpath('settings.json')
-- if Path(skill_dir).exists():
-- with open(str(settings_path), 'w') as settings_file:
-- try:
-- json.dump(skill_settings, settings_file)
-- except Exception:
-- LOG.exception('error saving skill settings to '
-- '{}'.format(settings_path))
-- else:
-- LOG.info('Skill settings successfully saved to '
-- '{}' .format(settings_path))
-- else:
-- LOG.info('Skill folder no longer exists, can\'t save settings.')
-+
-+ # Either the file already exists in /opt, or we are writing
-+ # to XDG_CONFIG_DIR and always have the permission to make
-+ # sure the file always exists
-+ if not Path(settings_path).exists():
-+ settings_path.touch(mode=0o644)
-+
-+ with open(str(settings_path), 'w') as settings_file:
-+ try:
-+ json.dump(skill_settings, settings_file)
-+ except Exception:
-+ LOG.exception('error saving skill settings to '
-+ '{}'.format(settings_path))
-+ else:
-+ LOG.info('Skill settings successfully saved to '
-+ '{}' .format(settings_path))
-
-
- def get_display_name(skill_name: str):
-diff --git a/mycroft/skills/skill_loader.py b/mycroft/skills/skill_loader.py
-index 2402740188..b7e8186967 100644
---- a/mycroft/skills/skill_loader.py
-+++ b/mycroft/skills/skill_loader.py
-@@ -259,7 +259,8 @@ class SkillLoader:
- if first_run:
- LOG.info("First run of " + self.skill_id)
- self.instance.settings["__mycroft_skill_firstrun"] = False
-- save_settings(self.skill_directory, self.instance.settings)
-+ save_settings(self.instance.settings_write_path,
-+ self.instance.settings)
- intro = self.instance.get_intro_message()
- if intro:
- self.instance.speak(intro)
-diff --git a/requirements.txt b/requirements.txt
-index 509436fb89..c9358db687 100644
---- a/requirements.txt
-+++ b/requirements.txt
-@@ -30,3 +30,4 @@ fann2==1.0.7
- padaos==0.1.9
- precise-runner==0.2.1
- petact==0.1.2
-+pyxdg==0.26
diff --git a/testing/mycroft-core/0004-relax-dep-requirements.patch b/testing/mycroft-core/0004-relax-dep-requirements.patch
deleted file mode 100644
index 56b85a29c7..0000000000
--- a/testing/mycroft-core/0004-relax-dep-requirements.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-Upstream pull-request: https://github.com/MycroftAI/mycroft-core/pull/2562
-
-From 466d39fd4057ab17492877edd18131541cd88e15 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?=C3=85ke=20Forslund?= <ake.forslund@gmail.com>
-Date: Mon, 4 May 2020 09:28:48 +0200
-Subject: [PATCH] Allow building Mycroft with loose requirements
-
----
- setup.py | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/setup.py b/setup.py
-index c98f7b4f8f9..3d08cbbd943 100644
---- a/setup.py
-+++ b/setup.py
-@@ -13,6 +13,7 @@
- # limitations under the License.
- #
- from setuptools import setup, find_packages
-+import os
- import os.path
-
- BASEDIR = os.path.abspath(os.path.dirname(__file__))
-@@ -44,6 +45,9 @@ def required(requirements_file):
- """ Read requirements file and remove comments and empty lines. """
- with open(os.path.join(BASEDIR, requirements_file), 'r') as f:
- requirements = f.read().splitlines()
-+ if 'MYCROFT_LOOSE_REQUIREMENTS' in os.environ:
-+ print('USING LOOSE REQUIREMENTS!')
-+ requirements = [r.replace('==', '>=') for r in requirements]
- return [pkg for pkg in requirements
- if pkg.strip() and not pkg.startswith("#")]
-
diff --git a/testing/mycroft-core/0005-make-some-deps-optional.patch b/testing/mycroft-core/0005-make-some-deps-optional.patch
deleted file mode 100644
index c75a0fbd7d..0000000000
--- a/testing/mycroft-core/0005-make-some-deps-optional.patch
+++ /dev/null
@@ -1,187 +0,0 @@
-Upstream pull-request: https://github.com/MycroftAI/mycroft-core/pull/2575
-
-diff --git a/.travis.yml b/.travis.yml
-index c01c851d87..a0b9ab2c1c 100644
---- a/.travis.yml
-+++ b/.travis.yml
-@@ -26,8 +26,6 @@ install:
- - mkdir ${TMPDIR}
- - echo ${TMPDIR}
- - VIRTUALENV_ROOT=${VIRTUAL_ENV} ./dev_setup.sh
-- - pip install -r requirements.txt
-- - pip install -r test-requirements.txt
- # command to run tests
- script:
- - pycodestyle mycroft test
-diff --git a/LICENSE.md b/LICENSE.md
-index b2719d2a5e..b882a785c0 100644
---- a/LICENSE.md
-+++ b/LICENSE.md
-@@ -208,4 +208,4 @@ Component licenses for mycroft-core:
- The mycroft-core software references various Python Packages (via PIP),
- each of which has a separate license. All are compatible with the
- Apache 2.0 license. See the referenced packages listed in the
--"requirements.txt" file for specific terms and conditions.
-+"requirements/requirements.txt" file for specific terms and conditions.
-diff --git a/MANIFEST.in b/MANIFEST.in
-index 1888d6da7b..1708d5345f 100644
---- a/MANIFEST.in
-+++ b/MANIFEST.in
-@@ -1,5 +1,5 @@
- recursive-include mycroft/client/speech/recognizer/model *
--include requirements.txt
-+include requirements/requirements.txt
- include mycroft/configuration/*.conf
- recursive-include mycroft/res *
- recursive-include mycroft/res/snd *
-diff --git a/dev_setup.sh b/dev_setup.sh
-index 3c59bc427b..f7f2d90009 100755
---- a/dev_setup.sh
-+++ b/dev_setup.sh
-@@ -495,16 +495,26 @@ if ! grep -q "$TOP" $VENV_PATH_FILE ; then
- fi
-
- # install required python modules
--if ! pip install -r requirements.txt ; then
-- echo 'Warning: Failed to install all requirements. Continue? y/N'
-+if ! pip install -r requirements/requirements.txt ; then
-+ echo 'Warning: Failed to install required dependencies. Continue? y/N'
- read -n1 continue
- if [[ $continue != 'y' ]] ; then
- exit 1
- fi
- fi
-
--if ! pip install -r test-requirements.txt ; then
-- echo "Warning test requirements wasn't installed, Note: normal operation should still work fine..."
-+# install optional python modules
-+if ! pip install -r requirements/requirements-optional.txt ; then
-+ echo 'Warning: Failed to install optional dependencies. Continue? y/N'
-+ read -n1 continue
-+ if [[ $continue != 'y' ]] ; then
-+ exit 1
-+ fi
-+fi
-+
-+
-+if ! pip install -r requirements/requirements-tests.txt ; then
-+ echo "Warning: Test requirements failed to install. Note: normal operation should still work fine..."
- fi
-
- SYSMEM=$(free | awk '/^Mem:/ { print $2 }')
-@@ -563,4 +573,4 @@ if [[ ! -w /var/log/mycroft/ ]] ; then
- fi
-
- #Store a fingerprint of setup
--md5sum requirements.txt test-requirements.txt dev_setup.sh > .installed
-+md5sum requirements/requirements.txt requirements/requirements-optional.txt requirements/requirements-tests.txt dev_setup.sh > .installed
-diff --git a/mycroft/client/enclosure/generic/__init__.py b/mycroft/client/enclosure/generic/__init__.py
-index 6256498add..a86dda739c 100644
---- a/mycroft/client/enclosure/generic/__init__.py
-+++ b/mycroft/client/enclosure/generic/__init__.py
-@@ -15,7 +15,6 @@
- import subprocess
- import time
- import sys
--from alsaaudio import Mixer
- from threading import Thread, Timer
-
- import mycroft.dialog
-diff --git a/requirements/requirements-optional.txt b/requirements/requirements-optional.txt
-new file mode 100644
-index 0000000000..4a62dad731
---- /dev/null
-+++ b/requirements/requirements-optional.txt
-@@ -0,0 +1,4 @@
-+pychromecast==3.2.2
-+python-vlc==1.1.2
-+pyalsaaudio==0.8.2
-+google-api-python-client==1.6.4
-diff --git a/test-requirements.txt b/requirements/requirements-tests.txt
-similarity index 90%
-rename from test-requirements.txt
-rename to requirements/requirements-tests.txt
-index 874a0f130d..9e038123e5 100644
---- a/test-requirements.txt
-+++ b/requirements/requirements-tests.txt
-@@ -7,3 +7,5 @@ sphinx==2.2.1
- sphinx-rtd-theme==0.4.3
- git+https://github.com/behave/behave@v1.2.7.dev1
- allure-behave==2.8.10
-+
-+python-vlc==1.1.2
-diff --git a/requirements.txt b/requirements/requirements.txt
-similarity index 83%
-rename from requirements.txt
-rename to requirements/requirements.txt
-index db2fa43738..f86a81b4bf 100644
---- a/requirements.txt
-+++ b/requirements/requirements.txt
-@@ -7,16 +7,12 @@ SpeechRecognition==3.8.1
- tornado==6.0.3
- websocket-client==0.54.0
- requests-futures==0.9.5
--pyalsaaudio==0.8.2
- pyserial==3.0
- psutil==5.6.6
- pocketsphinx==0.1.0
- inflection==0.3.1
- pillow==7.1.2
- python-dateutil==2.6.0
--pychromecast==3.2.2
--python-vlc==1.1.2
--google-api-python-client==1.6.4
- fasteners==0.14.1
- PyYAML==5.1.2
-
-diff --git a/scripts/my-info.sh b/scripts/my-info.sh
-index a3b944308e..e395411120 100644
---- a/scripts/my-info.sh
-+++ b/scripts/my-info.sh
-@@ -144,7 +144,7 @@ function checkmimic() {
- # pythoning!
- function checkPIP() {
- mlog "Python checks"
-- mlog " - Verifying ${MYCROFT_HOME}/requirements.txt:"
-+ mlog " - Verifying ${MYCROFT_HOME}/requirements/requirements.txt:"
- if workon mycroft ; then
- pip list > /tmp/mycroft-piplist.$$
-
-diff --git a/setup.py b/setup.py
-index c98f7b4f8f..2e171d66b6 100644
---- a/setup.py
-+++ b/setup.py
-@@ -56,7 +56,9 @@ setup(
- author_email='devs@mycroft.ai',
- url='https://github.com/MycroftAI/mycroft-core',
- description='Mycroft Core',
-- install_requires=required('requirements.txt'),
-+ install_requires=required('requirements/requirements.txt'),
-+ extras_requires=required('requirements/requirements-optional.txt'),
-+ tests_requires=required('requirements/requirements-tests.txt'),
- packages=find_packages(include=['mycroft*']),
- include_package_data=True,
-
-diff --git a/test/Dockerfile.test b/test/Dockerfile.test
-index 87e3c85287..32554af019 100644
---- a/test/Dockerfile.test
-+++ b/test/Dockerfile.test
-@@ -64,12 +64,14 @@ RUN python3 -m venv "/opt/mycroft/mycroft-core/.venv"
- # determine if any changes have been made since it last started
- WORKDIR /opt/mycroft/mycroft-core
- RUN .venv/bin/python -m pip install pip==20.0.2
--COPY requirements.txt .
-+COPY requirements/requirements.txt .
- RUN .venv/bin/python -m pip install -r requirements.txt
--COPY test-requirements.txt .
--RUN .venv/bin/python -m pip install -r test-requirements.txt
-+COPY requirements/requirements-optional.txt .
-+RUN .venv/bin/python -m pip install -r requirements-optional.txt
-+COPY requirements/requirements-tests.txt .
-+RUN .venv/bin/python -m pip install -r requirements-tests.txt
- COPY dev_setup.sh .
--RUN md5sum requirements.txt test-requirements.txt dev_setup.sh > .installed
-+RUN md5sum requirements.txt requirements-tests.txt requirements-optional.txt dev_setup.sh > .installed
-
- # Add the mycroft core virtual environment to the system path.
- ENV PATH /opt/mycroft/mycroft-core/.venv/bin:$PATH
diff --git a/testing/mycroft-core/APKBUILD b/testing/mycroft-core/APKBUILD
index fc16b4bc4d..06f03cf2f0 100644
--- a/testing/mycroft-core/APKBUILD
+++ b/testing/mycroft-core/APKBUILD
@@ -1,7 +1,7 @@
# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=mycroft-core
-pkgver=20.2.3
+pkgver=20.2.4
pkgrel=0
pkgdesc="Mycroft Core, the Mycroft Artificial Intelligence platform"
url="https://mycroft.ai/"
@@ -19,15 +19,10 @@ checkdepends="py3-pytest py3-wheel py3-vlc"
install="$pkgname.post-install"
source="$pkgname-$pkgver.tar.gz::https://github.com/MycroftAI/mycroft-core/archive/release/v$pkgver.tar.gz
mycroft.conf
- 0001-remove-xmlrunner-dep.patch
- 0002-follow-xdg-for-skill-settings.patch
- 0003-xdg.patch
- 0004-relax-dep-requirements.patch
- 0005-make-some-deps-optional.patch
+ 0001-xdg.patch
"
# Net is required for tests
-# Two tests are broken still
-# https://github.com/MycroftAI/mycroft-core/issues/2574
+# Some tests are broken still, will be enabled later
options="!check"
builddir="$srcdir/mycroft-core-release-v$pkgver"
@@ -36,7 +31,9 @@ build() {
}
check() {
- PYTHONPATH="$PWD/build/lib" pytest
+ # test_hotword_factory and test_local_recognizer fail
+ # https://github.com/MycroftAI/mycroft-core/issues/2574
+ PYTHONPATH="$PWD/build/lib" pytest -rRxs -k 'not testInvalid and not testListenerConfig'
}
package() {
@@ -45,10 +42,6 @@ package() {
install -Dm644 "$srcdir"/mycroft.conf "$pkgdir"/etc/mycroft/mycroft.conf
}
-sha512sums="8c9464f32dea1c5b843725c4494be17a4ccd5c46af363d3fc695813a79c1100b033f3bbac5d5e490c6afb9d018de5418cd1e467766d2d190c74ba2902399eec9 mycroft-core-20.2.3.tar.gz
+sha512sums="39e92f6c473a263d0977a2023863ccab0b20b91e1627789038c940df3a56c35eab01771924aa3f2bef686f60a0996f6db6536c87944973a15975e77d27827f10 mycroft-core-20.2.4.tar.gz
c852bf37c3588a3f65f55b65af0e55440e13aeeaca522e7029a7326ec58c9cf053d14c7c3376a952b65512cabe3437ba6701f1e0e0e4971d6b5ada159bacd57a mycroft.conf
-d9b8fd8dc9e42937f2ec095c1ddee738073a9f9c64917a9793cadaad23504a7ae22e2e1420a2822ed915b4aae6fa5e5717ead97dc88f3045dd1bbb73b92eed4d 0001-remove-xmlrunner-dep.patch
-27148a19c2d5a4fd61c25850659e4edc95844c30eb1339243e939cf22aa9093d9d4e805d80a79174e257be1614ebd7be284163e3688b083c0704a1e4c9328f58 0002-follow-xdg-for-skill-settings.patch
-f1760d828a37d3abd50e9f26c983dc68277e12b181ff598e4d7d1447b3a965644039c4d5035b1adaf593cf6a4afd44bc85cd16929c2a553eca1125c21d3e2619 0003-xdg.patch
-fa0667bd4a9f8f9c17c353f1bf1899bf699d77968caca81b54d7aa89219b65b4f2630e07dd092a427221fc98c2f9e2890811f3f50c44fe783bbadb3725554898 0004-relax-dep-requirements.patch
-4d6fdc303e0f6ce73fc91cc680f7942c2a902540f090a3c27a2d9f51eecc704093fbba5fb11f25273c688317138959bf5cfb15bac6d5a20ce2be551a4f6c6ab5 0005-make-some-deps-optional.patch"
+33b4dbc733e741343fae9f573ef206a4d698e944946818f8181b49aece3bcfdef0a683ff5e1f592379ada2beef8a4ada1a536046dee64792d78f0677b3d9a545 0001-xdg.patch"