From 977de850856d8d8d71077cf92eb45c4c0cdce4f324a1ef387a033fcce66e850f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Tue, 4 Jun 2019 14:30:49 +0000 Subject: [PATCH] - Update to 1.2.0: * Run tests on Python 3.7. * Use twine check during packaging tests. * Rename old tsv format to csv-tab (because it add quotes), introduce new tsv output adapter. * Truncate long fields for tabular display. * Return the supported table formats as unicode. * Override tab with 4 spaces for terminal tables. - Add patch to fix build with new pygments: * pygments.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cli-helpers?expand=0&rev=4 --- cli_helpers-1.1.0.tar.gz | 3 - cli_helpers-1.2.0.tar.gz | 3 + pygments.patch | 224 +++++++++++++++++++++++++++++++++++++ python-cli-helpers.changes | 13 +++ python-cli-helpers.spec | 31 ++--- 5 files changed, 256 insertions(+), 18 deletions(-) delete mode 100644 cli_helpers-1.1.0.tar.gz create mode 100644 cli_helpers-1.2.0.tar.gz create mode 100644 pygments.patch diff --git a/cli_helpers-1.1.0.tar.gz b/cli_helpers-1.1.0.tar.gz deleted file mode 100644 index 2be49ac..0000000 --- a/cli_helpers-1.1.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7c2038bba0c41f41acae0f6e660ff3b00d69f55d9d968f024952cace78111e12 -size 29998 diff --git a/cli_helpers-1.2.0.tar.gz b/cli_helpers-1.2.0.tar.gz new file mode 100644 index 0000000..04f283f --- /dev/null +++ b/cli_helpers-1.2.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d211192b4d5a61de0020c516213ba67bbf1662ccd8c0624e6696dedb1a9d3e5d +size 30843 diff --git a/pygments.patch b/pygments.patch new file mode 100644 index 0000000..9a40d5f --- /dev/null +++ b/pygments.patch @@ -0,0 +1,224 @@ +From 19a0e9def85b6a8f066594ae25204338c28eeb04 Mon Sep 17 00:00:00 2001 +From: Thomas Roten +Date: Sat, 25 May 2019 15:23:32 -0500 +Subject: [PATCH] Fix use of bold in Pygments tests. + +--- + tests/tabular_output/test_preprocessors.py | 6 +-- + tests/tabular_output/test_tabulate_adapter.py | 42 +++++++++---------- + .../test_terminaltables_adapter.py | 42 +++++++++---------- + 3 files changed, 45 insertions(+), 45 deletions(-) + +diff --git a/tests/tabular_output/test_preprocessors.py b/tests/tabular_output/test_preprocessors.py +index d79b744..44fc652 100644 +--- a/tests/tabular_output/test_preprocessors.py ++++ b/tests/tabular_output/test_preprocessors.py +@@ -161,7 +161,7 @@ class CliStyle(Style): + headers = ['h1', 'h2'] + data = [['观音', '2'], ['Ποσειδῶν', 'b']] + +- expected_headers = ['\x1b[31;01mh1\x1b[39;00m', '\x1b[31;01mh2\x1b[39;00m'] ++ expected_headers = ['\x1b[91;01mh1\x1b[39;00m', '\x1b[91;01mh2\x1b[39;00m'] + expected_data = [['\x1b[38;5;233;48;5;7m观音\x1b[39;49m', + '\x1b[38;5;233;48;5;7m2\x1b[39;49m'], + ['\x1b[38;5;10mΠοσειδῶν\x1b[39m', '\x1b[38;5;10mb\x1b[39m']] +@@ -183,7 +183,7 @@ class CliStyle(Style): + headers = ['h1', 'h2'] + data = [['观音\nLine2', 'Ποσειδῶν']] + +- expected_headers = ['\x1b[31;01mh1\x1b[39;00m', '\x1b[31;01mh2\x1b[39;00m'] ++ expected_headers = ['\x1b[91;01mh1\x1b[39;00m', '\x1b[91;01mh2\x1b[39;00m'] + expected_data = [ + ['\x1b[38;5;233;48;5;7m观音\x1b[39;49m\n\x1b[38;5;233;48;5;7m' + 'Line2\x1b[39;49m', +@@ -207,7 +207,7 @@ class CliStyle(Style): + headers = ['h1', 'h2'] + data = [['1', '2'], ['a', 'b']] + +- expected_headers = ['\x1b[31;01mh1\x1b[39;00m', '\x1b[31;01mh2\x1b[39;00m'] ++ expected_headers = ['\x1b[91;01mh1\x1b[39;00m', '\x1b[91;01mh2\x1b[39;00m'] + expected_data = [['\x1b[38;5;233;48;5;7m1\x1b[39;49m', + '\x1b[38;5;233;48;5;7m2\x1b[39;49m'], + ['\x1b[38;5;10ma\x1b[39m', '\x1b[38;5;10mb\x1b[39m']] +diff --git a/tests/tabular_output/test_tabulate_adapter.py b/tests/tabular_output/test_tabulate_adapter.py +index d2ade12..e0dd5a8 100644 +--- a/tests/tabular_output/test_tabulate_adapter.py ++++ b/tests/tabular_output/test_tabulate_adapter.py +@@ -73,24 +73,24 @@ class CliStyle(Style): + output = tabulate_adapter.adapter(iter(data), headers, table_format='psql') + + assert "\n".join(output) == dedent('''\ +- \x1b[31;01m+\x1b[39;00m''' + ( +- ('\x1b[31;01m-\x1b[39;00m' * 10) + +- '\x1b[31;01m+\x1b[39;00m' + +- ('\x1b[31;01m-\x1b[39;00m' * 6)) + +- '''\x1b[31;01m+\x1b[39;00m +- \x1b[31;01m|\x1b[39;00m h1 \x1b[31;01m|\x1b[39;00m''' + +- ''' h2 \x1b[31;01m|\x1b[39;00m +- ''' + '\x1b[31;01m|\x1b[39;00m' + ( +- ('\x1b[31;01m-\x1b[39;00m' * 10) + +- '\x1b[31;01m+\x1b[39;00m' + +- ('\x1b[31;01m-\x1b[39;00m' * 6)) + +- '''\x1b[31;01m|\x1b[39;00m +- \x1b[31;01m|\x1b[39;00m 观音 \x1b[31;01m|\x1b[39;00m''' + +- ''' 2 \x1b[31;01m|\x1b[39;00m +- \x1b[31;01m|\x1b[39;00m Ποσειδῶν \x1b[31;01m|\x1b[39;00m''' + +- ''' b \x1b[31;01m|\x1b[39;00m +- ''' + '\x1b[31;01m+\x1b[39;00m' + ( +- ('\x1b[31;01m-\x1b[39;00m' * 10) + +- '\x1b[31;01m+\x1b[39;00m' + +- ('\x1b[31;01m-\x1b[39;00m' * 6)) + +- '\x1b[31;01m+\x1b[39;00m') ++ \x1b[91m+\x1b[39m''' + ( ++ ('\x1b[91m-\x1b[39m' * 10) + ++ '\x1b[91m+\x1b[39m' + ++ ('\x1b[91m-\x1b[39m' * 6)) + ++ '''\x1b[91m+\x1b[39m ++ \x1b[91m|\x1b[39m h1 \x1b[91m|\x1b[39m''' + ++ ''' h2 \x1b[91m|\x1b[39m ++ ''' + '\x1b[91m|\x1b[39m' + ( ++ ('\x1b[91m-\x1b[39m' * 10) + ++ '\x1b[91m+\x1b[39m' + ++ ('\x1b[91m-\x1b[39m' * 6)) + ++ '''\x1b[91m|\x1b[39m ++ \x1b[91m|\x1b[39m 观音 \x1b[91m|\x1b[39m''' + ++ ''' 2 \x1b[91m|\x1b[39m ++ \x1b[91m|\x1b[39m Ποσειδῶν \x1b[91m|\x1b[39m''' + ++ ''' b \x1b[91m|\x1b[39m ++ ''' + '\x1b[91m+\x1b[39m' + ( ++ ('\x1b[91m-\x1b[39m' * 10) + ++ '\x1b[91m+\x1b[39m' + ++ ('\x1b[91m-\x1b[39m' * 6)) + ++ '\x1b[91m+\x1b[39m') +diff --git a/tests/tabular_output/test_terminaltables_adapter.py b/tests/tabular_output/test_terminaltables_adapter.py +index 8794129..f756327 100644 +--- a/tests/tabular_output/test_terminaltables_adapter.py ++++ b/tests/tabular_output/test_terminaltables_adapter.py +@@ -46,24 +46,24 @@ class CliStyle(Style): + output = terminaltables_adapter.adapter(iter(data), headers, table_format='ascii') + + assert "\n".join(output) == dedent('''\ +- \x1b[31;01m+\x1b[39;00m''' + ( +- ('\x1b[31;01m-\x1b[39;00m' * 10) + +- '\x1b[31;01m+\x1b[39;00m' + +- ('\x1b[31;01m-\x1b[39;00m' * 4)) + +- '''\x1b[31;01m+\x1b[39;00m +- \x1b[31;01m|\x1b[39;00m h1 \x1b[31;01m|\x1b[39;00m''' + +- ''' h2 \x1b[31;01m|\x1b[39;00m +- ''' + '\x1b[31;01m+\x1b[39;00m' + ( +- ('\x1b[31;01m-\x1b[39;00m' * 10) + +- '\x1b[31;01m+\x1b[39;00m' + +- ('\x1b[31;01m-\x1b[39;00m' * 4)) + +- '''\x1b[31;01m+\x1b[39;00m +- \x1b[31;01m|\x1b[39;00m 观音 \x1b[31;01m|\x1b[39;00m''' + +- ''' 2 \x1b[31;01m|\x1b[39;00m +- \x1b[31;01m|\x1b[39;00m Ποσειδῶν \x1b[31;01m|\x1b[39;00m''' + +- ''' b \x1b[31;01m|\x1b[39;00m +- ''' + '\x1b[31;01m+\x1b[39;00m' + ( +- ('\x1b[31;01m-\x1b[39;00m' * 10) + +- '\x1b[31;01m+\x1b[39;00m' + +- ('\x1b[31;01m-\x1b[39;00m' * 4)) + +- '\x1b[31;01m+\x1b[39;00m') ++ \x1b[91m+\x1b[39m''' + ( ++ ('\x1b[91m-\x1b[39m' * 10) + ++ '\x1b[91m+\x1b[39m' + ++ ('\x1b[91m-\x1b[39m' * 4)) + ++ '''\x1b[91m+\x1b[39m ++ \x1b[91m|\x1b[39m h1 \x1b[91m|\x1b[39m''' + ++ ''' h2 \x1b[91m|\x1b[39m ++ ''' + '\x1b[91m+\x1b[39m' + ( ++ ('\x1b[91m-\x1b[39m' * 10) + ++ '\x1b[91m+\x1b[39m' + ++ ('\x1b[91m-\x1b[39m' * 4)) + ++ '''\x1b[91m+\x1b[39m ++ \x1b[91m|\x1b[39m 观音 \x1b[91m|\x1b[39m''' + ++ ''' 2 \x1b[91m|\x1b[39m ++ \x1b[91m|\x1b[39m Ποσειδῶν \x1b[91m|\x1b[39m''' + ++ ''' b \x1b[91m|\x1b[39m ++ ''' + '\x1b[91m+\x1b[39m' + ( ++ ('\x1b[91m-\x1b[39m' * 10) + ++ '\x1b[91m+\x1b[39m' + ++ ('\x1b[91m-\x1b[39m' * 4)) + ++ '\x1b[91m+\x1b[39m') +From ccc7aaffca8fa6e2b2f167a9d0f13e4dafe75aee Mon Sep 17 00:00:00 2001 +From: Thomas Roten +Date: Fri, 24 May 2019 12:36:41 -0500 +Subject: [PATCH] Pin to Pygments >= 2.4.0 for tests. + +--- + cli_helpers/tabular_output/preprocessors.py | 2 +- + tests/tabular_output/test_preprocessors.py | 6 +++--- + tests/tabular_output/test_tabulate_adapter.py | 2 +- + tests/tabular_output/test_terminaltables_adapter.py | 2 +- + 5 files changed, 7 insertions(+), 6 deletions(-) + +diff --git a/cli_helpers/tabular_output/preprocessors.py b/cli_helpers/tabular_output/preprocessors.py +index 9bbbd39..8a1c91f 100644 +--- a/cli_helpers/tabular_output/preprocessors.py ++++ b/cli_helpers/tabular_output/preprocessors.py +@@ -193,7 +193,7 @@ def style_output(data, headers, style=None, + class YourStyle(Style): + default_style = "" + styles = { +- Token.Output.Header: 'bold #ansired', ++ Token.Output.Header: 'bold ansibrightred', + Token.Output.OddRow: 'bg:#eee #111', + Token.Output.EvenRow: '#0f0' + } +diff --git a/tests/tabular_output/test_preprocessors.py b/tests/tabular_output/test_preprocessors.py +index 4eb9165..d79b744 100644 +--- a/tests/tabular_output/test_preprocessors.py ++++ b/tests/tabular_output/test_preprocessors.py +@@ -154,7 +154,7 @@ def test_style_output(): + class CliStyle(Style): + default_style = "" + styles = { +- Token.Output.Header: 'bold #ansired', ++ Token.Output.Header: 'bold ansibrightred', + Token.Output.OddRow: 'bg:#eee #111', + Token.Output.EvenRow: '#0f0' + } +@@ -176,7 +176,7 @@ def test_style_output_with_newlines(): + class CliStyle(Style): + default_style = "" + styles = { +- Token.Output.Header: 'bold #ansired', ++ Token.Output.Header: 'bold ansibrightred', + Token.Output.OddRow: 'bg:#eee #111', + Token.Output.EvenRow: '#0f0' + } +@@ -200,7 +200,7 @@ def test_style_output_custom_tokens(): + class CliStyle(Style): + default_style = "" + styles = { +- Token.Results.Headers: 'bold #ansired', ++ Token.Results.Headers: 'bold ansibrightred', + Token.Results.OddRows: 'bg:#eee #111', + Token.Results.EvenRows: '#0f0' + } +diff --git a/tests/tabular_output/test_tabulate_adapter.py b/tests/tabular_output/test_tabulate_adapter.py +index c289cba..d2ade12 100644 +--- a/tests/tabular_output/test_tabulate_adapter.py ++++ b/tests/tabular_output/test_tabulate_adapter.py +@@ -63,7 +63,7 @@ def test_style_output_table(): + class CliStyle(Style): + default_style = "" + styles = { +- Token.Output.TableSeparator: '#ansired', ++ Token.Output.TableSeparator: 'ansibrightred', + } + headers = ['h1', 'h2'] + data = [['观音', '2'], ['Ποσειδῶν', 'b']] +diff --git a/tests/tabular_output/test_terminaltables_adapter.py b/tests/tabular_output/test_terminaltables_adapter.py +index fc49b99..8794129 100644 +--- a/tests/tabular_output/test_terminaltables_adapter.py ++++ b/tests/tabular_output/test_terminaltables_adapter.py +@@ -36,7 +36,7 @@ def test_style_output_table(): + class CliStyle(Style): + default_style = "" + styles = { +- Token.Output.TableSeparator: '#ansired', ++ Token.Output.TableSeparator: 'ansibrightred', + } + headers = ['h1', 'h2'] + data = [['观音', '2'], ['Ποσειδῶν', 'b']] diff --git a/python-cli-helpers.changes b/python-cli-helpers.changes index 5a0d2de..83ac21a 100644 --- a/python-cli-helpers.changes +++ b/python-cli-helpers.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Tue May 28 10:47:19 UTC 2019 - Tomáš Chvátal + +- Update to 1.2.0: + * Run tests on Python 3.7. + * Use twine check during packaging tests. + * Rename old tsv format to csv-tab (because it add quotes), introduce new tsv output adapter. + * Truncate long fields for tabular display. + * Return the supported table formats as unicode. + * Override tab with 4 spaces for terminal tables. +- Add patch to fix build with new pygments: + * pygments.patch + ------------------------------------------------------------------- Wed Feb 6 00:29:09 UTC 2019 - Jan Engelhardt diff --git a/python-cli-helpers.spec b/python-cli-helpers.spec index 573bfa8..eccc154 100644 --- a/python-cli-helpers.spec +++ b/python-cli-helpers.spec @@ -18,21 +18,29 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-cli-helpers -Version: 1.1.0 +Version: 1.2.0 Release: 0 Summary: Helpers for building command-line apps License: BSD-3-Clause Group: Development/Languages/Python -Url: https://github.com/dbcli/cli_helpers -Source: https://files.pythonhosted.org/packages/source/c/cli-helpers/cli_helpers-%{version}.tar.gz +URL: https://github.com/dbcli/cli_helpers +Source: https://files.pythonhosted.org/packages/source/c/cli_helpers/cli_helpers-%{version}.tar.gz +Patch0: pygments.patch BuildRequires: %{python_module setuptools} +BuildRequires: fdupes BuildRequires: python-rpm-macros +Requires: python-Pygments >= 2.4 +Requires: python-configobj >= 5.0.5 +Requires: python-tabulate >= 0.8.2 +Requires: python-terminaltables >= 3.0.0 +Requires: python-wcwidth +BuildArch: noarch # SECTION test requirements +# Package dependencies +BuildRequires: %{python_module Pygments >= 2.4} +BuildRequires: %{python_module configobj >= 5.0.5} BuildRequires: %{python_module mock >= 2.0.0} BuildRequires: %{python_module pytest >= 3.0.7} -# Package dependencies -BuildRequires: %{python_module Pygments >= 1.6} -BuildRequires: %{python_module configobj >= 5.0.5} BuildRequires: %{python_module tabulate >= 0.8.2} BuildRequires: %{python_module terminaltables >= 3.0.0} BuildRequires: %{python_module wcwidth} @@ -40,17 +48,9 @@ BuildRequires: %{python_module wcwidth} BuildRequires: python2-backports.csv >= 1.0.0 %endif # /SECTION -BuildRequires: fdupes -BuildArch: noarch -Requires: python-Pygments >= 1.6 -Requires: python-configobj >= 5.0.5 -Requires: python-tabulate >= 0.8.2 -Requires: python-terminaltables >= 3.0.0 -Requires: python-wcwidth %ifpython2 Requires: python2-backports.csv >= 1.0.0 %endif - %python_subpackages %description @@ -68,6 +68,7 @@ other libraries. %prep %setup -q -n cli_helpers-%{version} +%patch0 -p1 %build %python_build @@ -77,7 +78,7 @@ other libraries. %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -%python_exec -m pytest +%pytest %files %{python_files} %license LICENSE