From 6e41341d6cbd46c8950b9fa9bd9e537c43fd6a52 Mon Sep 17 00:00:00 2001 From: jarbasai Date: Thu, 3 Mar 2022 16:52:36 +0000 Subject: [PATCH 1/2] fix/platform_detect --- ovos_utils/configuration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ovos_utils/configuration.py b/ovos_utils/configuration.py index 259b97a1..c6dbaec0 100644 --- a/ovos_utils/configuration.py +++ b/ovos_utils/configuration.py @@ -69,7 +69,7 @@ def get_ovos_config(): else: subcores = config.get("submodule_mappings") or {} for k in subcores: - if _is_running_from_module(k): + if is_running_from_module(k): config = merge_dict(config, cores[subcores[k]]) break From f34f7e16b5ecbd00547bba87c2a34050c27f8bd9 Mon Sep 17 00:00:00 2001 From: jarbasai Date: Thu, 3 Mar 2022 23:20:05 +0000 Subject: [PATCH 2/2] fix/resolve_resource_file --- ovos_utils/file_utils.py | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/ovos_utils/file_utils.py b/ovos_utils/file_utils.py index a9e7a7b1..685d4de9 100644 --- a/ovos_utils/file_utils.py +++ b/ovos_utils/file_utils.py @@ -7,6 +7,7 @@ import tempfile from ovos_utils.bracket_expansion import expand_options from ovos_utils.log import LOG +from ovos_utils.system import search_mycroft_core_location def get_temp_path(*args): @@ -61,18 +62,12 @@ def resolve_ovos_resource_file(res_name): if os.path.isfile(filename): return filename - # let's look in ovos_workshop if it's installed - try: - import ovos_workshop - pkg_dir = dirname(ovos_workshop.__file__) - filename = join(pkg_dir, "res", res_name) - if os.path.isfile(filename): - return filename - filename = join(pkg_dir, "res", "ui", res_name) + # let's look in mycroft/ovos-core if it's installed + path = search_mycroft_core_location() + if path: + filename = join(path, "mycroft", "res", res_name) if os.path.isfile(filename): return filename - except: - pass return None # Resource cannot be resolved @@ -125,21 +120,6 @@ def resolve_resource_file(res_name, root_path=None, config=None): if found: return found - # Finally look for it in the source package - paths = [ - "/opt/venvs/mycroft-core/lib/python3.7/site-packages/", # mark1/2 - "/opt/venvs/mycroft-core/lib/python3.4/site-packages/ ", - # old mark1 installs - "/home/pi/mycroft-core" # picroft - ] - if root_path: - paths += [root_path] - for p in paths: - filename = os.path.join(p, 'mycroft', 'res', res_name) - filename = os.path.abspath(os.path.normpath(filename)) - if os.path.isfile(filename): - return filename - return None # Resource cannot be resolved