Hello community, here is the log from the commit of package python-sphinx-argparse for openSUSE:Factory checked in at 2020-06-12 21:44:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-sphinx-argparse (Old) and /work/SRC/openSUSE:Factory/.python-sphinx-argparse.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-sphinx-argparse" Fri Jun 12 21:44:15 2020 rev:2 rq:814129 version:0.2.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-sphinx-argparse/python-sphinx-argparse.changes 2019-12-14 12:23:30.367198172 +0100 +++ /work/SRC/openSUSE:Factory/.python-sphinx-argparse.new.3606/python-sphinx-argparse.changes 2020-06-12 21:45:40.312527257 +0200 @@ -1,0 +2,8 @@ +Fri Jun 12 10:25:03 UTC 2020 - Matej Cepl <mc...@suse.com> + +- Resolve the mess with different + patches. different_pytest_name.patch has been + replaced by prog-in-description.patch from + gh#alex-rudakov/sphinx-argparse#121 + +------------------------------------------------------------------- Old: ---- different_pytest_name.patch New: ---- prog-in-description.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-sphinx-argparse.spec ++++++ --- /var/tmp/diff_new_pack.apCUIA/_old 2020-06-12 21:45:41.836530833 +0200 +++ /var/tmp/diff_new_pack.apCUIA/_new 2020-06-12 21:45:41.840530843 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-sphinx-argparse # -# Copyright (c) 2019 SUSE LLC +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -27,9 +27,9 @@ URL: https://github.com/ribozz/sphinx-argparse Source0: https://files.pythonhosted.org/packages/source/s/sphinx-argparse/sphinx-argparse-%{version}.tar.gz Source1: https://raw.githubusercontent.com/alex-rudakov/sphinx-argparse/%{version}/LICENSE#/LICENSE-sphinx-argparse -# PATCH-FIX-UPSTREAM different_pytest_name.patch gh#alex-rudakov/sphinx-argparse#121 mc...@suse.com -# Use environmental variable PYTEST_NAME for different names of the pytest executable -Patch0: different_pytest_name.patch +# PATCH-FIX-UPSTREAM prog-in-description.patch gh#alex-rudakov/sphinx-argparse#113 mc...@suse.com +# Substitute %(prog)s in description and epilog +Patch0: prog-in-description.patch BuildRequires: %{python_module CommonMark} BuildRequires: %{python_module Sphinx >= 1.2.0} BuildRequires: %{python_module pytest} ++++++ prog-in-description.patch ++++++ --- a/sphinxarg/parser.py +++ b/sphinxarg/parser.py @@ -10,7 +10,7 @@ def parser_navigate(parser_result, path, if isinstance(path, str): if path == '': return parser_result - path = re.split('\s+', path) + path = re.split(r'\s+', path) current_path = current_path or [] if len(path) == 0: return parser_result @@ -35,7 +35,7 @@ def _try_add_parser_attribute(data, pars if not isinstance(attribval, str): return if len(attribval) > 0: - data[attribname] = attribval + data[attribname] = attribval % {'prog': data['prog']} def _format_usage_without_prefix(parser): --- a/test/test_parser.py +++ b/test/test_parser.py @@ -129,7 +129,7 @@ def test_parse_description(): def test_parse_nested(): - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser(prog='test_parse_nested') parser.add_argument('foo', default=False, help='foo help') parser.add_argument('bar', default=False) @@ -157,8 +157,8 @@ def test_parse_nested(): { 'name': 'install', 'help': 'install help', - 'usage': 'usage: py.test install [-h] [--upgrade] ref', - 'bare_usage': 'py.test install [-h] [--upgrade] ref', + 'usage': 'usage: test_parse_nested install [-h] [--upgrade] ref', + 'bare_usage': 'test_parse_nested install [-h] [--upgrade] ref', 'action_groups': [ { 'title': 'Positional Arguments', @@ -188,7 +188,7 @@ def test_parse_nested(): def test_parse_nested_traversal(): - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser(prog='test_parse_nested_traversal') subparsers1 = parser.add_subparsers() subparser1 = subparsers1.add_parser('level1') @@ -223,8 +223,8 @@ def test_parse_nested_traversal(): { 'name': 'level3', 'help': '', - 'usage': 'usage: py.test level1 level2 level3 [-h] foo bar', - 'bare_usage': 'py.test level1 level2 level3 [-h] foo bar', + 'usage': 'usage: test_parse_nested_traversal level1 level2 level3 [-h] foo bar', + 'bare_usage': 'test_parse_nested_traversal level1 level2 level3 [-h] foo bar', 'action_groups': [ { 'title': 'Positional Arguments', @@ -265,6 +265,20 @@ def test_fill_in_default_prog(): ] +def test_fill_in_description_epilog(): + """ + Ensure that %(prog)s gets filled in inside description and epilog. + """ + parser = argparse.ArgumentParser( + prog='test_fill_in_description', + description='Welcome to %(prog)s', + epilog='%(prog)s salutes you') + data = parse_parser(parser) + + assert data['description'] == 'Welcome to test_fill_in_description' + assert data['epilog'] == 'test_fill_in_description salutes you' + + def test_string_quoting(): """ If an optional argument has a string type and a default, then the default should be in quotes.