Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-msk for openSUSE:Factory checked in at 2021-08-30 13:55:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-msk (Old) and /work/SRC/openSUSE:Factory/.python-msk.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-msk" Mon Aug 30 13:55:13 2021 rev:7 rq:914946 version:0.3.16 Changes: -------- --- /work/SRC/openSUSE:Factory/python-msk/python-msk.changes 2020-05-26 17:23:08.744468244 +0200 +++ /work/SRC/openSUSE:Factory/.python-msk.new.1899/python-msk.changes 2021-08-30 13:55:31.817847201 +0200 @@ -1,0 +2,22 @@ +Mon Aug 30 06:51:52 UTC 2021 - Steve Kowalik <steven.kowa...@suse.com> + +- Correct Require for python-GitPython and python-PyGithub. + +------------------------------------------------------------------- +Wed Aug 25 10:24:48 UTC 2021 - John Paul Adrian Glaubitz <adrian.glaub...@suse.com> + +- Update to version 0.3.16 + * Ensure local HEAD matches remote during upgrade (#36) + * Remove typing dependency - only required for Python <= 3.4 (#45) + * Include license file in sdist package (#47) + * Add default icon and color during Skill creation (#52) + * Improved category selection and display (#53) + * Improve PyPI listing info (#51) +- from version 0.3.15 + * Switch Github authentication to utilize Personal Access Tokens as the + existing username and password method is being deprecated. + * Fix handling of --repo-cache argument. + * Query for name and e-mail if missing. +- Update Requires in setup.py + +------------------------------------------------------------------- Old: ---- msk-0.3.14.tar.gz New: ---- msk-0.3.16.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-msk.spec ++++++ --- /var/tmp/diff_new_pack.n3P03e/_old 2021-08-30 13:55:32.465848033 +0200 +++ /var/tmp/diff_new_pack.n3P03e/_new 2021-08-30 13:55:32.469848038 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-msk # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 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-msk -Version: 0.3.14 +Version: 0.3.16 Release: 0 Summary: Mycroft Skills Kit License: Apache-2.0 @@ -30,11 +30,11 @@ BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-GitPython +Requires: python-GitPython >= 3.0.5 Requires: python-PyGithub Requires: python-msm >= 0.5.13 Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(postun):update-alternatives BuildArch: noarch %ifpython2 Requires: python-typing ++++++ msk-0.3.14.tar.gz -> msk-0.3.16.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/LICENSE new/msk-0.3.16/LICENSE --- old/msk-0.3.14/LICENSE 1970-01-01 01:00:00.000000000 +0100 +++ new/msk-0.3.16/LICENSE 2020-06-03 13:01:17.000000000 +0200 @@ -0,0 +1,176 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/MANIFEST.in new/msk-0.3.16/MANIFEST.in --- old/msk-0.3.14/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100 +++ new/msk-0.3.16/MANIFEST.in 2020-09-09 08:33:05.000000000 +0200 @@ -0,0 +1 @@ +include LICENSE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/PKG-INFO new/msk-0.3.16/PKG-INFO --- old/msk-0.3.14/PKG-INFO 2019-12-03 09:27:23.000000000 +0100 +++ new/msk-0.3.16/PKG-INFO 2020-09-09 08:37:06.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: msk -Version: 0.3.14 +Version: 0.3.16 Summary: Mycroft Skills Kit Home-page: https://github.com/MycroftAI/mycroft-skills-kit Author: Mycroft AI @@ -8,5 +8,68 @@ Maintainer: Matthew Scholefield Maintainer-email: matthew331...@gmail.com License: Apache-2.0 -Description: UNKNOWN +Description: # Mycroft Skills Kit + + *Mycroft Skills Kit* + + [](https://asciinema.org/a/X5pWLPOpsMLUPYp5kgswNm5Zu?speed=1.5) + + A tool to help with creating, uploading, and upgrading Mycroft skills on the + [skills repo](https://github.com/mycroftai/mycroft-skills). + + ## Features + + - Create a new skill + - Create an intent test for a skill + - Upload a skill + - Upgrade an existing skill + + ## Install + + *Note: Only Linux has been tested* + + ```bash + pip3 install msk + ``` + + ## Usage + + ```bash + msk create + msk create-test /opt/mycroft/skills/myskill + msk submit /opt/mycroft/skills/myskill + ``` + ### Creating a New Skill + + `msk create`: + + [](https://asciinema.org/a/X5pWLPOpsMLUPYp5kgswNm5Zu?speed=1.5) + + ### Creating Tests + + `msk create-test /opt/mycroft/skills/myskill`: + + [](https://asciinema.org/a/Ayzaj6QJbKGBfs2eIQWr11idH?speed=1.5) + + ## Submitting a new skill / Updating existing skill + + `msk submit /opt/mycroft/skills/myskill`: + + [](https://asciinema.org/a/242108) + + --or-- + + ```bash + cd /opt/mycroft/skills/myskill + msk submit . + ``` + Platform: UNKNOWN +Classifier: Development Status :: 4 - Beta +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Description-Content-Type: text/markdown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk/__init__.py new/msk-0.3.16/msk/__init__.py --- old/msk-0.3.14/msk/__init__.py 2019-12-03 09:25:02.000000000 +0100 +++ new/msk-0.3.16/msk/__init__.py 2020-09-09 07:35:31.000000000 +0200 @@ -1,22 +1,18 @@ # Copyright (c) 2018 Mycroft AI, Inc. # -# This file is part of Mycroft Light -# (see https://github.com/MatthewScholefield/mycroft-light). +# This file is part of Mycroft Skills Kit +# (see https://github.com/MycroftAI/mycroft-skills-kit). # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -__version__ = '0.3.14' # Also update in setup.py +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = '0.3.16' # Also update in setup.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk/__main__.py new/msk-0.3.16/msk/__main__.py --- old/msk-0.3.14/msk/__main__.py 2018-11-21 12:10:51.000000000 +0100 +++ new/msk-0.3.16/msk/__main__.py 2020-09-09 07:19:29.000000000 +0200 @@ -1,24 +1,20 @@ # Copyright (c) 2018 Mycroft AI, Inc. # -# This file is part of Mycroft Light -# (see https://github.com/MatthewScholefield/mycroft-light). +# This file is part of Mycroft Skills Kit +# (see https://github.com/MycroftAI/mycroft-skills-kit). # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. import sys from argparse import ArgumentParser @@ -29,7 +25,7 @@ from msk.actions.submit import SubmitAction from msk.exceptions import MskException from msk.global_context import GlobalContext - +from msk.util import ensure_git_user action_names = { SubmitAction: ['submit', 'update', 'upgrade', 'upload'], CreateAction: ['create'], @@ -44,7 +40,6 @@ parser.add_argument('-b', '--repo-branch', help='Branch of skills repo to upload to') parser.add_argument('-s', '--skills-dir', help='Directory to look for skills in') parser.add_argument('-c', '--repo-cache', help='Location to store local skills repo clone') - parser.add_argument('-t', '--use-token', action='store_true') subparsers = parser.add_subparsers(dest='action') subparsers.required = True @@ -55,12 +50,14 @@ args = parser.parse_args(sys.argv[1:]) + ensure_git_user() context = GlobalContext() context.lang = args.lang context.msm = MycroftSkillsManager( - skills_dir=args.skills_dir, repo=SkillRepo(url=args.repo_url, branch=args.repo_branch) + skills_dir=args.skills_dir, repo=SkillRepo(url=args.repo_url, + branch=args.repo_branch, + path=args.repo_cache) ) - context.use_token = args.use_token context.branch = context.msm.repo.branch try: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk/actions/create.py new/msk-0.3.16/msk/actions/create.py --- old/msk-0.3.14/msk/actions/create.py 2019-11-23 15:53:27.000000000 +0100 +++ new/msk-0.3.16/msk/actions/create.py 2020-09-09 08:33:05.000000000 +0200 @@ -1,24 +1,20 @@ # Copyright (c) 2018 Mycroft AI, Inc. # -# This file is part of Mycroft Light -# (see https://github.com/MatthewScholefield/mycroft-light). +# This file is part of Mycroft Skills Kit +# (see https://github.com/MycroftAI/mycroft-skills-kit). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. import atexit import re @@ -39,7 +35,7 @@ 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, get_licenses + print_error, get_licenses, ask_choice readme_template = '''# <img src="https://raw.githack.com/FortAwesome/Font-Awesome/master/svgs/solid/{icon}.svg" card_color="{color}" width="50" height="50" style="vertical-align:bottom"/> \ {title_name} @@ -212,34 +208,28 @@ ).strip().capitalize()) icon = Lazy(lambda s: ask_input( 'Go to Font Awesome ({blue}fontawesome.com/cheatsheet{reset}) and choose an icon.' - '\nEnter the name of the icon:'.format(blue=Fore.BLUE + Style.BRIGHT, reset=Style.RESET_ALL), + '\nEnter the name of the icon (default: robot):'.format(blue=Fore.BLUE + Style.BRIGHT, reset=Style.RESET_ALL), validator=lambda x: - requests.get("https://raw.githack.com/FortAwesome/Font-Awesome/" - "master/svgs/solid/{x}.svg".format(x=x)).ok, + x == '' or requests.get("https://raw.githack.com/FortAwesome/Font-Awesome/" + "master/svgs/solid/{x}.svg".format(x=x)).ok, on_fail="\n\n{red}Error: The name was not found. Make sure you spelled the icon name right," " and try again.{reset}\n".format(red=Fore.RED + Style.BRIGHT, reset=Style.RESET_ALL))) color = Lazy(lambda s: ask_input( "Pick a {yellow}color{reset} for your icon. Find a color that matches the color scheme at" " {blue}mycroft.ai/colors{reset}, or pick a color at: {blue}color-hex.com.{reset}" - "\nEnter the color hex code (including the #):".format(blue=Fore.BLUE + Style.BRIGHT, yellow=Fore.YELLOW, reset=Style.RESET_ALL), - validator=lambda hex_code: hex_code[0] == "#" and len(hex_code) in [4, 7], + "\nEnter the color hex code including the # (default: #22A7F0):".format(blue=Fore.BLUE + Style.BRIGHT, yellow=Fore.YELLOW, reset=Style.RESET_ALL), + validator=lambda hex_code: + hex_code == '' or hex_code[0] == "#" and len(hex_code) in [4, 7], on_fail="\n{red}Check that you entered a correct hex code, and try again.{reset}\n".format( red=Fore.RED + Style.BRIGHT, reset=Style.RESET_ALL) )) - 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):', '-' - ) - ]) + + category_options = ['Daily', 'Configuration', 'Entertainment', 'Information', 'IoT', + 'Music & Audio', 'Media', 'Productivity', 'Transport'] + category_primary = Lazy(lambda s: s.ask_category_primary()) + categories_other= Lazy(lambda s: s.ask_categories_other(s.category_primary)) + tags = Lazy(lambda s: [ i.capitalize() for i in ask_input_lines( 'Enter tags to make it easier to search for your skill (optional):', @@ -257,8 +247,8 @@ long_description=s.long_description, examples=''.join('* "{}"\n'.format(i) for i in s.intent_lines), credits=credits_template.format(author=s.author), - icon=s.icon, - color=s.color.upper(), + icon=s.icon or 'robot', + color=s.color.upper() or '#22A7F0', 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), @@ -295,6 +285,30 @@ with open(join(self.path, 'locale', self.lang, self.intent_name + '.dialog'), 'w') as f: f.write('\n'.join(self.dialog_lines + [''])) + def ask_category_primary(self): + """Ask user to select primary category.""" + category = ask_choice('\nCategories define where the skill will display in the Marketplace. \nEnter the primary category for your skill: ', + self.category_options, allow_empty=False) + return category + + def ask_categories_other(self, category_primary): + """Ask user to select aditional categories.""" + categories_other = [] + while True: + category_options_formatted = [] + for category in self.category_options: + if (category == category_primary) or (category in categories_other): + category = '*' + category + '*' + category_options_formatted.append(category) + category = ask_choice('Enter additional categories (optional):', + category_options_formatted, allow_empty=True, + on_empty=None) + if (category != None) and (category[0] != '*'): + categories_other.append(category) + if category == None: + break + return categories_other + def license(self): """Ask user to select a license for the repo.""" license_files = get_licenses() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk/actions/create_test.py new/msk-0.3.16/msk/actions/create_test.py --- old/msk-0.3.14/msk/actions/create_test.py 2019-05-23 10:13:56.000000000 +0200 +++ new/msk-0.3.16/msk/actions/create_test.py 2020-06-03 13:01:17.000000000 +0200 @@ -1,24 +1,20 @@ # Copyright (c) 2018 Mycroft AI, Inc. # -# This file is part of Mycroft Light -# (see https://github.com/MatthewScholefield/mycroft-light). +# This file is part of Mycroft Skills Kit +# (see https://github.com/MycroftAI/mycroft-skills-kit). # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. from itertools import chain, count import json diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk/actions/submit.py new/msk-0.3.16/msk/actions/submit.py --- old/msk-0.3.14/msk/actions/submit.py 2018-11-21 12:10:51.000000000 +0100 +++ new/msk-0.3.16/msk/actions/submit.py 2020-06-03 13:01:17.000000000 +0200 @@ -1,3 +1,20 @@ +# Copyright (c) 2018 Mycroft AI, Inc. +# +# This file is part of Mycroft Skills Kit +# (see https://github.com/MycroftAI/mycroft-skills-kit). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# from argparse import ArgumentParser from msk.actions.upgrade import UpgradeAction diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk/actions/upgrade.py new/msk-0.3.16/msk/actions/upgrade.py --- old/msk-0.3.14/msk/actions/upgrade.py 2019-05-23 10:13:56.000000000 +0200 +++ new/msk-0.3.16/msk/actions/upgrade.py 2020-09-09 08:33:05.000000000 +0200 @@ -1,24 +1,20 @@ # Copyright (c) 2018 Mycroft AI, Inc. # -# This file is part of Mycroft Light -# (see https://github.com/MatthewScholefield/mycroft-light). +# This file is part of Mycroft Skills Kit +# (see https://github.com/MycroftAI/mycroft-skills-kit). # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. from argparse import ArgumentParser from genericpath import samefile from git import Git @@ -77,7 +73,6 @@ print('Upgrading an existing skill in the skill repo...') upgrade_branch = self.skill.upgrade() self.repo.push_to_fork(upgrade_branch) - title, body = self.create_pr_message(self.skill.git, self.skill.hub) print() print('===', title, '===') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk/actions/upload.py new/msk-0.3.16/msk/actions/upload.py --- old/msk-0.3.14/msk/actions/upload.py 2019-11-23 15:53:27.000000000 +0100 +++ new/msk-0.3.16/msk/actions/upload.py 2020-06-03 13:01:17.000000000 +0200 @@ -1,24 +1,20 @@ # Copyright (c) 2018 Mycroft AI, Inc. # -# This file is part of Mycroft Light -# (see https://github.com/MatthewScholefield/mycroft-light). +# This file is part of Mycroft Skills Kit +# (see https://github.com/MycroftAI/mycroft-skills-kit). # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. import os import shutil from argparse import ArgumentParser diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk/console_action.py new/msk-0.3.16/msk/console_action.py --- old/msk-0.3.14/msk/console_action.py 2018-08-27 08:43:07.000000000 +0200 +++ new/msk-0.3.16/msk/console_action.py 2020-06-03 13:01:17.000000000 +0200 @@ -1,24 +1,20 @@ # Copyright (c) 2018 Mycroft AI, Inc. # -# This file is part of Mycroft Light -# (see https://github.com/MatthewScholefield/mycroft-light). +# This file is part of Mycroft Skills Kit +# (see https://github.com/MycroftAI/mycroft-skills-kit). # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. from abc import ABCMeta, abstractmethod from argparse import ArgumentParser diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk/exceptions.py new/msk-0.3.16/msk/exceptions.py --- old/msk-0.3.14/msk/exceptions.py 2019-05-23 10:13:56.000000000 +0200 +++ new/msk-0.3.16/msk/exceptions.py 2020-06-03 13:01:17.000000000 +0200 @@ -1,24 +1,20 @@ # Copyright (c) 2018 Mycroft AI, Inc. # -# This file is part of Mycroft Light -# (see https://github.com/MatthewScholefield/mycroft-light). +# This file is part of Mycroft Skills Kit +# (see https://github.com/MycroftAI/mycroft-skills-kit). # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. from msm import MsmException diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk/global_context.py new/msk-0.3.16/msk/global_context.py --- old/msk-0.3.14/msk/global_context.py 2018-08-28 15:43:42.000000000 +0200 +++ new/msk-0.3.16/msk/global_context.py 2020-06-03 13:01:17.000000000 +0200 @@ -1,30 +1,26 @@ # Copyright (c) 2018 Mycroft AI, Inc. # -# This file is part of Mycroft Light -# (see https://github.com/MatthewScholefield/mycroft-light). +# This file is part of Mycroft Skills Kit +# (see https://github.com/MycroftAI/mycroft-skills-kit). # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. from github import Github from github.AuthenticatedUser import AuthenticatedUser from msm import MycroftSkillsManager from msk.lazy import Lazy, unset -from msk.util import ask_for_github_credentials +from msk.util import ask_for_github_token class GlobalContext: @@ -32,5 +28,6 @@ msm = Lazy(unset) # type: MycroftSkillsManager use_token = Lazy(unset) # type: bool branch = Lazy(unset) # type: str - github = Lazy(lambda s: ask_for_github_credentials(s.use_token)) # type: Github - user = Lazy(lambda s: s.github.get_user()) # type: AuthenticatedUser + github = Lazy(lambda s: ask_for_github_token()) # type: Github + user = Lazy(lambda s: s.github.get_user()) # type: AuthenticatedUser + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk/lazy.py new/msk-0.3.16/msk/lazy.py --- old/msk-0.3.14/msk/lazy.py 2018-08-27 08:43:07.000000000 +0200 +++ new/msk-0.3.16/msk/lazy.py 2020-06-03 13:01:17.000000000 +0200 @@ -1,24 +1,20 @@ # Copyright (c) 2018 Mycroft AI, Inc. # -# This file is part of Mycroft Light -# (see https://github.com/MatthewScholefield/mycroft-light). +# This file is part of Mycroft Skills Kit +# (see https://github.com/MycroftAI/mycroft-skills-kit). # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. from functools import wraps diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk/repo_action.py new/msk-0.3.16/msk/repo_action.py --- old/msk-0.3.14/msk/repo_action.py 2018-11-21 12:10:51.000000000 +0100 +++ new/msk-0.3.16/msk/repo_action.py 2020-09-09 08:33:05.000000000 +0200 @@ -1,24 +1,20 @@ # Copyright (c) 2018 Mycroft AI, Inc. # -# This file is part of Mycroft Light -# (see https://github.com/MatthewScholefield/mycroft-light). +# This file is part of Mycroft Skills Kit +# (see https://github.com/MycroftAI/mycroft-skills-kit). # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. from contextlib import suppress from git import Git, GitCommandError from github.Repository import Repository @@ -77,6 +73,8 @@ def upgrade(self) -> str: skill_module = self.submodule_name + submod = Git(join(self.repo.msminfo.path, skill_module)) + submod.remote('set-head', 'origin', '-a') self.repo.msminfo.update() self.repo_git.fetch() self.repo_git.reset(self.repo_branch, hard=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk/util.py new/msk-0.3.16/msk/util.py --- old/msk-0.3.14/msk/util.py 2019-12-03 09:21:48.000000000 +0100 +++ new/msk-0.3.16/msk/util.py 2020-06-03 13:01:17.000000000 +0200 @@ -1,31 +1,28 @@ # Copyright (c) 2018 Mycroft AI, Inc. # -# This file is part of Mycroft Light -# (see https://github.com/MatthewScholefield/mycroft-light). +# This file is part of Mycroft Skills Kit +# (see https://github.com/MycroftAI/mycroft-skills-kit). # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. import atexit import os +from configparser import NoOptionError from contextlib import contextmanager from difflib import SequenceMatcher from functools import wraps -from getpass import getpass +from git.config import GitConfigParser, get_config_path from github import Github, GithubException from github.Repository import Repository from msm import SkillEntry @@ -34,58 +31,123 @@ from tempfile import mkstemp from typing import Optional from glob import glob +from pathlib import Path from msk import __version__ from msk.exceptions import PRModified, MskException, SkillNameTaken ASKPASS = '''#!/usr/bin/env python3 import sys -print( - r"""{password}""" - if sys.argv[1] == "Password for 'https://{username}@github.com': " else - r"""{username}""" +print(r"""{token}""" )''' -skills_kit_footer = '<sub>Created with [mycroft-skills-kit]({}) v{}</sub>'.format( - 'https://github.com/mycroftai/mycroft-skills-kit', __version__ -) +skills_kit_footer = '<sub>Created with [mycroft-skills-kit]({}) v{}</sub>' \ + .format('https://github.com/mycroftai/mycroft-skills-kit', + __version__) + +tokendir = str(Path.home()) + '/.mycroft/msk/' +tokenfile = tokendir + 'GITHUB_TOKEN' -def register_git_injector(username, password): - """Generate a script that writes the password to the git command line tool""" +def register_git_injector(token): + """Generate a script that writes the token to the git command line tool""" fd, tmp_path = mkstemp() atexit.register(lambda: os.remove(tmp_path)) with os.fdopen(fd, 'w') as f: f.write(ASKPASS.format( - username=username.replace('"""', r'\"\"\"'), - password=password.replace('"""', r'\"\"\"') or '' + token=token.replace('"""', r'\"\"\"') )) chmod(tmp_path, 0o700) os.environ['GIT_ASKPASS'] = tmp_path -def ask_for_github_credentials(use_token=False) -> Github: - print('=== GitHub Credentials ===') - while True: - if use_token: - username = getpass('Token: ') - password = None +def ask_for_github_token() -> Github: + """Ask for GitHub Token if there isnt stored token + or stored token is invalid""" + print('') + token = get_stored_github_token() + if token and check_token(token): + github = Github(token) + register_git_injector(token) + return github + else: + retry = False + while True: + if not retry: + print('To authenticate with GitHub a Personal Access Token is needed.') + print(' 1. Go to https://github.com/settings/tokens/new create one') + print(' 2. Give the token a name like mycroft-msk') + print(' 3. Select the scopes') + print(' [X] repo') + print(' 4. Click Generate Token (at bottom of page)') + print(' 5. Copy the generated token') + print(' 6. Paste it in below') + print('') + retry = True + token = input('Personal Access Token: ') + if check_token(token): + github = Github(token) + store_github_token(token) + register_git_injector(token) + return github + else: + print('') + print('Token is incorrect.') + print('The reason for this can be that token is missing repo scope') + print('or the token is invalid.') + print('Please retry.') + print('') + + +def check_token(token): + """Check if at GitHub Token has 'repo' in the scope""" + github = Github(token) + try: + _ = github.get_user().login + _ = github.oauth_scopes + if 'repo' in github.oauth_scopes: + return True else: - username = input('Username: ') - password = getpass('Password: ') - github = Github(username, password) - try: - _ = github.get_user().login - register_git_injector(username, password) - return github - except GithubException: - print('Login incorrect. Retry:') + return False + except Exception: + return False + + +def get_stored_github_token(): + """Returns stored GitHub token or false if there isnt + one or the token is invalid""" + if os.path.isfile(tokenfile): + with open(tokenfile, 'r') as f: + token = f.readline() + if not check_token(token): + os.remove(tokenfile) + else: + return(token) + else: + return False + + +def store_github_token(token): + """Ask if user will store GitHUb token and if yes store""" + print('') + if ask_yes_no('Do you want msk to store the GitHub Personal Access Token? (Y/n)', True): + if not os.path.exists(tokendir): + os.makedirs(tokendir) + with open(tokenfile, 'w') as f: + f.write(token) + os.chmod(tokenfile, 0o600) + print('Your GitHub Personal Access Token is stored in ' + tokenfile) + print('') + else: + print('Remember to store your token in a safe place.') + print('') def skill_repo_name(url: str): - return '{}/{}'.format(SkillEntry.extract_author(url), SkillEntry.extract_repo_name(url)) + return '{}/{}'.format(SkillEntry.extract_author(url), + SkillEntry.extract_repo_name(url)) def ask_input(message: str, validator=lambda x: True, on_fail='Invalid entry'): @@ -101,7 +163,8 @@ print(o) -def ask_choice(message: str, choices: list, allow_empty=False, on_empty=None) -> Optional[str]: +def ask_choice(message: str, choices: list, + allow_empty=False, on_empty=None) -> Optional[str]: if not choices: if allow_empty: print(on_empty) @@ -148,7 +211,8 @@ def ask_yes_no(message: str, default: Optional[bool]) -> bool: - resp = ask_input(message, lambda x: (not x and default is not None) or x in 'yYnN') + resp = ask_input(message, + lambda x: (not x and default is not None) or x in 'yYnN') return {'n': False, 'y': True, '': default}[resp.lower()] @@ -182,7 +246,8 @@ """TimeSkill -> time_skill""" if not camel: return camel - return ''.join('_' + x if 'A' <= x <= 'Z' else x for x in camel).lower()[camel[0].isupper():] + return ''.join('_' + x if 'A' <= x <= 'Z' else x for x in camel) \ + .lower()[camel[0].isupper():] @contextmanager @@ -215,7 +280,64 @@ return wrapper + def get_licenses(): licenses = glob(join(dirname(__file__), 'licenses', '*.txt')) licenses.sort() return licenses + + +GIT_IDENTITY_INFO = '''=== Git Identity === +msk uses Git to save skills to Github and when submitting a skill to the +Mycroft Marketplace. To use Git, Git needs to know your Name and +E-mail address. This is important because every Git commit uses the +information to show the responsible party for the submission. +''' + + +GIT_MANUAL_CHANGE_INFO = ''' +Thank you. :) + +If you need to change this in the future use + + git --config user.name "My Name" + +and + + git --config user.email "m...@myhost.com" + +''' + + +def ensure_git_user(): + """Prompt for fullname and email if git config is missing it.""" + conf_path = get_config_path('global') + with GitConfigParser(conf_path, read_only=False) as conf_parser: + + # Make sure a user section exists + if 'user' not in conf_parser.sections(): + conf_parser.add_section('user') + + # Check for missing options using the ConfigParser and insert them + # if they're missing. + name, email = (None, None) + try: + name = conf_parser.get(section='user', option='name') + except NoOptionError: + pass # Name doesn't exist deal with it later + try: + email = conf_parser.get(section='user', option='email') + except NoOptionError: + pass # E-mail doesn't exist, deal with it later + + if not all((name, email)): + # Some of the needed config is missing + print(GIT_IDENTITY_INFO) + if not name: + name = input('Please enter Full name: ') + conf_parser.set('user', 'name', name) + if not email: + email = input('Please enter e-mail address: ') + conf_parser.set('user', 'email', email) + + print(GIT_MANUAL_CHANGE_INFO) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk.egg-info/PKG-INFO new/msk-0.3.16/msk.egg-info/PKG-INFO --- old/msk-0.3.14/msk.egg-info/PKG-INFO 2019-12-03 09:27:22.000000000 +0100 +++ new/msk-0.3.16/msk.egg-info/PKG-INFO 2020-09-09 08:37:06.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: msk -Version: 0.3.14 +Version: 0.3.16 Summary: Mycroft Skills Kit Home-page: https://github.com/MycroftAI/mycroft-skills-kit Author: Mycroft AI @@ -8,5 +8,68 @@ Maintainer: Matthew Scholefield Maintainer-email: matthew331...@gmail.com License: Apache-2.0 -Description: UNKNOWN +Description: # Mycroft Skills Kit + + *Mycroft Skills Kit* + + [](https://asciinema.org/a/X5pWLPOpsMLUPYp5kgswNm5Zu?speed=1.5) + + A tool to help with creating, uploading, and upgrading Mycroft skills on the + [skills repo](https://github.com/mycroftai/mycroft-skills). + + ## Features + + - Create a new skill + - Create an intent test for a skill + - Upload a skill + - Upgrade an existing skill + + ## Install + + *Note: Only Linux has been tested* + + ```bash + pip3 install msk + ``` + + ## Usage + + ```bash + msk create + msk create-test /opt/mycroft/skills/myskill + msk submit /opt/mycroft/skills/myskill + ``` + ### Creating a New Skill + + `msk create`: + + [](https://asciinema.org/a/X5pWLPOpsMLUPYp5kgswNm5Zu?speed=1.5) + + ### Creating Tests + + `msk create-test /opt/mycroft/skills/myskill`: + + [](https://asciinema.org/a/Ayzaj6QJbKGBfs2eIQWr11idH?speed=1.5) + + ## Submitting a new skill / Updating existing skill + + `msk submit /opt/mycroft/skills/myskill`: + + [](https://asciinema.org/a/242108) + + --or-- + + ```bash + cd /opt/mycroft/skills/myskill + msk submit . + ``` + Platform: UNKNOWN +Classifier: Development Status :: 4 - Beta +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Description-Content-Type: text/markdown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk.egg-info/SOURCES.txt new/msk-0.3.16/msk.egg-info/SOURCES.txt --- old/msk-0.3.14/msk.egg-info/SOURCES.txt 2019-12-03 09:27:22.000000000 +0100 +++ new/msk-0.3.16/msk.egg-info/SOURCES.txt 2020-09-09 08:37:06.000000000 +0200 @@ -1,3 +1,5 @@ +LICENSE +MANIFEST.in README.md setup.py msk/__init__.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/msk.egg-info/requires.txt new/msk-0.3.16/msk.egg-info/requires.txt --- old/msk-0.3.14/msk.egg-info/requires.txt 2019-12-03 09:27:22.000000000 +0100 +++ new/msk-0.3.16/msk.egg-info/requires.txt 2020-09-09 08:37:06.000000000 +0200 @@ -1,6 +1,5 @@ -GitPython -typing +GitPython>=3.0.5 +colorama msm>=0.5.13 pygithub requests -colorama diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msk-0.3.14/setup.py new/msk-0.3.16/setup.py --- old/msk-0.3.14/setup.py 2019-12-03 09:25:02.000000000 +0100 +++ new/msk-0.3.16/setup.py 2020-09-09 07:35:31.000000000 +0200 @@ -21,12 +21,16 @@ # under the License. from setuptools import setup +with open("README.md", "r") as fh: + long_description = fh.read() + setup( name='msk', - version='0.3.14', # Also update in msk/__init__.py + version='0.3.16', # Also update in msk/__init__.py packages=['msk', 'msk.actions'], package_data={'msk': ['licenses/*']}, - install_requires=['GitPython', 'typing', 'msm>=0.5.13', 'pygithub', 'requests', 'colorama'], + install_requires=['GitPython>=3.0.5', 'msm>=0.5.13', 'pygithub', + 'requests', 'colorama'], url='https://github.com/MycroftAI/mycroft-skills-kit', license='Apache-2.0', author='Mycroft AI', @@ -34,9 +38,21 @@ maintainer='Matthew Scholefield', maintainer_email='matthew331...@gmail.com', description='Mycroft Skills Kit', + long_description=long_description, + long_description_content_type="text/markdown", entry_points={ 'console_scripts': { 'msk=msk.__main__:main' } - } + }, + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: Apache Software License', + + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + ] )