Hello community, here is the log from the commit of package python-msm for openSUSE:Factory checked in at 2019-07-24 20:37:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-msm (Old) and /work/SRC/openSUSE:Factory/.python-msm.new.4126 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-msm" Wed Jul 24 20:37:14 2019 rev:9 rq:718217 version:0.7.8 Changes: -------- --- /work/SRC/openSUSE:Factory/python-msm/python-msm.changes 2019-06-02 15:18:04.714034231 +0200 +++ /work/SRC/openSUSE:Factory/.python-msm.new.4126/python-msm.changes 2019-07-24 20:37:15.490562744 +0200 @@ -1,0 +2,9 @@ +Wed Jul 24 12:11:06 UTC 2019 - [email protected] + +- version update to 0.7.8 + * Allow limiting the number of threads when running the apply() method. + * Fix Skill GID for skills not in marketplace + * Make sure skills.json file is updated from changes to skill GID + * Cache marketplace skills meta data + +------------------------------------------------------------------- Old: ---- v0.7.6.tar.gz New: ---- v0.7.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-msm.spec ++++++ --- /var/tmp/diff_new_pack.P4QLVI/_old 2019-07-24 20:37:16.022562686 +0200 +++ /var/tmp/diff_new_pack.P4QLVI/_new 2019-07-24 20:37:16.022562686 +0200 @@ -19,7 +19,7 @@ %define skip_python2 1 %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-msm -Version: 0.7.6 +Version: 0.7.8 Release: 0 Summary: Mycroft Skills Manager License: Apache-2.0 @@ -46,6 +46,7 @@ Requires: python-lazy Requires: python-pako Requires: python-requests +Requires: python-setuptools Requires: python-typing BuildArch: noarch %python_subpackages ++++++ v0.7.6.tar.gz -> v0.7.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mycroft-skills-manager-0.7.6/msm/mycroft_skills_manager.py new/mycroft-skills-manager-0.7.8/msm/mycroft_skills_manager.py --- old/mycroft-skills-manager-0.7.6/msm/mycroft_skills_manager.py 2019-05-23 17:30:27.000000000 +0200 +++ new/mycroft-skills-manager-0.7.8/msm/mycroft_skills_manager.py 2019-07-09 16:28:02.000000000 +0200 @@ -167,6 +167,13 @@ remove_list.append(s) for skill in remove_list: skills_data['skills'].remove(skill) + + # Update skill gids + for s in local_skills: + for e in skills_data['skills']: + if e['name'] == s.name: + e['skill_gid'] = s.skill_gid + return skills_data def load_skills_data(self) -> dict: @@ -263,7 +270,7 @@ entry['updated'] = time.time() @save_skills_data - def apply(self, func, skills): + def apply(self, func, skills, max_threads=20): """Run a function on all skills in parallel""" def run_item(skill): @@ -280,7 +287,7 @@ func.__name__, skill.name )) - with ThreadPool(20) as tp: + with ThreadPool(max_threads) as tp: return tp.map(run_item, skills) @save_skills_data diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mycroft-skills-manager-0.7.6/msm/skill_entry.py new/mycroft-skills-manager-0.7.8/msm/skill_entry.py --- old/mycroft-skills-manager-0.7.6/msm/skill_entry.py 2019-05-23 17:30:27.000000000 +0200 +++ new/mycroft-skills-manager-0.7.8/msm/skill_entry.py 2019-07-09 16:28:02.000000000 +0200 @@ -161,17 +161,15 @@ @property def skill_gid(self): - """ Format skill gid for the skill - - """ + """ Format skill gid for the skill. """ gid = '' if self.is_dirty: - gid +='@|' + gid += '@|' if self.meta_info != {}: gid += self.meta_info['skill_gid'] else: name = self.name.split('.')[0] - gid += '{}|{}'.format(name, self.msm.repo.branch) + gid += name return gid def __str__(self): @@ -374,7 +372,7 @@ if exists(yml_path): LOG.info('Reading from manifest.yml') with open(yml_path) as f: - info = yaml.load(f) + info = yaml.safe_load(f) self.verify_info(info, self.manifest_yml_format) return info or {} return {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mycroft-skills-manager-0.7.6/msm/skill_repo.py new/mycroft-skills-manager-0.7.8/msm/skill_repo.py --- old/mycroft-skills-manager-0.7.6/msm/skill_repo.py 2019-05-23 17:30:27.000000000 +0200 +++ new/mycroft-skills-manager-0.7.8/msm/skill_repo.py 2019-07-09 16:28:02.000000000 +0200 @@ -21,7 +21,8 @@ # under the License. from glob import glob from os import makedirs -from os.path import exists, join, isdir, dirname, basename +from os.path import exists, join, isdir, dirname, basename, normpath +import json from git import Repo from git.exc import GitCommandError, GitError @@ -36,15 +37,38 @@ MYCROFT_SKILLS_DATA = "https://raw.githubusercontent.com/MycroftAI/mycroft-skills-data" -def load_skills_data(branch): +def load_skills_data(branch, path): try: market_info_url = (MYCROFT_SKILLS_DATA + "/" + branch + "/skill-metadata.json") info = requests.get(market_info_url).json() + # Cache the received data + with open(path, 'w') as f: + try: + json.dump(info, f) + except Exception as e: + LOG.warning('Couldn\'t save cached version of ' + 'skills-metadata.json') return {info[k]['repo'].lower(): info[k] for k in info} except (requests.HTTPError, requests.exceptions.ConnectionError): + pass + except Exception as e: + LOG.warning("Skill metadata couldn't be fetched ({})".format(repr(e))) + + # Try to load cache if fetching failed + if exists(path): + with open(path) as f: + try: + info = json.load(f) + except Exception: + LOG.warning('skills-metadata cache exists but can\'t ' + 'be parsed') + return {} + return {info[k]['repo'].lower(): info[k] for k in info} + else: return {} + class SkillRepo(object): def __init__(self, path=None, url=None, branch=None): self.path = path or "/opt/mycroft/.skills-repo" @@ -52,9 +76,13 @@ self.branch = branch or "19.02" self.repo_info = {} try: - self.skills_meta_info = load_skills_data(self.branch) + skills_meta_cache = normpath(join(self.path, + '..', '.skills-meta.json')) + self.skills_meta_info = load_skills_data(self.branch, + skills_meta_cache) except Exception as e: - raise MsmException + LOG.exception(repr(e)) + self.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.7.6/setup.py new/mycroft-skills-manager-0.7.8/setup.py --- old/mycroft-skills-manager-0.7.6/setup.py 2019-05-23 17:30:27.000000000 +0200 +++ new/mycroft-skills-manager-0.7.8/setup.py 2019-07-09 16:28:02.000000000 +0200 @@ -23,7 +23,7 @@ setup( name='msm', - version='0.7.6', + version='0.7.8', packages=['msm'], install_requires=[ 'GitPython', 'typing', 'fasteners', 'pyyaml', 'pako',
