Hello community,

here is the log from the commit of package python-msk for openSUSE:Factory 
checked in at 2019-07-31 14:29:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-msk (Old)
 and      /work/SRC/openSUSE:Factory/.python-msk.new.4126 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-msk"

Wed Jul 31 14:29:19 2019 rev:4 rq:719835 version:0.3.13

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-msk/python-msk.changes    2018-11-29 
22:58:58.535611779 +0100
+++ /work/SRC/openSUSE:Factory/.python-msk.new.4126/python-msk.changes  
2019-07-31 14:29:27.222078719 +0200
@@ -1,0 +2,6 @@
+Tue Jul 23 13:59:17 UTC 2019 - Tomáš Chvátal <tchva...@suse.com>
+
+- Update to 0.3.13:
+  * no upstream changelog
+
+-------------------------------------------------------------------

Old:
----
  msk-0.3.12.tar.gz

New:
----
  msk-0.3.13.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-msk.spec ++++++
--- /var/tmp/diff_new_pack.Dz9hvK/_old  2019-07-31 14:29:30.474076088 +0200
+++ /var/tmp/diff_new_pack.Dz9hvK/_new  2019-07-31 14:29:30.498076069 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-msk
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # 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-msk
-Version:        0.3.12
+Version:        0.3.13
 Release:        0
 Summary:        Mycroft Skills Kit
 License:        Apache-2.0

++++++ msk-0.3.12.tar.gz -> msk-0.3.13.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msk-0.3.12/PKG-INFO new/msk-0.3.13/PKG-INFO
--- old/msk-0.3.12/PKG-INFO     2018-11-21 12:15:12.000000000 +0100
+++ new/msk-0.3.13/PKG-INFO     2019-05-24 07:58:10.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: msk
-Version: 0.3.12
+Version: 0.3.13
 Summary: Mycroft Skills Kit
 Home-page: https://github.com/MycroftAI/mycroft-skills-kit
 Author: Mycroft AI
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msk-0.3.12/README.md new/msk-0.3.13/README.md
--- old/msk-0.3.12/README.md    2018-08-27 08:43:07.000000000 +0200
+++ new/msk-0.3.13/README.md    2019-05-23 10:13:56.000000000 +0200
@@ -27,8 +27,7 @@
 ```bash
 msk create
 msk create-test /opt/mycroft/skills/myskill
-msk upload /opt/mycroft/skills/myskill
-msk upgrade /opt/mycroft/skills/myskill
+msk submit /opt/mycroft/skills/myskill
 ```
 ### Creating a New Skill
 
@@ -42,21 +41,15 @@
 
 
[![msk-create-test](https://images2.imgbox.com/9c/c8/gLRS7xuL_o.gif)](https://asciinema.org/a/Ayzaj6QJbKGBfs2eIQWr11idH?speed=1.5)
 
-## Uploading New Skill
+## Submitting a new skill / Updating existing skill
 
-`msk upload /opt/mycroft/skills/myskill`:
+`msk submit /opt/mycroft/skills/myskill`:
 
-[![msk-upload](https://images2.imgbox.com/35/5d/BCVxUxuh_o.gif)](https://asciinema.org/a/Bp1sORVnmVz9wYjZXfempTPoO?speed=1.5)
-
-## Upgrading an Existing Skill
-
-```bash
-msk upgrade /opt/mycroft/skills/myskill
-```
+[![msk-submit](https://images2.imgbox.com/7a/5f/RcBxgLXc_o.gif)](https://asciinema.org/a/242108)
 
  --or--
 
 ```bash
 cd /opt/mycroft/skills/myskill
-msk upgrade .
+msk submit .
 ```
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msk-0.3.12/msk/__init__.py 
new/msk-0.3.13/msk/__init__.py
--- old/msk-0.3.12/msk/__init__.py      2018-11-21 12:10:51.000000000 +0100
+++ new/msk-0.3.13/msk/__init__.py      2019-05-23 14:47:27.000000000 +0200
@@ -19,4 +19,4 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-__version__ = '0.3.12'  # Also update in setup.py
+__version__ = '0.3.13'  # Also update in setup.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msk-0.3.12/msk/actions/create.py 
new/msk-0.3.13/msk/actions/create.py
--- old/msk-0.3.12/msk/actions/create.py        2018-08-27 08:43:07.000000000 
+0200
+++ new/msk-0.3.13/msk/actions/create.py        2019-05-23 14:46:17.000000000 
+0200
@@ -23,7 +23,7 @@
 
 import re
 from argparse import ArgumentParser
-from git import Git
+from git import Git, GitCommandError
 from github import GithubException
 from github.Repository import Repository
 from os import makedirs
@@ -33,26 +33,30 @@
 from typing import Callable, Optional
 
 from msk.console_action import ConsoleAction
-from msk.exceptions import GithubRepoExists
+from msk.exceptions import GithubRepoExists, UnrelatedGithubHistory
 from msk.lazy import Lazy
 from msk.util import ask_input, to_camel, ask_yes_no, ask_input_lines, \
     print_error
 
-readme_template = '''## {title_name}
+readme_template = '''# <img 
src="https://raw.githack.com/FortAwesome/Font-Awesome/master/svgs/solid/robot.svg";
 card_color="#40DBB0" width="50" height="50" style="vertical-align:bottom"/> \
+{title_name}
 {short_description}
 
-## Description
+## About
 {long_description}
 
 ## Examples
 {examples}
-
 {credits}
+## Category
+**{category_primary}**
+{categories_other}
+## Tags
+{tags}
 '''
 
 credits_template = '''## Credits
 {author}
-
 '''
 
 init_template = '''from mycroft import MycroftSkill, intent_file_handler
@@ -72,51 +76,35 @@
 
 '''
 
-gitignore_template = '''*.pyc
+gitignore_template = '''__pycache__/
+*.qmlc
 settings.json
 
 '''
 
-settingsmeta_template = '''{{
-    "name": "{capital_desc}",
-    "skillMetadata": {{
-        "sections": [
-            {{
-                "name": "Options << Name of section",
-                "fields": [
-                    {{
-                        "name": "internal_python_variable_name",
-                        "type": "text",
-                        "label": "Setting Friendly Display Name",
-                        "value": "",
-                        "placeholder": "demo prompt in the input box"
-                    }}
-                ]
-            }},
-            {{
-                "name": "Login << Name of another section",
-                "fields": [
-                    {{
-                        "type": "label",
-                        "label": "Just a little bit of extra info for the user 
to understand following settings"
-                    }},
-                    {{
-                        "name": "username",
-                        "type": "text",
-                        "label": "Username",
-                        "value": ""
-                    }},
-                    {{
-                        "name": "password",
-                        "type": "password",
-                        "label": "Password",
-                        "value": ""
-                    }}
-                ]
-            }}
-        ]
-    }}
-}}'''
+settingsmeta_template = '''name: {capital_desc}
+skillMetadata:
+  sections:
+    - name: Options << Name of section
+      fields:
+        - name: internal_python_variable_name
+          type: text
+          label: Setting Friendly Display Name
+          value: ""
+          placeholder: demo prompt in the input box
+    - name: Login << Name of another section
+      fields:
+        - type: label
+          label: Just a little bit of extra info for the user to understand 
following settings
+        - name: username
+          type: text
+          label: Username
+          value: ""
+        - name: password
+          type: password
+          label: Password
+          value: ""
+'''
 
 
 class CreateAction(ConsoleAction):
@@ -158,7 +146,7 @@
     path = Lazy(lambda s: join(s.msm.skills_dir, s.name + '-skill'))
     git = Lazy(lambda s: Git(s.path))
     short_description = Lazy(lambda s: ask_input(
-        'Enter a one line description for your skill (ie. Orders fresh pizzas 
from the store):',
+        'Enter a one line description for your skill (ie. Orders fresh pizzas 
from the store):\n-',
     ).capitalize())
     author = Lazy(lambda s: ask_input('Enter author:'))
     intent_lines = Lazy(lambda s: [
@@ -180,12 +168,33 @@
     long_description = Lazy(lambda s: '\n\n'.join(
         ask_input_lines('Enter a long description:', '>')
     ).strip().capitalize())
+    category_options = [
+        'Daily', 'Configuration', 'Entertainment', 'Information', 'IoT',
+        'Music & Audio', 'Media', 'Productivity', 'Transport']
+    category_primary = Lazy(lambda s: ask_input(
+        '\nCategories define where the skill will display in the Marketplace. 
It must be one of the following: \n{}. \nEnter the primary category for your 
skill: \n-'.format(', '.join(s.category_options)),
+        lambda x: x in s.category_options
+    ))
+    categories_other = Lazy(lambda s: [
+        i.capitalize() for i in ask_input_lines(
+            'Enter additional categories (optional):', '-'
+        )
+    ])
+    tags = Lazy(lambda s: [
+        i.capitalize() for i in ask_input_lines(
+            'Enter tags to make it easier to search for your skill 
(optional):',
+            '-'
+        )
+    ])
     readme = Lazy(lambda s: readme_template.format(
         title_name=s.name.replace('-', ' ').title(),
         short_description=s.short_description,
         long_description=s.long_description,
-        examples=''.join(' - "{}"\n'.format(i) for i in s.intent_lines),
-        credits=credits_template.format(author=s.author)
+        examples=''.join('* "{}"\n'.format(i) for i in s.intent_lines),
+        credits=credits_template.format(author=s.author),
+        category_primary=s.category_primary,
+        categories_other=''.join('{}\n'.format(i) for i in s.categories_other),
+        tags=''.join('#{}\n'.format(i) for i in s.tags)
     ))
     init_file = Lazy(lambda s: init_template.format(
         class_name=to_camel(s.name.replace('-', '_')),
@@ -231,7 +240,7 @@
             ('__init__.py', lambda: self.init_file),
             ('README.md', lambda: self.readme),
             ('.gitignore', lambda: gitignore_template),
-            ('settingsmeta.json', lambda: settingsmeta_template.format(
+            ('settingsmeta.yaml', lambda: settingsmeta_template.format(
                 capital_desc=self.name.replace('-', ' ').capitalize()
             )),
             ('.git', lambda: git.init())
@@ -257,6 +266,39 @@
             self.git.add('.')
             self.git.commit(message='Initial commit')
 
+    def force_push(self, get_repo_name: Callable = None) -> 
Optional[Repository]:
+        if ask_yes_no(
+                'Are you sure you want to overwrite the remote github repo? '
+                'This cannot be undone and you will lose your commit '
+                'history! (y/N)',
+                False):
+            repo_name = (get_repo_name and get_repo_name()) or (
+                    self.name + '-skill')
+            repo = self.user.get_repo(repo_name)
+            self.git.push('origin', 'master', force=True)
+            print('Force pushed to GitHub repo:', repo.html_url)
+            return repo
+
+    def link_github_repo(self, get_repo_name: Callable = None) -> 
Optional[Repository]:
+        if 'origin' not in Git(self.path).remote().split('\n'):
+            if ask_yes_no(
+                    'Would you like to link an existing GitHub repo to it? 
(Y/n)',
+                    True):
+                repo_name = (get_repo_name and get_repo_name()) or (
+                        self.name + '-skill')
+                repo = self.user.get_repo(repo_name)
+                self.git.remote('add', 'origin', repo.html_url)
+                self.git.fetch()
+                try:
+                    self.git.pull('origin', 'master')
+                except GitCommandError as e:
+                    if e.status == 128:
+                        raise UnrelatedGithubHistory(repo_name) from e
+                    raise
+                self.git.push('origin', 'master', set_upstream=True)
+                print('Linked and pushed to GitHub repo:', repo.html_url)
+                return repo
+
     def create_github_repo(self, get_repo_name: Callable = None) -> 
Optional[Repository]:
         if 'origin' not in Git(self.path).remote().split('\n'):
             if ask_yes_no('Would you like to create a GitHub repo for it? 
(Y/n)', True):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msk-0.3.12/msk/actions/create_test.py 
new/msk-0.3.13/msk/actions/create_test.py
--- old/msk-0.3.12/msk/actions/create_test.py   2018-11-21 12:10:51.000000000 
+0100
+++ new/msk-0.3.13/msk/actions/create_test.py   2019-05-23 10:13:56.000000000 
+0200
@@ -78,12 +78,12 @@
     """
 
     intent_regex = (
-        r'''@intent_handler  \( IntentBuilder \( ['"]['"] \)(('''
-        r''' \. (optionally|require) \( ['"][a-zA-Z]+['"] \))*)\)  \n'''
-        r'''  def ([a-z_]+)'''
+        r'''@(?:\\\n )*intent_handler  (?:\n )*\(  IntentBuilder  \(  
['"][^'"]*['"]  \)((?:  '''
+        r'''\.  (?:optionally|require)  \(  ['"][a-zA-Z_]+['"]  \))*)\) \n'''
+        r'''(?: \\\n)* def (?:\\\n )*([a-z_]+)'''
     ).replace('  ', r'[\s\n]*').replace(' ', r'\s*')
 
-    parts_regex = r'''\. (require|optionally) \( ['"]([a-zA-Z]+)['"] 
\)'''.replace(' ', '\s*')
+    parts_regex = r'''\.  (require|optionally)  \(  ['"]([a-zA-Z_]+)['"]  
\)'''.replace('  ', r'[\s\n]*').replace(' ', '\s*')
     intent_recipe = Lazy(lambda s: s.intent_recipes[s.intent_name])
 
     @Lazy
@@ -114,7 +114,7 @@
     @Lazy
     def intent_recipes(self) -> Dict[str, Dict[str, list]]:
         return {
-            match.group(4): self.extract_recipe(match.group(1))
+            match.group(2): self.extract_recipe(match.group(1))
             for match in re.finditer(self.intent_regex, self.init_content)
         }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msk-0.3.12/msk/actions/upgrade.py 
new/msk-0.3.13/msk/actions/upgrade.py
--- old/msk-0.3.12/msk/actions/upgrade.py       2018-11-21 12:10:51.000000000 
+0100
+++ new/msk-0.3.13/msk/actions/upgrade.py       2019-05-23 10:13:56.000000000 
+0200
@@ -31,7 +31,7 @@
 from msk.util import skills_kit_footer, create_or_edit_pr
 
 body_template = '''
-'This upgrades {skill_name} to include the following new commits:
+This upgrades {skill_name} to include the following new commits:
 
 {commits}
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msk-0.3.12/msk/actions/upload.py 
new/msk-0.3.13/msk/actions/upload.py
--- old/msk-0.3.12/msk/actions/upload.py        2018-11-21 12:10:51.000000000 
+0100
+++ new/msk-0.3.13/msk/actions/upload.py        2019-05-23 10:13:56.000000000 
+0200
@@ -29,7 +29,8 @@
 
 from msk.actions.create import CreateAction
 from msk.console_action import ConsoleAction
-from msk.exceptions import MskException
+from msk.exceptions import MskException, NoGitRepository, \
+    UnrelatedGithubHistory, GithubRepoExists
 from msk.lazy import Lazy
 from msk.repo_action import SkillData
 from msk.util import skills_kit_footer, \
@@ -74,11 +75,25 @@
         creator.initialize_template({'.git', '.gitignore', 'README.md'})
         self.git.add('README.md')
         creator.commit_changes()
-        skill_repo = creator.create_github_repo(lambda: input('Repo name:'))
+
+        try:
+            skill_repo = creator.create_github_repo(
+                lambda: input('Repo name:'))
+        except GithubRepoExists:
+            try:
+                print("A repository with that name already exists")
+                skill_repo = creator.link_github_repo(
+                    lambda: input('Remote repo name:'))
+            except UnrelatedGithubHistory:
+                print("Repository history does not seem to be related")
+                skill_repo = creator.force_push(
+                    lambda: input('Confirm repo name:'))
         if skill_repo:
             self.entry.url = skill_repo.html_url
             self.entry.author = self.user.login
         else:
+            if not self.entry.url:
+                raise NoGitRepository
             skill_repo = self.github.get_repo(skill_repo_name(self.entry.url))
 
         if not skill_repo.permissions.push:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msk-0.3.12/msk/exceptions.py 
new/msk-0.3.13/msk/exceptions.py
--- old/msk-0.3.12/msk/exceptions.py    2018-08-27 08:43:07.000000000 +0200
+++ new/msk-0.3.13/msk/exceptions.py    2019-05-23 10:13:56.000000000 +0200
@@ -40,3 +40,26 @@
 
 class PRModified(MskException):
     pass
+
+
+class SkillNameTaken(GithubRepoExists):
+    """
+    raised when you try to submit a skill with an already taken unique name
+    """
+    pass
+
+
+class UnrelatedGithubHistory(GithubRepoExists):
+    """
+    raised when you try to update a remote with unrelated commit history
+    """
+    pass
+
+
+class NoGitRepository(MskException):
+    """
+    Raised when a skill cannot be updated because it does not belong to any
+    git repo
+    """
+    pass
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msk-0.3.12/msk/util.py new/msk-0.3.13/msk/util.py
--- old/msk-0.3.12/msk/util.py  2018-08-28 15:43:42.000000000 +0200
+++ new/msk-0.3.13/msk/util.py  2019-05-23 10:13:56.000000000 +0200
@@ -35,7 +35,7 @@
 from typing import Optional
 
 from msk import __version__
-from msk.exceptions import PRModified, MskException
+from msk.exceptions import PRModified, MskException, SkillNameTaken
 
 ASKPASS = '''#!/usr/bin/env python3
 import sys
@@ -161,7 +161,12 @@
             raise PRModified('Not updating description since it was not 
autogenerated')
         return pull
     else:
-        return skills_repo.create_pull(title, body, base=base, head=head)
+        try:
+            return skills_repo.create_pull(title, body, base=base, head=head)
+        except GithubException as e:
+            if e.status == 422:
+                raise SkillNameTaken(title) from e
+            raise
 
 
 def to_camel(snake):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msk-0.3.12/msk.egg-info/PKG-INFO 
new/msk-0.3.13/msk.egg-info/PKG-INFO
--- old/msk-0.3.12/msk.egg-info/PKG-INFO        2018-11-21 12:15:12.000000000 
+0100
+++ new/msk-0.3.13/msk.egg-info/PKG-INFO        2019-05-24 07:58:10.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: msk
-Version: 0.3.12
+Version: 0.3.13
 Summary: Mycroft Skills Kit
 Home-page: https://github.com/MycroftAI/mycroft-skills-kit
 Author: Mycroft AI
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/msk-0.3.12/setup.py new/msk-0.3.13/setup.py
--- old/msk-0.3.12/setup.py     2018-11-21 12:10:51.000000000 +0100
+++ new/msk-0.3.13/setup.py     2019-05-23 14:46:30.000000000 +0200
@@ -23,7 +23,7 @@
 
 setup(
     name='msk',
-    version='0.3.12',  # Also update in msk/__init__.py
+    version='0.3.13',  # Also update in msk/__init__.py
     packages=['msk', 'msk.actions'],
     install_requires=['GitPython', 'typing', 'msm>=0.5.13', 'pygithub'],
     url='https://github.com/MycroftAI/mycroft-skills-kit',


Reply via email to