Hello community, here is the log from the commit of package python-msm for openSUSE:Factory checked in at 2020-01-22 22:46:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-msm (Old) and /work/SRC/openSUSE:Factory/.python-msm.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-msm" Wed Jan 22 22:46:31 2020 rev:12 rq:766343 version:0.8.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-msm/python-msm.changes 2019-09-13 14:58:29.877277692 +0200 +++ /work/SRC/openSUSE:Factory/.python-msm.new.26092/python-msm.changes 2020-01-22 22:46:47.184591203 +0100 @@ -1,0 +2,10 @@ +Wed Jan 22 14:42:49 UTC 2020 - Martin Sirringhaus <martin.sirringh...@suse.com> + +- Updating to 0.8.5: + * Fix raising of errors when install and remove fails. + +- Updating to 0.8.4: + * Add method to manually clear cache. + * Limit supported python versions to 3.5+ + +------------------------------------------------------------------- Old: ---- v0.8.3.tar.gz New: ---- v0.8.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-msm.spec ++++++ --- /var/tmp/diff_new_pack.XQDfXf/_old 2020-01-22 22:46:50.124592683 +0100 +++ /var/tmp/diff_new_pack.XQDfXf/_new 2020-01-22 22:46:50.128592685 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-msm # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %define skip_python2 1 %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-msm -Version: 0.8.3 +Version: 0.8.5 Release: 0 Summary: Mycroft Skills Manager License: Apache-2.0 ++++++ v0.8.3.tar.gz -> v0.8.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mycroft-skills-manager-0.8.3/.gitignore new/mycroft-skills-manager-0.8.5/.gitignore --- old/mycroft-skills-manager-0.8.3/.gitignore 2019-08-30 11:33:55.000000000 +0200 +++ new/mycroft-skills-manager-0.8.5/.gitignore 2020-01-13 15:28:42.000000000 +0100 @@ -2,6 +2,9 @@ *.egg-info/ *.pyc dist/ +build/ .pytest_cache/ .coverage *venv/ + +.*.sw? # vim swapfiles diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mycroft-skills-manager-0.8.3/.travis.yml new/mycroft-skills-manager-0.8.5/.travis.yml --- old/mycroft-skills-manager-0.8.3/.travis.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/mycroft-skills-manager-0.8.5/.travis.yml 2020-01-13 15:28:42.000000000 +0100 @@ -0,0 +1,17 @@ +branches: + only: + - master +language: python +python: + - "3.5" + - "3.6" + - "3.7" + - "3.8" +# command to install dependencies +install: + - pip install -r requirements.txt + - pip install . + - mkdir $HOME/.mycroft +# command to run tests +script: + - pytest tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mycroft-skills-manager-0.8.3/msm/mycroft_skills_manager.py new/mycroft-skills-manager-0.8.5/msm/mycroft_skills_manager.py --- old/mycroft-skills-manager-0.8.3/msm/mycroft_skills_manager.py 2019-08-30 11:33:55.000000000 +0200 +++ new/mycroft-skills-manager-0.8.5/msm/mycroft_skills_manager.py 2020-01-13 15:28:42.000000000 +0100 @@ -71,10 +71,9 @@ will_save = self.saving_handled = True try: ret = func(self, *args, **kwargs) - # Write only if no exception occurs + finally: if will_save: self.write_device_skill_state() - finally: # Always restore saving_handled flag if will_save: self.saving_handled = False @@ -110,6 +109,11 @@ with self.lock: self._init_skills_data() + def clear_cache(self): + """Completely clear the skills cache.""" + self._device_skill_state = None + self._invalidate_skills_cache() + @cached_property(ttl=ONE_DAY) def all_skills(self): """Getting a list of skills can take a while so cache it. @@ -376,12 +380,12 @@ skill_state = None raise except MsmException as e: - LOG.exception('Failed to install skill ' + skill.name) skill_state.update( installation='failed', status='error', failure_message=str(e) ) + raise else: skill_state.update( installed=time.time(), @@ -406,6 +410,7 @@ skill.remove() except AlreadyRemoved: LOG.info('Skill {} has already been removed'.format(skill.name)) + raise except RemoveException: LOG.exception('Failed to remove skill ' + skill.name) raise diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mycroft-skills-manager-0.8.3/msm/skill_entry.py new/mycroft-skills-manager-0.8.5/msm/skill_entry.py --- old/mycroft-skills-manager-0.8.3/msm/skill_entry.py 2019-08-30 11:33:55.000000000 +0200 +++ new/mycroft-skills-manager-0.8.5/msm/skill_entry.py 2020-01-13 15:28:42.000000000 +0100 @@ -1,7 +1,7 @@ # Copyright (c) 2018 Mycroft AI, Inc. # # This file is part of Mycroft Skills Manager -# (see https://github.com/MatthewScholefield/mycroft-light). +# (see https://github.com/MycroftAI/mycroft-skills-manager). # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file @@ -280,7 +280,7 @@ def run_pip(self, constraints=None): if not self.dependent_python_packages: - return + return False # Use constraints to limit the installed versions if constraints and not exists(constraints): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mycroft-skills-manager-0.8.3/msm/skill_repo.py new/mycroft-skills-manager-0.8.5/msm/skill_repo.py --- old/mycroft-skills-manager-0.8.3/msm/skill_repo.py 2019-08-30 11:33:55.000000000 +0200 +++ new/mycroft-skills-manager-0.8.5/msm/skill_repo.py 2020-01-13 15:28:42.000000000 +0100 @@ -29,13 +29,14 @@ from msm import git_to_msm_exceptions from msm.exceptions import MsmException -from msm.util import Git +from msm.util import cached_property, Git import logging import requests LOG = logging.getLogger(__name__) MYCROFT_SKILLS_DATA = "https://raw.githubusercontent.com/MycroftAI/mycroft-skills-data" +FIVE_MINUTES = 300 def load_skills_data(branch, path): try: @@ -75,14 +76,19 @@ self.url = url or "https://github.com/MycroftAI/mycroft-skills" self.branch = branch or "19.08" self.repo_info = {} + + @cached_property(ttl=FIVE_MINUTES) + def skills_meta_info(self): try: skills_meta_cache = normpath(join(self.path, '..', '.skills-meta.json')) - self.skills_meta_info = load_skills_data(self.branch, - skills_meta_cache) + skills_meta_info = load_skills_data(self.branch, + skills_meta_cache) except Exception as e: LOG.exception(repr(e)) - self.skills_meta_info = {} + skills_meta_info = {} + + return skills_meta_info def read_file(self, filename): with open(join(self.path, filename)) as f: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mycroft-skills-manager-0.8.3/requirements.txt new/mycroft-skills-manager-0.8.5/requirements.txt --- old/mycroft-skills-manager-0.8.3/requirements.txt 2019-08-30 11:33:55.000000000 +0200 +++ new/mycroft-skills-manager-0.8.5/requirements.txt 2020-01-13 15:28:42.000000000 +0100 @@ -1,4 +1,4 @@ +requests GitPython -typing fasteners -lazy \ No newline at end of file +lazy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mycroft-skills-manager-0.8.3/setup.py new/mycroft-skills-manager-0.8.5/setup.py --- old/mycroft-skills-manager-0.8.3/setup.py 2019-08-30 11:33:55.000000000 +0200 +++ new/mycroft-skills-manager-0.8.5/setup.py 2020-01-13 15:28:42.000000000 +0100 @@ -23,16 +23,18 @@ setup( name='msm', - version='0.8.3', + version='0.8.5', packages=['msm'], install_requires=[ - 'GitPython', 'typing', 'fasteners', 'pyyaml', 'pako', + 'GitPython', 'fasteners', 'pyyaml', 'pako', 'lazy' ], + python_requires='>=3.5', url='https://github.com/MycroftAI/mycroft-skills-manager', license='Apache-2.0', - author='jarbasAI, Matthew Scholefield', - author_email='jarba...@mailfence.com, matthew331...@gmail.com', + author='jarbasAI, Matthew Scholefield, Mycroft AI', + author_email='jarba...@mailfence.com, matthew331...@gmail.com, ' + 'd...@mycroft.ai', description='Mycroft Skills Manager', entry_points={ 'console_scripts': { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mycroft-skills-manager-0.8.3/tests/test_mycroft_skills_manager.py new/mycroft-skills-manager-0.8.5/tests/test_mycroft_skills_manager.py --- old/mycroft-skills-manager-0.8.3/tests/test_mycroft_skills_manager.py 2019-08-30 11:33:55.000000000 +0200 +++ new/mycroft-skills-manager-0.8.5/tests/test_mycroft_skills_manager.py 2020-01-13 15:28:42.000000000 +0100 @@ -21,16 +21,16 @@ # under the License. import json import os +from os.path import dirname, join import tempfile from pathlib import Path from shutil import copyfile, rmtree from unittest import TestCase -from unittest.mock import call, Mock, patch -import pytest +from unittest.mock import call, Mock, patch from msm import MycroftSkillsManager, AlreadyInstalled, AlreadyRemoved -from msm.exceptions import SkillNotFound, MultipleSkillMatches, MsmException +from msm.exceptions import MsmException from msm.skill_state import device_skill_state_hash @@ -44,7 +44,8 @@ self._mock_skills_json_path() self._mock_skill_entry() self._mock_skill_repo() - copyfile('skills_test.json', str(self.skills_json_path)) + copyfile(join(dirname(__file__), 'skills_test.json'), + str(self.skills_json_path)) self.msm = MycroftSkillsManager( platform='default', skills_dir=str(self.temp_dir.joinpath('skills')), @@ -160,10 +161,12 @@ ] self.assertTrue(self.skills_json_path.exists()) - with open(self.skills_json_path) as skills_json: + with open(str(self.skills_json_path)) as skills_json: device_skill_state = json.load(skills_json) - self.assertListEqual(initial_state, state['skills']) - self.assertListEqual(initial_state, device_skill_state['skills']) + self.assertListEqual(sorted(initial_state, key=lambda x: x['name']), + sorted(device_skill_state['skills'], key=lambda x:x['name'])) + self.assertListEqual(sorted(initial_state, key=lambda x: x['name']), + sorted(device_skill_state['skills'], key=lambda x: x['name'])) self.assertListEqual([], state['blacklist']) self.assertListEqual([], device_skill_state['blacklist']) self.assertEqual(2, state['version']) @@ -227,7 +230,7 @@ time_mock.time.return_value = 100 self.msm.install(skill_to_install, origin='voice') - with open(self.skills_json_path) as skills_json: + with open(str(self.skills_json_path)) as skills_json: device_skill_state = json.load(skills_json) skill_test_state = dict( @@ -285,10 +288,11 @@ skill_to_install.is_beta = False skill_to_install.install = Mock(side_effect=MsmException('RED ALERT!')) with patch('msm.mycroft_skills_manager.isinstance') as isinstance_mock: - isinstance_mock.return_value = True - self.msm.install(skill_to_install, origin='cli') + with self.assertRaises(MsmException): + isinstance_mock.return_value = True + self.msm.install(skill_to_install, origin='cli') - with open(self.skills_json_path) as skills_json: + with open(str(self.skills_json_path)) as skills_json: device_skill_state = json.load(skills_json) skill_test_state = dict( @@ -324,7 +328,7 @@ isinstance_mock.return_value = True self.msm.remove(skill_to_remove) - with open(self.skills_json_path) as skills_json: + with open(str(self.skills_json_path)) as skills_json: device_skill_state = json.load(skills_json) skill_names = [skill['name'] for skill in device_skill_state['skills']] @@ -355,7 +359,8 @@ ) with patch('msm.mycroft_skills_manager.isinstance') as isinstance_mock: isinstance_mock.return_value = True - self.msm.remove(skill_to_remove) + with self.assertRaises(AlreadyRemoved): + self.msm.remove(skill_to_remove) self.assertListEqual([call.remove()], skill_to_remove.method_calls) self.assertIsNotNone(self.msm._local_skills) @@ -409,7 +414,7 @@ time_mock.time.return_value = 100 self.msm.update(skill_to_update) - with open(self.skills_json_path) as skills_json: + with open(str(self.skills_json_path)) as skills_json: device_skill_state = json.load(skills_json) skill_names = [skill['name'] for skill in device_skill_state['skills']]