Hello community, here is the log from the commit of package python-cliff for openSUSE:Factory checked in at 2020-05-28 09:04:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-cliff (Old) and /work/SRC/openSUSE:Factory/.python-cliff.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-cliff" Thu May 28 09:04:58 2020 rev:37 rq:803555 version:3.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-cliff/python-cliff.changes 2020-04-19 21:36:17.210493761 +0200 +++ /work/SRC/openSUSE:Factory/.python-cliff.new.3606/python-cliff.changes 2020-05-28 09:04:59.763287163 +0200 @@ -1,0 +2,16 @@ +Tue May 12 09:52:03 UTC 2020 - [email protected] + +- update to version 3.1.0 + - Switch to Ussuri jobs + - Add contributors link to readme + - Fix nested argument groups with ignore conflict handler + - [ussuri][goal] Drop python 2.7 support and testing + - Allow finding command by partial name + - Add autoprogram_cliff_app_dist_name config opt + - adding missing releasenote for the drop of py27 support + - Add an errexit attribute to InteractiveApp to exit on command errors + - Re-add support for python 3.5 + - Modify the help message of `-c`/`--column` parameter + - Stop wildcard importing argparse + +------------------------------------------------------------------- Old: ---- cliff-2.16.0.tar.gz New: ---- cliff-3.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-cliff.spec ++++++ --- /var/tmp/diff_new_pack.RsVfdg/_old 2020-05-28 09:05:00.395288591 +0200 +++ /var/tmp/diff_new_pack.RsVfdg/_new 2020-05-28 09:05:00.399288600 +0200 @@ -17,13 +17,13 @@ Name: python-cliff -Version: 2.16.0 +Version: 3.1.0 Release: 0 Summary: Command Line Interface Formulation Framework License: Apache-2.0 Group: Development/Languages/Python URL: https://launchpad.net/python-cliff -Source0: https://files.pythonhosted.org/packages/source/c/cliff/cliff-2.16.0.tar.gz +Source0: https://files.pythonhosted.org/packages/source/c/cliff/cliff-3.1.0.tar.gz BuildRequires: openstack-macros BuildRequires: python3-PrettyTable BuildRequires: python3-PyYAML @@ -83,12 +83,12 @@ This package contains documentation files for %{name}. %prep -%autosetup -p1 -n cliff-2.16.0 +%autosetup -p1 -n cliff-3.1.0 %py_req_cleanup %build %py3_build -PBR_VERSION=2.16.0 PYTHONPATH=. %sphinx_build -b html doc/source doc/build/html +PBR_VERSION=3.1.0 PYTHONPATH=. %sphinx_build -b html doc/source doc/build/html rm -rf doc/build/html/.{doctrees,buildinfo} %install ++++++ _service ++++++ --- /var/tmp/diff_new_pack.RsVfdg/_old 2020-05-28 09:05:00.427288663 +0200 +++ /var/tmp/diff_new_pack.RsVfdg/_new 2020-05-28 09:05:00.427288663 +0200 @@ -1,6 +1,6 @@ <services> <service mode="disabled" name="renderspec"> - <param name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/train/openstack/cliff/cliff.spec.j2</param> + <param name="input-template">https://opendev.org/openstack/rpm-packaging/raw/branch/stable/ussuri/openstack/cliff/cliff.spec.j2</param> <param name="output-name">python-cliff.spec</param> <param name="changelog-email">[email protected]</param> <param name="changelog-provider">gh,openstack,cliff</param> ++++++ cliff-2.16.0.tar.gz -> cliff-3.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/.zuul.yaml new/cliff-3.1.0/.zuul.yaml --- old/cliff-2.16.0/.zuul.yaml 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/.zuul.yaml 2020-03-27 11:45:44.000000000 +0100 @@ -1,6 +1,6 @@ - job: - name: cliff-tox-py27-neutronclient-tip - parent: openstack-tox-py27 + name: cliff-tox-py37-neutronclient-tip + parent: openstack-tox-py37 description: | Run unit tests for neutronclient with master branch of cliff @@ -22,19 +22,18 @@ - project: templates: - check-requirements - - lib-forward-testing - lib-forward-testing-python3 - openstack-lower-constraints-jobs - - openstack-python-jobs - - openstack-python3-train-jobs + - openstack-python35-jobs + - openstack-python3-ussuri-jobs - publish-openstack-docs-pti check: jobs: - - cliff-tox-py27-neutronclient-tip - - osc-tox-unit-tips: + - cliff-tox-py37-neutronclient-tip + - osc-tox-py36-tips: branches: ^master$ gate: jobs: - - cliff-tox-py27-neutronclient-tip - - osc-tox-unit-tips: + - cliff-tox-py37-neutronclient-tip + - osc-tox-py36-tips: branches: ^master$ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/AUTHORS new/cliff-3.1.0/AUTHORS --- old/cliff-2.16.0/AUTHORS 2019-09-06 23:29:02.000000000 +0200 +++ new/cliff-3.1.0/AUTHORS 2020-03-27 11:46:48.000000000 +0100 @@ -4,6 +4,7 @@ Andreas Jaeger <[email protected]> Andreas Jaeger <[email protected]> Andrew Spiers <[email protected]> +Andrey Volkov <[email protected]> Atsushi SAKAI <[email protected]> Brano Zarnovican <[email protected]> Cao Xuan Hoang <[email protected]> @@ -22,10 +23,12 @@ Doug Hellmann <[email protected]> Doug Hellmann <[email protected]> Duncan McGreggor <[email protected]> +Eric Fried <[email protected]> Eyal Posener <[email protected]> Feodor Tersin <[email protected]> Flavio Percoco <[email protected]> Ghanshyam Mann <[email protected]> +Hervé Beraud <[email protected]> Hongbin Lu <[email protected]> Ilya Shakhat <[email protected]> James Downs <[email protected]> @@ -42,6 +45,7 @@ Ken'ichi Ohmichi <[email protected]> Kien Nguyen <[email protected]> Maciej Kwiek <[email protected]> +Mark Goddard <[email protected]> Mark McClain <[email protected]> Masayuki Igawa <[email protected]> Masayuki Igawa <[email protected]> @@ -87,6 +91,7 @@ heavenshell <[email protected]> howardlee <[email protected]> kafka <[email protected]> +kangyufei <[email protected]> lingyongxu <[email protected]> liyingjun <[email protected]> markmcclain <[email protected]> @@ -94,3 +99,5 @@ qingszhao <[email protected]> qneill <[email protected]> shizhihui <[email protected]> +xuanyandong <[email protected]> +yanpuqing <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/ChangeLog new/cliff-3.1.0/ChangeLog --- old/cliff-2.16.0/ChangeLog 2019-09-06 23:29:02.000000000 +0200 +++ new/cliff-3.1.0/ChangeLog 2020-03-27 11:46:48.000000000 +0100 @@ -1,15 +1,37 @@ CHANGES ======= +3.1.0 +----- + +* Re-add support for python 3.5 +* Fix nested argument groups with ignore conflict handler +* adding missing releasenote for the drop of py27 support + +3.0.0 +----- + +* [ussuri][goal] Drop python 2.7 support and testing + +2.18.0 +------ + +* Add autoprogram\_cliff\_app\_dist\_name config opt +* Switch to Ussuri jobs +* Add contributors link to readme + 2.16.0 ------ * Pin cmd2 back to <0.9 on all versions +* Modify the help message of \`-c\`/\`--column\` parameter * Add Python 3 Train unit tests +* Stop wildcard importing argparse 2.15.0 ------ +* Add an errexit attribute to InteractiveApp to exit on command errors * Dropping the py35 testing * Updates for OpenDev transition * OpenDev Migration Patch @@ -53,6 +75,11 @@ * exclude cmd2 0.8.3 and update to 0.8.4 * add lower-constraints job * fix typos in documentation + +2.17.0 +------ + +* Allow finding command by partial name * Updated from global requirements * Remove the warning of getargspec removal * Align parsed() call with cmd2 versions >= 0.7.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/PKG-INFO new/cliff-3.1.0/PKG-INFO --- old/cliff-2.16.0/PKG-INFO 2019-09-06 23:29:02.000000000 +0200 +++ new/cliff-3.1.0/PKG-INFO 2020-03-27 11:46:48.000000000 +0100 @@ -1,6 +1,6 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: cliff -Version: 2.16.0 +Version: 3.1.0 Summary: Command Line Interface Formulation Framework Home-page: https://docs.openstack.org/cliff/latest/ Author: OpenStack @@ -29,16 +29,19 @@ * Documentation: https://docs.openstack.org/cliff/latest/ * Source: https://opendev.org/openstack/cliff * Bugs: https://bugs.launchpad.net/python-cliff + * Contributors: https://github.com/openstack/cliff/graphs/contributors Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: License :: OSI Approved :: Apache Software License Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Intended Audience :: Developers Classifier: Environment :: Console +Requires-Python: >=3.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/README.rst new/cliff-3.1.0/README.rst --- old/cliff-2.16.0/README.rst 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/README.rst 2020-03-27 11:45:44.000000000 +0100 @@ -21,3 +21,4 @@ * Documentation: https://docs.openstack.org/cliff/latest/ * Source: https://opendev.org/openstack/cliff * Bugs: https://bugs.launchpad.net/python-cliff +* Contributors: https://github.com/openstack/cliff/graphs/contributors diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff/_argparse.py new/cliff-3.1.0/cliff/_argparse.py --- old/cliff-2.16.0/cliff/_argparse.py 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/cliff/_argparse.py 2020-03-27 11:45:44.000000000 +0100 @@ -10,27 +10,16 @@ # License for the specific language governing permissions and limitations # under the License. -"""Special argparse module that allows to bypass abbrev mode.""" +"""Overrides of standard argparse behavior.""" from __future__ import absolute_import -from argparse import * # noqa + import argparse import sys import warnings -class ArgumentParser(argparse.ArgumentParser): - - if sys.version_info < (3, 5): - def __init__(self, *args, **kwargs): - self.allow_abbrev = kwargs.pop("allow_abbrev", True) - super(ArgumentParser, self).__init__(*args, **kwargs) - - def _get_option_tuples(self, option_string): - if self.allow_abbrev: - return super(ArgumentParser, self)._get_option_tuples( - option_string) - return () +class _ArgumentContainerMixIn(object): # NOTE(dhellmann): We have to override the methods for creating # groups to return our objects that know how to deal with the @@ -55,6 +44,20 @@ ) +class ArgumentParser(_ArgumentContainerMixIn, argparse.ArgumentParser): + + if sys.version_info < (3, 5): + def __init__(self, *args, **kwargs): + self.allow_abbrev = kwargs.pop("allow_abbrev", True) + super(ArgumentParser, self).__init__(*args, **kwargs) + + def _get_option_tuples(self, option_string): + if self.allow_abbrev: + return super(ArgumentParser, self)._get_option_tuples( + option_string) + return () + + def _handle_conflict_ignore(container, option_string_actions, new_action, conflicting_actions): @@ -84,23 +87,31 @@ ) -class _ArgumentGroup(argparse._ArgumentGroup): +class _ArgumentGroup(_ArgumentContainerMixIn, argparse._ArgumentGroup): + pass - def _handle_conflict_ignore(self, action, conflicting_actions): - _handle_conflict_ignore( - self, - self._option_string_actions, - action, - conflicting_actions, - ) - -class _MutuallyExclusiveGroup(argparse._MutuallyExclusiveGroup): - - def _handle_conflict_ignore(self, action, conflicting_actions): - _handle_conflict_ignore( - self, - self._option_string_actions, - action, - conflicting_actions, - ) +class _MutuallyExclusiveGroup(_ArgumentContainerMixIn, + argparse._MutuallyExclusiveGroup): + pass + + +class SmartHelpFormatter(argparse.HelpFormatter): + """Smart help formatter to output raw help message if help contain \n. + + Some command help messages maybe have multiple line content, the built-in + argparse.HelpFormatter wrap and split the content according to width, and + ignore \n in the raw help message, it merge multiple line content in one + line to output, that looks messy. SmartHelpFormatter keep the raw help + message format if it contain \n, and wrap long line like HelpFormatter + behavior. + """ + + def _split_lines(self, text, width): + lines = text.splitlines() if '\n' in text else [text] + wrap_lines = [] + for each_line in lines: + wrap_lines.extend( + super(SmartHelpFormatter, self)._split_lines(each_line, width) + ) + return wrap_lines diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff/app.py new/cliff-3.1.0/cliff/app.py --- old/cliff-2.16.0/cliff/app.py 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/cliff/app.py 2020-03-27 11:45:44.000000000 +0100 @@ -324,8 +324,7 @@ self.stdin, self.stdout, ) - self.interpreter.cmdloop() - return 0 + return self.interpreter.cmdloop() def get_fuzzy_matches(self, cmd): """return fuzzy matches of unknown command @@ -412,7 +411,8 @@ else: self.LOG.error('Could not clean up: %s', err2) if self.options.debug: - raise + # 'raise' here gets caught and does not exit like we want + return result else: try: self.clean_up(cmd, result, None) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff/command.py new/cliff-3.1.0/cliff/command.py --- old/cliff-2.16.0/cliff/command.py 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/cliff/command.py 2020-03-27 11:45:44.000000000 +0100 @@ -137,8 +137,10 @@ (h.obj.get_epilog() for h in self._hooks), ) parts.extend(hook_epilogs) - app_dist_name = _get_distribution_for_module( - inspect.getmodule(self.app) + app_dist_name = getattr( + self, 'app_dist_name', _get_distribution_for_module( + inspect.getmodule(self.app) + ) ) dist_name = _get_distribution_for_module(inspect.getmodule(self)) if dist_name and dist_name != app_dist_name: @@ -155,7 +157,7 @@ description=self.get_description(), epilog=self.get_epilog(), prog=prog_name, - formatter_class=_SmartHelpFormatter, + formatter_class=_argparse.SmartHelpFormatter, conflict_handler='ignore', ) for hook in self._hooks: @@ -221,24 +223,3 @@ if ret is not None: return_code = ret return return_code - - -class _SmartHelpFormatter(_argparse.HelpFormatter): - """Smart help formatter to output raw help message if help contain \n. - - Some command help messages maybe have multiple line content, the built-in - argparse.HelpFormatter wrap and split the content according to width, and - ignore \n in the raw help message, it merge multiple line content in one - line to output, that looks messy. SmartHelpFormatter keep the raw help - message format if it contain \n, and wrap long line like HelpFormatter - behavior. - """ - - def _split_lines(self, text, width): - lines = text.splitlines() if '\n' in text else [text] - wrap_lines = [] - for each_line in lines: - wrap_lines.extend( - super(_SmartHelpFormatter, self)._split_lines(each_line, width) - ) - return wrap_lines diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff/commandmanager.py new/cliff-3.1.0/cliff/commandmanager.py --- old/cliff-2.16.0/cliff/commandmanager.py 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/cliff/commandmanager.py 2020-03-27 11:45:44.000000000 +0100 @@ -23,6 +23,18 @@ LOG = logging.getLogger(__name__) +def _get_commands_by_partial_name(args, commands): + n = len(args) + candidates = [] + for command_name in commands: + command_parts = command_name.split() + if len(command_parts) != n: + continue + if all(command_parts[i].startswith(args[i]) for i in range(n)): + candidates.append(command_name) + return candidates + + class EntryPointWrapper(object): """Wrap up a command class already imported to make it look like a plugin. """ @@ -97,8 +109,17 @@ # Convert the legacy command name to its new name. if name in self._legacy: name = self._legacy[name] + + found = None if name in self.commands: - cmd_ep = self.commands[name] + found = name + else: + candidates = _get_commands_by_partial_name( + argv[:i], self.commands) + if len(candidates) == 1: + found = candidates[0] + if found: + cmd_ep = self.commands[found] if hasattr(cmd_ep, 'resolve'): cmd_factory = cmd_ep.resolve() else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff/display.py new/cliff-3.1.0/cliff/display.py --- old/cliff-2.16.0/cliff/display.py 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/cliff/display.py 2020-03-27 11:45:44.000000000 +0100 @@ -71,7 +71,8 @@ default=[], dest='columns', metavar='COLUMN', - help='specify the column(s) to include, can be repeated', + help='specify the column(s) to include, can be ' + 'repeated to show multiple columns', ) for formatter in self._formatter_plugins: formatter.obj.add_argument_group(parser) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff/interactive.py new/cliff-3.1.0/cliff/interactive.py --- old/cliff-2.16.0/cliff/interactive.py 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/cliff/interactive.py 2020-03-27 11:45:44.000000000 +0100 @@ -41,7 +41,8 @@ doc_header = "Shell commands (type help <topic>):" app_cmd_header = "Application commands (type help <topic>):" - def __init__(self, parent_app, command_manager, stdin, stdout): + def __init__(self, parent_app, command_manager, stdin, stdout, + errexit=False): self.parent_app = parent_app if not hasattr(sys.stdin, 'isatty') or sys.stdin.isatty(): self.prompt = '(%s) ' % parent_app.NAME @@ -49,6 +50,7 @@ # batch/pipe mode self.prompt = '' self.command_manager = command_manager + self.errexit = errexit cmd2.Cmd.__init__(self, 'tab', stdin=stdin, stdout=stdout) def _split_line(self, line): @@ -69,7 +71,11 @@ # since it already has the logic for executing # the subcommand. line_parts = self._split_line(line) - self.parent_app.run_subcommand(line_parts) + ret = self.parent_app.run_subcommand(line_parts) + if self.errexit: + # Only provide this if errexit is enabled, + # otherise keep old behaviour + return ret def completenames(self, text, line, begidx, endidx): """Tab-completion for command prefix without completer delimiter. @@ -175,4 +181,7 @@ return statement def cmdloop(self): - self._cmdloop() + # We don't want the cmd2 cmdloop() behaviour, just call the old one + # directly. In part this is because cmd2.cmdloop() doe not return + # anything useful and we want to have a useful exit code. + return self._cmdloop() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff/sphinxext.py new/cliff-3.1.0/cliff/sphinxext.py --- old/cliff-2.16.0/cliff/sphinxext.py 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/cliff/sphinxext.py 2020-03-27 11:45:44.000000000 +0100 @@ -322,6 +322,9 @@ :returns: A list of nested docutil nodes """ command = command_class(None, None) + if not getattr(command, 'app_dist_name', None): + command.app_dist_name = ( + self.env.config.autoprogram_cliff_app_dist_name) parser = command.get_parser(command_name) ignored_opts = ignored_opts or [] @@ -375,3 +378,4 @@ app.add_directive('autoprogram-cliff', AutoprogramCliffDirective) app.add_config_value('autoprogram_cliff_application', '', True) app.add_config_value('autoprogram_cliff_ignored', ['--help'], True) + app.add_config_value('autoprogram_cliff_app_dist_name', None, True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff/tests/test__argparse.py new/cliff-3.1.0/cliff/tests/test__argparse.py --- old/cliff-2.16.0/cliff/tests/test__argparse.py 1970-01-01 01:00:00.000000000 +0100 +++ new/cliff-3.1.0/cliff/tests/test__argparse.py 2020-03-27 11:45:44.000000000 +0100 @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# 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. + +import unittest + +from cliff import _argparse + + +class TestArgparse(unittest.TestCase): + + def test_argument_parser(self): + _argparse.ArgumentParser(conflict_handler='ignore') + + def test_argument_parser_add_group(self): + parser = _argparse.ArgumentParser(conflict_handler='ignore') + parser.add_argument_group() + + def test_argument_parser_add_mutually_exclusive_group(self): + parser = _argparse.ArgumentParser(conflict_handler='ignore') + parser.add_mutually_exclusive_group() + + def test_argument_parser_add_nested_group(self): + parser = _argparse.ArgumentParser(conflict_handler='ignore') + group = parser.add_argument_group() + group.add_argument_group() + + def test_argument_parser_add_nested_mutually_exclusive_group(self): + parser = _argparse.ArgumentParser(conflict_handler='ignore') + group = parser.add_argument_group() + group.add_mutually_exclusive_group() + + def test_argument_parser_add_mx_nested_group(self): + parser = _argparse.ArgumentParser(conflict_handler='ignore') + group = parser.add_mutually_exclusive_group() + group.add_argument_group() + + def test_argument_parser_add_mx_nested_mutually_exclusive_group(self): + parser = _argparse.ArgumentParser(conflict_handler='ignore') + group = parser.add_mutually_exclusive_group() + group.add_mutually_exclusive_group() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff/tests/test_app.py new/cliff-3.1.0/cliff/tests/test_app.py --- old/cliff-2.16.0/cliff/tests/test_app.py 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/cliff/tests/test_app.py 2020-03-27 11:45:44.000000000 +0100 @@ -74,10 +74,27 @@ name='interactive_app_factory' ) self.assertIsNone(app.interpreter) - app.run([]) + ret = app.run([]) self.assertIsNotNone(app.interpreter) cmdloop = app.interactive_app_factory.return_value.cmdloop cmdloop.assert_called_once_with() + self.assertNotEqual(ret, 0) + + def test_interactive_mode_cmdloop_error(self): + app, command = make_app() + cmdloop_mock = mock.MagicMock( + name='cmdloop', + ) + cmdloop_mock.return_value = 1 + app.interactive_app_factory = mock.MagicMock( + name='interactive_app_factory' + ) + self.assertIsNone(app.interpreter) + ret = app.run([]) + self.assertIsNotNone(app.interpreter) + cmdloop = app.interactive_app_factory.return_value.cmdloop + cmdloop.assert_called_once_with() + self.assertNotEqual(ret, 0) class TestInitAndCleanup(base.TestBase): @@ -99,14 +116,16 @@ def test_clean_up_success(self): app, command = make_app() app.clean_up = mock.MagicMock(name='clean_up') - app.run(['mock']) + ret = app.run(['mock']) app.clean_up.assert_called_once_with(command.return_value, 0, None) + self.assertEqual(ret, 0) def test_clean_up_error(self): app, command = make_app() app.clean_up = mock.MagicMock(name='clean_up') - app.run(['error']) + ret = app.run(['error']) + self.assertNotEqual(ret, 0) app.clean_up.assert_called_once_with(mock.ANY, mock.ANY, mock.ANY) call_args = app.clean_up.call_args_list[0] @@ -119,12 +138,8 @@ app, command = make_app() app.clean_up = mock.MagicMock(name='clean_up') - try: - app.run(['--debug', 'error']) - except RuntimeError as err: - self.assertIs(err, app.clean_up.call_args_list[0][0][2]) - else: - self.fail('Should have had an exception') + ret = app.run(['--debug', 'error']) + self.assertNotEqual(ret, 0) self.assertTrue(app.clean_up.called) call_args = app.clean_up.call_args_list[0] @@ -157,7 +172,7 @@ side_effect=RuntimeError('within clean_up'), ) try: - app.run(['--debug', 'error']) + ret = app.run(['--debug', 'error']) except RuntimeError as err: if not hasattr(err, '__context__'): # The exception passed to clean_up is not the exception @@ -166,7 +181,7 @@ # with the new one as a __context__ attribute. self.assertIsNot(err, app.clean_up.call_args_list[0][0][2]) else: - self.fail('Should have had an exception') + self.assertNotEqual(ret, 0) self.assertTrue(app.clean_up.called) call_args = app.clean_up.call_args_list[0] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff/tests/test_commandmanager.py new/cliff-3.1.0/cliff/tests/test_commandmanager.py --- old/cliff-2.16.0/cliff/tests/test_commandmanager.py 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/cliff/tests/test_commandmanager.py 2020-03-27 11:45:44.000000000 +0100 @@ -199,3 +199,57 @@ mgr.find_command, ['cmd2'], ) + + +class TestLookupAndFindPartialName(base.TestBase): + + scenarios = [ + ('one-word', {'argv': ['o']}), + ('two-words', {'argv': ['t', 'w']}), + ('three-words', {'argv': ['t', 'w', 'c']}), + ] + + def test(self): + mgr = utils.TestCommandManager(utils.TEST_NAMESPACE) + cmd, name, remaining = mgr.find_command(self.argv) + self.assertTrue(cmd) + self.assertEqual(' '.join(self.argv), name) + self.assertFalse(remaining) + + +class TestGetByPartialName(base.TestBase): + + def setUp(self): + super(TestGetByPartialName, self).setUp() + self.commands = { + 'resource provider list': 1, + 'resource class list': 2, + 'server list': 3, + 'service list': 4} + + def test_no_candidates(self): + self.assertEqual( + [], commandmanager._get_commands_by_partial_name( + ['r', 'p'], self.commands)) + self.assertEqual( + [], commandmanager._get_commands_by_partial_name( + ['r', 'p', 'c'], self.commands)) + + def test_multiple_candidates(self): + self.assertEqual( + 2, len(commandmanager._get_commands_by_partial_name( + ['se', 'li'], self.commands))) + + def test_one_candidate(self): + self.assertEqual( + ['resource provider list'], + commandmanager._get_commands_by_partial_name( + ['r', 'p', 'l'], self.commands)) + self.assertEqual( + ['resource provider list'], + commandmanager._get_commands_by_partial_name( + ['resource', 'provider', 'list'], self.commands)) + self.assertEqual( + ['server list'], + commandmanager._get_commands_by_partial_name( + ['serve', 'l'], self.commands)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff/tests/test_interactive.py new/cliff-3.1.0/cliff/tests/test_interactive.py --- old/cliff-2.16.0/cliff/tests/test_interactive.py 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/cliff/tests/test_interactive.py 2020-03-27 11:45:44.000000000 +0100 @@ -24,13 +24,13 @@ class TestInteractive(base.TestBase): - def make_interactive_app(self, *command_names): + def make_interactive_app(self, errexit, *command_names): fake_command_manager = [(x, None) for x in command_names] return InteractiveApp(FakeApp, fake_command_manager, - stdin=None, stdout=None) + stdin=None, stdout=None, errexit=errexit) def _test_completenames(self, expecteds, prefix): - app = self.make_interactive_app('hips', 'hippo', 'nonmatching') + app = self.make_interactive_app(False, 'hips', 'hippo', 'nonmatching') self.assertEqual( set(app.completenames(prefix, '', 0, 1)), set(expecteds)) @@ -58,7 +58,7 @@ def _test_completedefault(self, expecteds, line, begidx): command_names = set(['show file', 'show folder', 'show long', 'list all']) - app = self.make_interactive_app(*command_names) + app = self.make_interactive_app(False, *command_names) observeds = app.completedefault(None, line, begidx, None) self.assertEqual(set(expecteds), set(observeds)) self.assertTrue( @@ -78,3 +78,13 @@ def test_no_completedefault(self): self._test_completedefault([], 'taz ', 4) + + def test_no_errexit(self): + command_names = set(['show file', 'show folder', 'list all']) + app = self.make_interactive_app(False, *command_names) + self.assertFalse(app.errexit) + + def test_errexit(self): + command_names = set(['show file', 'show folder', 'list all']) + app = self.make_interactive_app(True, *command_names) + self.assertTrue(app.errexit) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff.egg-info/PKG-INFO new/cliff-3.1.0/cliff.egg-info/PKG-INFO --- old/cliff-2.16.0/cliff.egg-info/PKG-INFO 2019-09-06 23:29:02.000000000 +0200 +++ new/cliff-3.1.0/cliff.egg-info/PKG-INFO 2020-03-27 11:46:48.000000000 +0100 @@ -1,6 +1,6 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: cliff -Version: 2.16.0 +Version: 3.1.0 Summary: Command Line Interface Formulation Framework Home-page: https://docs.openstack.org/cliff/latest/ Author: OpenStack @@ -29,16 +29,19 @@ * Documentation: https://docs.openstack.org/cliff/latest/ * Source: https://opendev.org/openstack/cliff * Bugs: https://bugs.launchpad.net/python-cliff + * Contributors: https://github.com/openstack/cliff/graphs/contributors Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: License :: OSI Approved :: Apache Software License Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Intended Audience :: Developers Classifier: Environment :: Console +Requires-Python: >=3.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff.egg-info/SOURCES.txt new/cliff-3.1.0/cliff.egg-info/SOURCES.txt --- old/cliff-2.16.0/cliff.egg-info/SOURCES.txt 2019-09-06 23:29:02.000000000 +0200 +++ new/cliff-3.1.0/cliff.egg-info/SOURCES.txt 2020-03-27 11:46:48.000000000 +0100 @@ -46,6 +46,7 @@ cliff/formatters/yaml_format.py cliff/tests/__init__.py cliff/tests/base.py +cliff/tests/test__argparse.py cliff/tests/test_app.py cliff/tests/test_columns.py cliff/tests/test_command.py @@ -91,4 +92,5 @@ doc/source/user/show_commands.rst doc/source/user/sphinxext.rst integration-tests/neutronclient-tip.sh -integration-tests/openstackclient-tip.sh \ No newline at end of file +integration-tests/openstackclient-tip.sh +releasenotes/notes/drop-python27-support-b16c9e5a9e2000ef.yaml \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff.egg-info/pbr.json new/cliff-3.1.0/cliff.egg-info/pbr.json --- old/cliff-2.16.0/cliff.egg-info/pbr.json 2019-09-06 23:29:02.000000000 +0200 +++ new/cliff-3.1.0/cliff.egg-info/pbr.json 2020-03-27 11:46:48.000000000 +0100 @@ -1 +1 @@ -{"git_version": "6b6b186", "is_release": true} \ No newline at end of file +{"git_version": "5405c3d", "is_release": true} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/cliff.egg-info/requires.txt new/cliff-3.1.0/cliff.egg-info/requires.txt --- old/cliff-2.16.0/cliff.egg-info/requires.txt 2019-09-06 23:29:02.000000000 +0200 +++ new/cliff-3.1.0/cliff.egg-info/requires.txt 2020-03-27 11:46:48.000000000 +0100 @@ -5,6 +5,3 @@ six>=1.10.0 stevedore>=1.20.0 PyYAML>=3.12 - -[:(python_version<'3.0')] -unicodecsv>=0.8.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/doc/requirements.txt new/cliff-3.1.0/doc/requirements.txt --- old/cliff-2.16.0/doc/requirements.txt 2019-09-06 23:28:07.000000000 +0200 +++ new/cliff-3.1.0/doc/requirements.txt 2020-03-27 11:45:44.000000000 +0100 @@ -1,6 +1,5 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -sphinx!=1.6.6,!=1.6.7,<2.0.0,>=1.6.2;python_version=='2.7' # BSD -sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD +sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2 # BSD openstackdocstheme>=1.18.1 # Apache-2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/doc/source/conf.py new/cliff-3.1.0/doc/source/conf.py --- old/cliff-2.16.0/doc/source/conf.py 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/doc/source/conf.py 2020-03-27 11:45:44.000000000 +0100 @@ -14,7 +14,6 @@ import datetime import os.path -import subprocess import sys # make openstackdocstheme an optional dependency. cliff is a low level lib @@ -55,7 +54,6 @@ repository_name = 'openstack/cliff' bug_project = 'python-cliff' bug_tag = '' -html_last_updated_fmt = '%Y-%m-%d %H:%M' # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -73,17 +71,6 @@ project = u'cliff' copyright = u'2012-%s, Doug Hellmann' % datetime.datetime.today().year -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = subprocess.Popen(['cd ../..; python setup.py --version'], - shell=True, stdout=subprocess.PIPE).stdout.read() -version = version.strip() -# The full version, including alpha/beta/rc tags. -release = version - # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/doc/source/install/index.rst new/cliff-3.1.0/doc/source/install/index.rst --- old/cliff-2.16.0/doc/source/install/index.rst 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/doc/source/install/index.rst 2020-03-27 11:45:44.000000000 +0100 @@ -5,7 +5,7 @@ Python Versions =============== -cliff is being developed under Python 2.7 and tested with Python 3.5. +cliff is being developed under Python 3. Dependencies ============ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/doc/source/user/sphinxext.rst new/cliff-3.1.0/doc/source/user/sphinxext.rst --- old/cliff-2.16.0/doc/source/user/sphinxext.rst 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/doc/source/user/sphinxext.rst 2020-03-27 11:45:44.000000000 +0100 @@ -125,6 +125,14 @@ .. seealso:: The ``:ignored:`` directive option. + `autoprogram_cliff_app_dist_name` + The name of the python distribution (the name used with pip, as opposed to + the package name used for importing) providing the commands/applications + being documented. Generated documentation for plugin components includes + a message indicating the name of the plugin. Setting this option tells + cliff the name of the distribution providing components natively so their + documentation does not include this message. + .. seealso:: Module `sphinxcontrib.autoprogram` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/lower-constraints.txt new/cliff-3.1.0/lower-constraints.txt --- old/cliff-2.16.0/lower-constraints.txt 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/lower-constraints.txt 2020-03-27 11:45:44.000000000 +0100 @@ -33,5 +33,4 @@ testscenarios==0.4 testtools==2.2.0 traceback2==1.4.0 -unicodecsv==0.8.0;python_version<'3.0' unittest2==1.1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/releasenotes/notes/drop-python27-support-b16c9e5a9e2000ef.yaml new/cliff-3.1.0/releasenotes/notes/drop-python27-support-b16c9e5a9e2000ef.yaml --- old/cliff-2.16.0/releasenotes/notes/drop-python27-support-b16c9e5a9e2000ef.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/cliff-3.1.0/releasenotes/notes/drop-python27-support-b16c9e5a9e2000ef.yaml 2020-03-27 11:45:44.000000000 +0100 @@ -0,0 +1,5 @@ +--- +upgrade: + - | + Support for Python 2.7 has been dropped. The minimum version of Python now + supported is Python 3.6. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/requirements.txt new/cliff-3.1.0/requirements.txt --- old/cliff-2.16.0/requirements.txt 2019-09-06 23:28:07.000000000 +0200 +++ new/cliff-3.1.0/requirements.txt 2020-03-27 11:45:44.000000000 +0100 @@ -7,5 +7,4 @@ pyparsing>=2.1.0 # MIT six>=1.10.0 # MIT stevedore>=1.20.0 # Apache-2.0 -unicodecsv>=0.8.0;python_version<'3.0' # BSD PyYAML>=3.12 # MIT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/setup.cfg new/cliff-3.1.0/setup.cfg --- old/cliff-2.16.0/setup.cfg 2019-09-06 23:29:02.000000000 +0200 +++ new/cliff-3.1.0/setup.cfg 2020-03-27 11:46:48.000000000 +0100 @@ -5,15 +5,17 @@ author-email = [email protected] summary = Command Line Interface Formulation Framework home-page = https://docs.openstack.org/cliff/latest/ +python-requires = >=3.5 classifier = Development Status :: 5 - Production/Stable License :: OSI Approved :: Apache Software License Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 + Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: Implementation :: CPython Intended Audience :: Developers Environment :: Console @@ -50,15 +52,6 @@ cliff.demo.hooked = sample-hook = cliffdemo.hook:Hook -[bdist_wheel] -universal = 1 - -[build_sphinx] -all-files = 1 -warning-is-error = 1 -build-dir = doc/build -source-dir = doc/source - [egg_info] tag_build = tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/setup.py new/cliff-3.1.0/setup.py --- old/cliff-2.16.0/setup.py 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/setup.py 2020-03-27 11:45:44.000000000 +0100 @@ -16,14 +16,6 @@ # THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT import setuptools -# In python < 2.7.4, a lazy loading of package `pbr` will break -# setuptools if some other modules registered functions in `atexit`. -# solution from: http://bugs.python.org/issue15881#msg170215 -try: - import multiprocessing # noqa -except ImportError: - pass - setuptools.setup( setup_requires=['pbr>=2.0.0'], pbr=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/test-requirements.txt new/cliff-3.1.0/test-requirements.txt --- old/cliff-2.16.0/test-requirements.txt 2019-09-06 23:28:07.000000000 +0200 +++ new/cliff-3.1.0/test-requirements.txt 2020-03-27 11:45:44.000000000 +0100 @@ -12,8 +12,7 @@ # sphinx is required in test-requirements in addition to doc/requirements # because there is a sphinx extension that has tests -sphinx!=1.6.6,!=1.6.7,<2.0.0,>=1.6.2;python_version=='2.7' # BSD -sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD +sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2 # BSD # Bandit security code scanner bandit>=1.1.0 # Apache-2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cliff-2.16.0/tox.ini new/cliff-3.1.0/tox.ini --- old/cliff-2.16.0/tox.ini 2019-09-06 23:28:03.000000000 +0200 +++ new/cliff-3.1.0/tox.ini 2020-03-27 11:45:44.000000000 +0100 @@ -1,17 +1,16 @@ [tox] -minversion = 2.0 -envlist = py27,py37,pep8 +minversion = 3.1.0 +envlist = py37,pep8 +ignore_basepython_conflict = True [testenv] +basepython = python3 setenv = VIRTUAL_ENV={envdir} - BRANCH_NAME=master - CLIENT_NAME=cliff OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 distribute = False -install_command = pip install {opts} {packages} commands = python setup.py test --coverage --coverage-package-name=cliff --slowest --testr-args='{posargs}' coverage report --show-missing @@ -21,7 +20,6 @@ -r{toxinidir}/requirements.txt [testenv:pep8] -basepython = python3 deps = -r{toxinidir}/test-requirements.txt flake8 @@ -31,7 +29,6 @@ bandit -c bandit.yaml -r cliff -x tests -n5 [testenv:venv] -basepython = python3 # TODO(modred) remove doc/requirements.txt once the openstack-build-sphinx-docs # job is updated. deps = @@ -40,22 +37,18 @@ commands = {posargs} [testenv:neutronclient-tip] -basepython = python2.7 deps = os:openstack/python-neutronclient:python-neutronclient commands = {toxinidir}/integration-tests/neutronclient-tip.sh {envdir} [testenv:openstackclient-tip] -basepython = python2.7 deps = os:openstack/python-openstackclient:python-openstackclient commands = {toxinidir}/integration-tests/openstackclient-tip.sh {envdir} [testenv:docs] -basepython = python3 deps = -r{toxinidir}/doc/requirements.txt -commands = sphinx-build -b html doc/source doc/build/html +commands = sphinx-build -W -b html doc/source doc/build/html [testenv:lower-constraints] -basepython = python3 deps = -c{toxinidir}/lower-constraints.txt -r{toxinidir}/test-requirements.txt
