From 5db0cb90fd2be66e8f751d43336512a87c282167 Mon Sep 17 00:00:00 2001 From: miro Date: Fri, 6 Dec 2024 14:23:56 +0000 Subject: [PATCH] always validate constraints url --- ovos_core/skill_installer.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/ovos_core/skill_installer.py b/ovos_core/skill_installer.py index e17d77f6773..01655764649 100644 --- a/ovos_core/skill_installer.py +++ b/ovos_core/skill_installer.py @@ -52,26 +52,28 @@ def pip_install(self, packages: list, LOG.error("no package list provided to install") self.play_error_sound() return False + # Use constraints to limit the installed versions if constraints and not exists(constraints): - if constraints.startswith('http'): - LOG.debug(f"Constraints url: {constraints}") - try: - response = requests.head(constraints) - if response.status_code != 200: - LOG.error(f'Remote constraints file not accessible: {response.status_code}') - self.play_error_sound() - return False - except Exception as e: - LOG.error(f'Error accessing remote constraints: {str(e)}') + LOG.error('Couldn\'t find the constraints file') + self.play_error_sound() + return False + else: + # can be set in mycroft.conf to change to testing/alpha channels + constraints = self.config.get("constraints", SkillsStore.DEFAULT_CONSTRAINTS) + + if constraints.startswith('http'): + LOG.debug(f"Constraints url: {constraints}") + try: + response = requests.head(constraints) + if response.status_code != 200: + LOG.error(f'Remote constraints file not accessible: {response.status_code}') self.play_error_sound() return False - else: - LOG.error('Couldn\'t find the constraints file') + except Exception as e: + LOG.error(f'Error accessing remote constraints: {str(e)}') self.play_error_sound() return False - else: - constraints = self.config.get("constraints", SkillsStore.DEFAULT_CONSTRAINTS) pip_args = [sys.executable, '-m', 'pip', 'install'] if constraints: