Hello community, here is the log from the commit of package python-knack for openSUSE:Factory checked in at 2019-07-24 20:36:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-knack (Old) and /work/SRC/openSUSE:Factory/.python-knack.new.4126 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-knack" Wed Jul 24 20:36:02 2019 rev:9 rq:718123 version:0.6.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-knack/python-knack.changes 2019-05-27 08:38:24.555070416 +0200 +++ /work/SRC/openSUSE:Factory/.python-knack.new.4126/python-knack.changes 2019-07-24 20:36:03.866570602 +0200 @@ -1,0 +2,7 @@ +Wed Jul 24 08:22:50 UTC 2019 - Tomáš Chvátal <[email protected]> + +- Update to 0.6.3: + * Fixes issue where argument marked is_preview=True would not always be handled correctly. + * Fixes issue where ensuring a directory exists could cause a race condition. + +------------------------------------------------------------------- Old: ---- v0.6.2.tar.gz New: ---- v0.6.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-knack.spec ++++++ --- /var/tmp/diff_new_pack.KZrppl/_old 2019-07-24 20:36:05.206570455 +0200 +++ /var/tmp/diff_new_pack.KZrppl/_new 2019-07-24 20:36:05.230570452 +0200 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-knack -Version: 0.6.2 +Version: 0.6.3 Release: 0 Summary: A Command-Line Interface framework License: MIT ++++++ v0.6.2.tar.gz -> v0.6.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knack-0.6.2/HISTORY.rst new/knack-0.6.3/HISTORY.rst --- old/knack-0.6.2/HISTORY.rst 2019-05-23 00:19:57.000000000 +0200 +++ new/knack-0.6.3/HISTORY.rst 2019-07-09 17:01:56.000000000 +0200 @@ -3,6 +3,11 @@ Release History =============== +0.6.3 ++++++ +* Fix bug where arguments in preview did not call registered actions. This meant that parameter parsing did not behave + completely as expected. + 0.6.2 +++++ * Adds ability to declare that command groups, commands, and arguments are in a preview status and therefore might change or be removed. This is done by passing the kwarg `is_preview=True`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knack-0.6.2/knack/arguments.py new/knack-0.6.3/knack/arguments.py --- old/knack-0.6.2/knack/arguments.py 2019-05-23 00:19:57.000000000 +0200 +++ new/knack-0.6.3/knack/arguments.py 2019-07-09 17:01:56.000000000 +0200 @@ -162,7 +162,9 @@ # wrap any existing action action = kwargs.get('action', None) parent_class = argparse.Action - if isinstance(action, argparse.Action): + + # action is either a user-defined Action class or a string referring a library-defined Action + if isinstance(action, type) and issubclass(action, argparse.Action): parent_class = action elif isinstance(action, str): parent_class = self.command_loader.cli_ctx.invocation.parser._registries['action'][action] # pylint: disable=protected-access diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knack-0.6.2/knack/util.py new/knack-0.6.3/knack/util.py --- old/knack-0.6.2/knack/util.py 2019-05-23 00:19:57.000000000 +0200 +++ new/knack-0.6.3/knack/util.py 2019-07-09 17:01:56.000000000 +0200 @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +import errno import os import re from datetime import date, time, datetime, timedelta @@ -100,7 +101,11 @@ def ensure_dir(d): """ Create a directory if it doesn't exist """ if not os.path.isdir(d): - os.makedirs(d) + try: + os.makedirs(d) + except OSError as e: + if e.errno != errno.EEXIST: + raise e def normalize_newlines(str_to_normalize): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knack-0.6.2/setup.py new/knack-0.6.3/setup.py --- old/knack-0.6.2/setup.py 2019-05-23 00:19:57.000000000 +0200 +++ new/knack-0.6.3/setup.py 2019-07-09 17:01:56.000000000 +0200 @@ -9,7 +9,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = '0.6.2' +VERSION = '0.6.3' DEPENDENCIES = [ 'argcomplete', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knack-0.6.2/tests/test_preview.py new/knack-0.6.3/tests/test_preview.py --- old/knack-0.6.2/tests/test_preview.py 2019-05-23 00:19:57.000000000 +0200 +++ new/knack-0.6.3/tests/test_preview.py 2019-07-09 17:01:56.000000000 +0200 @@ -3,17 +3,19 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -from __future__ import unicode_literals +from __future__ import unicode_literals, print_function import unittest try: import mock except ImportError: from unittest import mock -from threading import Lock + +import sys +import argparse from knack.arguments import ArgumentsContext -from knack.commands import CLICommand, CLICommandsLoader, CommandGroup +from knack.commands import CLICommandsLoader, CommandGroup from tests.util import DummyCLI, redirect_io @@ -148,9 +150,13 @@ class TestArgumentPreview(unittest.TestCase): def setUp(self): - from knack.help_files import helps + class LoggerAction(argparse.Action): + + def __call__(self, parser, namespace, values, option_string=None): + print("Side-effect from some original action!", file=sys.stderr) + class PreviewTestCommandLoader(CLICommandsLoader): def load_command_table(self, args): super(PreviewTestCommandLoader, self).load_command_table(args) @@ -160,7 +166,7 @@ def load_arguments(self, command): with ArgumentsContext(self, 'arg-test') as c: - c.argument('arg1', help='Arg1', is_preview=True) + c.argument('arg1', help='Arg1', is_preview=True, action=LoggerAction) super(PreviewTestCommandLoader, self).load_arguments(command) @@ -188,8 +194,11 @@ """ Ensure deprecated arguments can be used. """ self.cli_ctx.invoke('arg-test --arg1 foo --opt1 bar'.split()) actual = self.io.getvalue() - expected = "Argument '--arg1' is in preview. It may be changed/removed in a future release." - self.assertIn(expected, actual) + preview_expected = "Argument '--arg1' is in preview. It may be changed/removed in a future release." + self.assertIn(preview_expected, actual) + + action_expected = "Side-effect from some original action!" + self.assertIn(action_expected, actual) if __name__ == '__main__':
