14
0

Accepting request 955732 from devel:languages:python

- version update to 0.3.1
  0.3.1
  Include tests in sdist
  0.3.0
  First release from ashb/sphinx-argparse
  Declare that parallel builds are supported (issue #131).
- deleted sources
  - LICENSE-sphinx-argparse (in tarball)
- added patches
  fix fdb7e448b2
  + python-sphinx-argparse-python310.patch
- remove patches which were included upstream
  - prog-in-description.patch

OBS-URL: https://build.opensuse.org/request/show/955732
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sphinx-argparse?expand=0&rev=3
This commit is contained in:
2022-02-18 22:02:50 +00:00
committed by Git OBS Bridge
7 changed files with 42 additions and 122 deletions

View File

@@ -1,20 +0,0 @@
The MIT License (MIT)
Copyright (c) 2013 Alex Rudakov
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,83 +0,0 @@
--- 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.

View File

@@ -0,0 +1,15 @@
diff --git a/sphinxarg/parser.py b/sphinxarg/parser.py
index 9a6f76a..89583c6 100644
--- a/sphinxarg/parser.py
+++ b/sphinxarg/parser.py
@@ -154,7 +154,9 @@ def parse_parser(parser, data=None, **kwargs):
continue
# Upper case "Positional Arguments" and "Optional Arguments" titles
- if action_group.title == 'optional arguments':
+ # Since python-3.10 'optional arguments' changed to 'options'
+ # more info: https://github.com/python/cpython/pull/23858
+ if action_group.title == 'optional arguments' or action_group.title == 'options':
action_group.title = 'Named Arguments'
if action_group.title == 'positional arguments':
action_group.title = 'Positional Arguments'

View File

@@ -1,3 +1,20 @@
-------------------------------------------------------------------
Thu Feb 17 15:48:53 UTC 2022 - pgajdos@suse.com
- version update to 0.3.1
0.3.1
Include tests in sdist
0.3.0
First release from ashb/sphinx-argparse
Declare that parallel builds are supported (issue #131).
- deleted sources
- LICENSE-sphinx-argparse (in tarball)
- added patches
fix https://github.com/ashb/sphinx-argparse/commit/fdb7e448b2776986415cb724d9bb3eed424e23b2
+ python-sphinx-argparse-python310.patch
- remove patches which were included upstream
- prog-in-description.patch
-------------------------------------------------------------------
Fri Jun 12 10:25:03 UTC 2020 - Matej Cepl <mcepl@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-sphinx-argparse
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,17 +19,15 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-sphinx-argparse
Version: 0.2.5
Version: 0.3.1
Release: 0
Summary: Sphinx extension to document argparse commands and options
License: MIT
Group: Development/Languages/Python
URL: https://github.com/ribozz/sphinx-argparse
URL: https://github.com/ashb/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 prog-in-description.patch gh#alex-rudakov/sphinx-argparse#113 mcepl@suse.com
# Substitute %(prog)s in description and epilog
Patch0: prog-in-description.patch
# https://github.com/ashb/sphinx-argparse/commit/fdb7e448b2776986415cb724d9bb3eed424e23b2
Patch0: python-sphinx-argparse-python310.patch
BuildRequires: %{python_module CommonMark}
BuildRequires: %{python_module Sphinx >= 1.2.0}
BuildRequires: %{python_module pytest}
@@ -43,10 +41,7 @@ BuildArch: noarch
Sphinx extension that automatically documents argparse commands and options.
%prep
%setup -q -n sphinx-argparse-%{version}
%autopatch -p1
install -m0644 %{SOURCE1} LICENSE
%autosetup -p1 -n sphinx-argparse-%{version}
%build
%python_build
@@ -56,14 +51,10 @@ install -m0644 %{SOURCE1} LICENSE
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# can't use %%pytest until gh#alex-rudakov/sphinx-argparse#121 is solved
%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitelib} PYTEST_NAME="py.test-%{$python_bin_suffix}"
$PYTEST_NAME --ignore=_build.python2 --ignore=_build.python3 --ignore=_build.pypy3 -vv
}
%pytest
%files %{python_files}
%license LICENSE
%doc README.md
%{python_sitelib}/*
%changelog

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:60ab98f80ffd38731d62e267171388a421abbc96c74901b7785a8e058b438c17
size 12153

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:82151cbd43ccec94a1530155f4ad34f251aaca6a0ffd5516d7fadf952d32dc1e
size 14072