[packages/python-sphinx_argparse] - new
qboosh
qboosh at pld-linux.org
Sat Oct 31 10:20:14 CET 2020
commit 80ad58dff3cd7a0ddb8dd1c38afaf4fb49090859
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sat Oct 31 10:20:03 2020 +0100
- new
python-sphinx_argparse-tests.patch | 44 ++++++++++++++
python-sphinx_argparse.spec | 116 +++++++++++++++++++++++++++++++++++++
2 files changed, 160 insertions(+)
---
diff --git a/python-sphinx_argparse.spec b/python-sphinx_argparse.spec
new file mode 100644
index 0000000..799d31c
--- /dev/null
+++ b/python-sphinx_argparse.spec
@@ -0,0 +1,116 @@
+#
+# Conditional build:
+%bcond_without tests # unit tests
+%bcond_without python2 # CPython 2.x module
+%bcond_without python3 # CPython 3.x module
+
+Summary: Sphinx extension that automatically documents argparse commands and options
+Summary(pl.UTF-8): Rozszerzenie Sphinksa automatycznie dokumentujące polecenia i opcje argparse
+Name: python-sphinx_argparse
+Version: 0.2.5
+Release: 1
+License: MIT
+Group: Libraries/Python
+#Source0Download: https://pypi.org/simple/sphinx-argparse/
+Source0: https://files.pythonhosted.org/packages/source/s/sphinx-argparse/sphinx-argparse-%{version}.tar.gz
+# Source0-md5: b137944fbbe26c88d54ee106bf0569ab
+Patch0: %{name}-tests.patch
+URL: https://pypi.org/project/sphinx-argparse/
+%if %{with python2}
+BuildRequires: python-modules >= 1:2.7
+BuildRequires: python-setuptools
+%if %{with tests}
+BuildRequires: python-Sphinx >= 1.2.0
+BuildRequires: python-pytest
+%endif
+%endif
+%if %{with python3}
+BuildRequires: python3-modules >= 1:3.5
+BuildRequires: python3-setuptools
+%if %{with tests}
+BuildRequires: python3-Sphinx >= 1.2.0
+BuildRequires: python3-pytest
+%endif
+%endif
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.714
+Requires: python-modules >= 1:2.7
+Conflicts: python-commonmark < 0.5.6
+BuildArch: noarch
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Sphinx extension that automatically documents argparse commands and
+options.
+
+%description -l pl.UTF-8
+Rozszerzenie Sphinksa automatycznie dokumentujące polecenia i opcje
+argparse.
+
+%package -n python3-sphinx_argparse
+Summary: Sphinx extension that automatically documents argparse commands and options
+Summary(pl.UTF-8): Rozszerzenie Sphinksa automatycznie dokumentujące polecenia i opcje argparse
+Group: Libraries/Python
+Requires: python3-modules >= 1:3.5
+Conflicts: python3-commonmark < 0.5.6
+
+%description -n python3-sphinx_argparse
+Sphinx extension that automatically documents argparse commands and
+options.
+
+%description -n python3-sphinx_argparse -l pl.UTF-8
+Rozszerzenie Sphinksa automatycznie dokumentujące polecenia i opcje
+argparse.
+
+%prep
+%setup -q -n sphinx-argparse-%{version}
+%patch0 -p1
+
+%build
+%if %{with python2}
+%py_build
+
+%if %{with tests}
+%{__python} -m pytest test
+%endif
+%endif
+
+%if %{with python3}
+%py3_build
+
+%if %{with tests}
+%{__python3} -m pytest test
+%endif
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%py_install
+
+%py_postclean
+%endif
+
+%if %{with python3}
+%py3_install
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%files
+%defattr(644,root,root,755)
+%doc README.md
+%{py_sitescriptdir}/sphinxarg
+%{py_sitescriptdir}/sphinx_argparse-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-sphinx_argparse
+%defattr(644,root,root,755)
+%doc README.md
+%{py3_sitescriptdir}/sphinxarg
+%{py3_sitescriptdir}/sphinx_argparse-%{version}-py*.egg-info
+%endif
diff --git a/python-sphinx_argparse-tests.patch b/python-sphinx_argparse-tests.patch
new file mode 100644
index 0000000..f14c9cf
--- /dev/null
+++ b/python-sphinx_argparse-tests.patch
@@ -0,0 +1,44 @@
+--- sphinx-argparse-0.2.5/test/test_parser.py.orig 2017-03-31 10:08:31.000000000 +0200
++++ sphinx-argparse-0.2.5/test/test_parser.py 2020-10-31 10:09:03.610717045 +0100
+@@ -1,4 +1,6 @@
+ import argparse
++import os
++import sys
+ from sphinxarg.parser import parse_parser, parser_navigate
+
+
+@@ -140,6 +142,7 @@
+ subparser.add_argument('--upgrade', action='store_true', default=False, help='foo2 help')
+
+ data = parse_parser(parser)
++ cmd = os.path.basename(sys.argv[0])
+
+ assert data['action_groups'][0]['options'] == [
+ {
+@@ -157,8 +160,8 @@
+ {
+ 'name': 'install',
+ 'help': 'install help',
+- 'usage': 'usage: py.test install [-h] [--upgrade] ref',
+- 'bare_usage': 'py.test install [-h] [--upgrade] ref',
++ 'usage': 'usage: ' + cmd + ' install [-h] [--upgrade] ref',
++ 'bare_usage': cmd + ' install [-h] [--upgrade] ref',
+ 'action_groups': [
+ {
+ 'title': 'Positional Arguments',
+@@ -219,12 +222,13 @@
+ ]
+
+ data2 = parser_navigate(data, 'level1 level2')
++ cmd = os.path.basename(sys.argv[0])
+ assert data2['children'] == [
+ {
+ '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: ' + cmd + ' level1 level2 level3 [-h] foo bar',
++ 'bare_usage': cmd + ' level1 level2 level3 [-h] foo bar',
+ 'action_groups': [
+ {
+ 'title': 'Positional Arguments',
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-sphinx_argparse.git/commitdiff/80ad58dff3cd7a0ddb8dd1c38afaf4fb49090859
More information about the pld-cvs-commit
mailing list