]> git.pld-linux.org Git - packages/python-cliff.git/commitdiff
- updated to 2.18.0 with some backported fixes auto/th/python-cliff-2.18.0-1
authorJakub Bogusz <qboosh@pld-linux.org>
Wed, 17 Jan 2024 05:25:38 +0000 (06:25 +0100)
committerJakub Bogusz <qboosh@pld-linux.org>
Wed, 17 Jan 2024 05:25:38 +0000 (06:25 +0100)
python-cliff-mock.patch [new file with mode: 0644]
python-cliff-prettytable.patch [new file with mode: 0644]
python-cliff-py2-test.patch [new file with mode: 0644]
python-cliff-py310.patch [new file with mode: 0644]
python-cliff.spec

diff --git a/python-cliff-mock.patch b/python-cliff-mock.patch
new file mode 100644 (file)
index 0000000..b3d95b5
--- /dev/null
@@ -0,0 +1,182 @@
+--- cliff-2.18.0/cliff/tests/test_app.py.orig  2020-01-08 21:36:15.000000000 +0100
++++ cliff-2.18.0/cliff/tests/test_app.py       2024-01-16 20:07:52.707414769 +0100
+@@ -21,7 +21,10 @@ except ImportError:
+     from io import StringIO
+ import sys
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ import six
+ from cliff import app as application
+--- cliff-2.18.0/cliff/tests/test_command_hooks.py.orig        2020-01-08 21:36:15.000000000 +0100
++++ cliff-2.18.0/cliff/tests/test_command_hooks.py     2024-01-16 20:08:13.197303765 +0100
+@@ -18,7 +18,10 @@ from cliff import lister
+ from cliff import show
+ from cliff.tests import base
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ from stevedore import extension
+--- cliff-2.18.0/cliff/tests/test_commandmanager.py.orig       2024-01-16 20:08:35.477183065 +0100
++++ cliff-2.18.0/cliff/tests/test_commandmanager.py    2024-01-16 20:08:38.507166650 +0100
+@@ -10,7 +10,10 @@
+ #  License for the specific language governing permissions and limitations
+ #  under the License.
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ import testscenarios
+ from cliff import command
+--- cliff-2.18.0/cliff/tests/test_complete.py.orig     2020-01-08 21:36:15.000000000 +0100
++++ cliff-2.18.0/cliff/tests/test_complete.py  2024-01-16 20:09:30.896882831 +0100
+@@ -13,7 +13,10 @@
+ """Bash completion tests
+ """
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ from cliff import app as application
+ from cliff import commandmanager
+--- cliff-2.18.0/cliff/tests/test_formatters_csv.py.orig       2020-01-08 21:36:15.000000000 +0100
++++ cliff-2.18.0/cliff/tests/test_formatters_csv.py    2024-01-16 20:09:46.763463541 +0100
+@@ -16,7 +16,10 @@
+ import argparse
+ import unittest
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ import six
+ from cliff.formatters import commaseparated
+--- cliff-2.18.0/cliff/tests/test_formatters_json.py.orig      2020-01-08 21:36:15.000000000 +0100
++++ cliff-2.18.0/cliff/tests/test_formatters_json.py   2024-01-16 20:10:12.289991918 +0100
+@@ -18,7 +18,10 @@ from cliff.formatters import json_format
+ from cliff.tests import base
+ from cliff.tests import test_columns
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ import six
+--- cliff-2.18.0/cliff/tests/test_formatters_shell.py.orig     2024-01-16 20:10:30.733225336 +0100
++++ cliff-2.18.0/cliff/tests/test_formatters_shell.py  2024-01-16 20:10:36.759859354 +0100
+@@ -19,7 +19,10 @@ from cliff.formatters import shell
+ from cliff.tests import base
+ from cliff.tests import test_columns
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ class TestShellFormatter(base.TestBase):
+--- cliff-2.18.0/cliff/tests/test_formatters_table.py.orig     2020-01-08 21:36:15.000000000 +0100
++++ cliff-2.18.0/cliff/tests/test_formatters_table.py  2024-01-16 20:10:55.843089304 +0100
+@@ -16,7 +16,10 @@ import argparse
+ import os
+ import textwrap
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ from six import StringIO
+ from cliff.formatters import table
+--- cliff-2.18.0/cliff/tests/test_formatters_yaml.py.orig      2020-01-08 21:36:15.000000000 +0100
++++ cliff-2.18.0/cliff/tests/test_formatters_yaml.py   2024-01-16 20:11:10.639675811 +0100
+@@ -19,7 +19,10 @@ from cliff.formatters import yaml_format
+ from cliff.tests import base
+ from cliff.tests import test_columns
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ class TestYAMLFormatter(base.TestBase):
+--- cliff-2.18.0/cliff/tests/test_help.py.orig 2020-01-08 21:36:15.000000000 +0100
++++ cliff-2.18.0/cliff/tests/test_help.py      2024-01-16 20:11:20.262957010 +0100
+@@ -17,7 +17,10 @@ except ImportError:
+ import os
+ import sys
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ from cliff import app as application
+ from cliff import commandmanager
+--- cliff-2.18.0/cliff/tests/test_lister.py.orig       2020-01-08 21:36:15.000000000 +0100
++++ cliff-2.18.0/cliff/tests/test_lister.py    2024-01-16 20:11:28.762910962 +0100
+@@ -17,7 +17,10 @@ import weakref
+ from cliff import lister
+ from cliff.tests import base
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ class FauxFormatter(object):
+--- cliff-2.18.0/cliff/tests/test_show.py.orig 2020-01-08 21:36:15.000000000 +0100
++++ cliff-2.18.0/cliff/tests/test_show.py      2024-01-16 20:11:54.516104778 +0100
+@@ -17,7 +17,10 @@ import weakref
+ from cliff import show
+ from cliff.tests import base
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ class FauxFormatter(object):
+--- cliff-2.18.0/cliff/tests/test_utils.py.orig        2020-01-08 21:36:15.000000000 +0100
++++ cliff-2.18.0/cliff/tests/test_utils.py     2024-01-16 20:12:03.082725036 +0100
+@@ -17,7 +17,10 @@ import struct
+ import sys
+ import unittest
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ from cliff import utils
+ from cliff.tests import base
diff --git a/python-cliff-prettytable.patch b/python-cliff-prettytable.patch
new file mode 100644 (file)
index 0000000..e49f6cc
--- /dev/null
@@ -0,0 +1,23 @@
+--- cliff-2.18.0/requirements.txt.orig 2020-01-08 21:36:15.000000000 +0100
++++ cliff-2.18.0/requirements.txt      2024-01-16 19:44:20.708397557 +0100
+@@ -3,7 +3,7 @@
+ # process, which may cause wedges in the gate later.
+ pbr!=2.1.0,>=2.0.0 # Apache-2.0
+ cmd2>=0.8.0,!=0.8.3,<0.9.0 # MIT
+-PrettyTable<0.8,>=0.7.2 # BSD
++PrettyTable>=0.7.2 # BSD
+ pyparsing>=2.1.0 # MIT
+ six>=1.10.0 # MIT
+ stevedore>=1.20.0 # Apache-2.0
+--- cliff-2.18.0/cliff/formatters/table.py.orig        2020-01-08 21:36:15.000000000 +0100
++++ cliff-2.18.0/cliff/formatters/table.py     2024-01-16 19:45:25.351380690 +0100
+@@ -176,9 +176,6 @@ class TableFormatter(base.ListFormatter,
+     @staticmethod
+     def _assign_max_widths(stdout, x, max_width, min_width=0, fit_width=False):
+-        if min_width:
+-            x.min_width = min_width
+-
+         if max_width > 0:
+             term_width = max_width
+         elif not fit_width:
diff --git a/python-cliff-py2-test.patch b/python-cliff-py2-test.patch
new file mode 100644 (file)
index 0000000..993ea6d
--- /dev/null
@@ -0,0 +1,23 @@
+It fails now - something changed in codecs or six?
+There is no fix to backport because cliff>=3 dropped py2 support
+--- cliff-2.18.0/cliff/tests/test_app.py.orig  2024-01-16 20:52:28.136254060 +0100
++++ cliff-2.18.0/cliff/tests/test_app.py       2024-01-16 20:58:52.597504588 +0100
+@@ -525,18 +525,6 @@ class TestIO(base.TestBase):
+         text_utf8 = text.encode('utf-8')
+         if six.PY2:
+-            # In PY2 StreamWriter can't accept non-ASCII encoded characters
+-            # because it must first promote the encoded byte stream to
+-            # unicode in order to encode it in the desired encoding.
+-            # Because the encoding of the byte stream is not known at this
+-            # point the default-encoding of ASCII is utilized, but you can't
+-            # decode a non-ASCII charcater to ASCII.
+-            io = six.StringIO()
+-            writer = codecs.getwriter('utf-8')(io)
+-            self.assertRaises(UnicodeDecodeError,
+-                              writer.write,
+-                              text_utf8)
+-
+             # In PY2 with our override of codecs.getwriter we do not
+             # attempt to encode bytes in a str object (only unicode
+             # objects) therefore the final output string should be the
diff --git a/python-cliff-py310.patch b/python-cliff-py310.patch
new file mode 100644 (file)
index 0000000..3bc67ed
--- /dev/null
@@ -0,0 +1,11 @@
+--- cliff-2.18.0/cliff/tests/test_help.py.orig 2024-01-16 20:13:24.252285303 +0100
++++ cliff-2.18.0/cliff/tests/test_help.py      2024-01-16 20:49:44.113809312 +0100
+@@ -107,7 +107,7 @@ class TestHelp(base.TestBase):
+         help_text = stdout.getvalue()
+         basecommand = os.path.split(sys.argv[0])[1]
+         self.assertIn('usage: %s [--version]' % basecommand, help_text)
+-        self.assertIn('optional arguments:\n  --version', help_text)
++        self.assertRegex(help_text, 'option(s|al arguments):\n  --version', help_text)
+         expected = (
+             '  one            Test command.\n'
+             '  three word command  Test command.\n'
index 69b4336d4be7a72f43a6fe45d91c84b978775d61..2a0ca8fcc5c01cc05f91c0027100881619bf7274 100644 (file)
@@ -1,69 +1,69 @@
 #
 # Conditional build:
-%bcond_with    tests   # do perform "make test"
+%bcond_without tests   # unit tests
 %bcond_without python2 # CPython 2.x module
 %bcond_without python3 # CPython 3.x module
 
 Summary:       Command Line Interface Formulation Framework
+Summary(pl.UTF-8):     Command Line Interface Formulation Framework - szkielet formułowania linii poleceń
 Name:          python-cliff
-Version:       2.8.0
-Release:       7
+# keep 2.x here for python2 support
+Version:       2.18.0
+Release:       1
 License:       Apache
 Group:         Libraries/Python
-Source0:       https://pypi.python.org/packages/9e/26/7db86b6fb7bcf335e691a274b8f5141006ea87e7783e43d7ef5a498a09da/cliff-%{version}.tar.gz
-# Source0-md5: 6f1fcd6deb8068984f3f0e594f02f2b7
-URL:           https://pypi.python.org/pypi/cliff
+Source0:       https://files.pythonhosted.org/packages/source/c/cliff/cliff-%{version}.tar.gz
+# Source0-md5: 66490f2c437f543f32afe9e518e3c080
+Patch0:                %{name}-prettytable.patch
+Patch1:                %{name}-mock.patch
+Patch2:                %{name}-py310.patch
+Patch3:                %{name}-py2-test.patch
+URL:           https://pypi.org/project/cliff/
 BuildRequires: rpm-pythonprov
 BuildRequires: rpmbuild(macros) >= 1.714
 %if %{with python2}
+BuildRequires: python-modules >= 1:2.7
 BuildRequires: python-pbr >= 2.0.0
 BuildRequires: python-setuptools
 %if %{with tests}
-BuildRequires: python-PyYAML >= 3.10.0
-BuildRequires: python-cmd2 >= 0.6.7
+BuildRequires: python-PyYAML >= 3.12
+BuildRequires: python-cmd2 >= 0.8.0
 BuildRequires: python-coverage >= 4.0
 BuildRequires: python-mock >= 2.0
 BuildRequires: python-openstackdocstheme >= 1.11.0
-BuildRequires: python-prettytable >= 0.7.1
+BuildRequires: python-prettytable >= 0.7.2
 BuildRequires: python-pyparsing >= 2.1.0
-BuildRequires: python-six >= 1.9.0
+BuildRequires: python-six >= 1.10.0
 BuildRequires: python-stevedore >= 1.20.0
-BuildRequires: python-subunit >= 0.0.18
+BuildRequires: python-subunit >= 1.0.0
 BuildRequires: python-testrepository >= 0.0.18
 BuildRequires: python-testscenarios >= 0.4
-BuildRequires: python-testtools >= 1.4.0
+BuildRequires: python-testtools >= 2.2.0
 BuildRequires: python-unicodecsv >= 0.8.0
-BuildRequires: sphinx-pdg-2 >= 1.6.2
+BuildRequires: sphinx-pdg-2 >= 1.7.0
 %endif
 %endif
 %if %{with python3}
-BuildRequires: python3-modules
+BuildRequires: python3-modules >= 1:3.6
 BuildRequires: python3-pbr >= 2.0.0
 %if %{with tests}
-BuildRequires: python3-PyYAML >= 3.10.0
-BuildRequires: python3-cmd2 >= 0.6.7
+BuildRequires: python3-PyYAML >= 3.12
+BuildRequires: python3-cmd2 >= 0.8.0
 BuildRequires: python3-coverage >= 4.0
-BuildRequires: python3-mock >= 2.0
 BuildRequires: python3-openstackdocstheme >= 1.11.0
-BuildRequires: python3-prettytable >= 0.7.1
+BuildRequires: python3-prettytable >= 0.7.2
 BuildRequires: python3-pyparsing >= 2.1.0
-BuildRequires: python3-six >= 1.9.0
+BuildRequires: python3-six >= 1.10.0
 BuildRequires: python3-stevedore >= 1.20.0
-BuildRequires: python3-subunit >= 0.0.18
+BuildRequires: python3-subunit >= 1.0.0
 BuildRequires: python3-testrepository >= 0.0.18
 BuildRequires: python3-testscenarios >= 0.4
-BuildRequires: python3-testtools >= 1.4.0
-BuildRequires: sphinx-pdg-3 >= 1.6.2
+BuildRequires: python3-testtools >= 2.2.0
+BuildRequires: sphinx-pdg-3 >= 1.7.0
 %endif
 %endif
 BuildRequires: sed >= 4.0
-Requires:      python-PyYAML >= 3.10.0
-Requires:      python-cmd2 >= 0.6.7
-Requires:      python-prettytable >= 0.7.1
-Requires:      python-pyparsing >= 2.1.0
-Requires:      python-six >= 1.9.0
-Requires:      python-stevedore >= 1.20.0
-Requires:      python-unicodecsv >= 0.8.0
+Requires:      python-modules >= 1:2.7
 BuildArch:     noarch
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -72,31 +72,51 @@ cliff is a framework for building command line programs. It uses
 setuptools entry points to provide subcommands, output formatters, and
 other extensions.
 
+%description -l pl.UTF-8
+cliff to szkielet do budowania programów działających z linii poleceń.
+Wykorzystuje punkty wejściowe setuptools do zapewnienia podpoleceń,
+funkcje formatujące wyjścia i inne rozszerzenia.
+
 %package -n python3-cliff
 Summary:       Command Line Interface Formulation Framework
+Summary(pl.UTF-8):     Command Line Interface Formulation Framework - szkielet formułowania linii poleceń
 Group:         Libraries/Python
-Requires:      python3-PyYAML >= 3.10.0
-Requires:      python3-cmd2 >= 0.6.7
-Requires:      python3-prettytable >= 0.7.1
-Requires:      python3-pyparsing >= 2.1.0
-Requires:      python3-six >= 1.9.0
-Requires:      python3-stevedore >= 1.20.0
+Requires:      python3-modules >= 1:3.6
 
 %description -n python3-cliff
 cliff is a framework for building command line programs. It uses
 setuptools entry points to provide subcommands, output formatters, and
 other extensions.
 
+%description -n python3-cliff -l pl.UTF-8
+cliff to szkielet do budowania programów działających z linii poleceń.
+Wykorzystuje punkty wejściowe setuptools do zapewnienia podpoleceń,
+funkcje formatujące wyjścia i inne rozszerzenia.
+
 %prep
 %setup -q -n cliff-%{version}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
 
 %build
 %if %{with python2}
+export PYTHON="%{__python}"
 %py_build %{?with_tests:test}
+
+%if %{with tests}
+%{__rm} -r .testrepository
+%endif
 %endif
 
 %if %{with python3}
+export PYTHON="%{__python3}"
 %py3_build %{?with_tests:test}
+
+%if %{with tests}
+%{__rm} -r .testrepository
+%endif
 %endif
 
 %install
@@ -110,10 +130,6 @@ rm -rf $RPM_BUILD_ROOT
 
 %if %{with python3}
 %py3_install
-
-# python dependency generator does not support conditionals
-# remove python2-only dependencies here
-sed -i -e"/python_version<'3.0'/,+1 d" $RPM_BUILD_ROOT%{py3_sitescriptdir}/cliff-%{version}-py*.egg-info/requires.txt
 %endif
 
 %if %{with python2}
This page took 0.077694 seconds and 4 git commands to generate.