Hello community, here is the log from the commit of package python-texttable for openSUSE:Factory checked in at 2018-07-21 10:25:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-texttable (Old) and /work/SRC/openSUSE:Factory/.python-texttable.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-texttable" Sat Jul 21 10:25:36 2018 rev:3 rq:624253 version:1.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-texttable/python-texttable.changes 2017-12-08 13:03:31.980369415 +0100 +++ /work/SRC/openSUSE:Factory/.python-texttable.new/python-texttable.changes 2018-07-21 10:25:37.770951533 +0200 @@ -1,0 +2,11 @@ +Fri Jul 20 11:36:41 UTC 2018 - tchva...@suse.com + +- Version update to 1.4.0: + * Add set_header_align() method (#45) + * Fix missing textwrapper command when cjkwrap is not used (#43) + * Remove redundant code for unsupported/EOL Python (#31) + * Use test_cjkwrap only when cjkwrap is available (#35) + * Use cjkwrap for better CJK text support (#34) +- Enable tests + +------------------------------------------------------------------- Old: ---- texttable-1.1.1.tar.gz New: ---- texttable-1.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-texttable.spec ++++++ --- /var/tmp/diff_new_pack.NJuKje/_old 2018-07-21 10:25:38.330951397 +0200 +++ /var/tmp/diff_new_pack.NJuKje/_new 2018-07-21 10:25:38.358951390 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-texttable # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,20 +17,16 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%bcond_with test Name: python-texttable -Version: 1.1.1 +Version: 1.4.0 Release: 0 Summary: Module for creating simple ASCII tables -License: LGPL-3.0 +License: LGPL-3.0-only Group: Development/Languages/Python Url: https://github.com/foutaise/texttable/ Source: https://files.pythonhosted.org/packages/source/t/texttable/texttable-%{version}.tar.gz -BuildRequires: %{python_module devel} +BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} -%if %{with test} -BuildRequires: python3-testsuite -%endif BuildRequires: fdupes BuildRequires: python-rpm-macros BuildArch: noarch @@ -51,10 +47,8 @@ %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} -%if %{with test} %check -%python_exec setup.py test -%endif +%python_expand py.test-%{$python_bin_suffix} tests.py %files %{python_files} %license LICENSE ++++++ texttable-1.1.1.tar.gz -> texttable-1.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texttable-1.1.1/.coveragerc new/texttable-1.4.0/.coveragerc --- old/texttable-1.1.1/.coveragerc 1970-01-01 01:00:00.000000000 +0100 +++ new/texttable-1.4.0/.coveragerc 2018-06-22 16:17:48.000000000 +0200 @@ -0,0 +1,10 @@ +# .coveragerc to control coverage.py + +[report] +# Regexes for lines to exclude from consideration +exclude_lines = + # Have to re-enable the standard pragma: + pragma: no cover + + # Don't complain if non-runnable code isn't run: + if __name__ == .__main__.: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texttable-1.1.1/MANIFEST.in new/texttable-1.4.0/MANIFEST.in --- old/texttable-1.1.1/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100 +++ new/texttable-1.4.0/MANIFEST.in 2018-06-22 16:17:48.000000000 +0200 @@ -0,0 +1 @@ +include README.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texttable-1.1.1/PKG-INFO new/texttable-1.4.0/PKG-INFO --- old/texttable-1.1.1/PKG-INFO 2017-10-26 14:23:51.000000000 +0200 +++ new/texttable-1.4.0/PKG-INFO 2018-06-22 16:17:48.000000000 +0200 @@ -1,12 +1,12 @@ Metadata-Version: 1.0 Name: texttable -Version: 1.1.1 +Version: 1.4.0 Summary: module for creating simple ASCII tables Home-page: https://github.com/foutaise/texttable/ Author: Gerome Fournier Author-email: j...@foutaise.org License: LGPL -Download-URL: https://github.com/foutaise/texttable/archive/v1.1.1.tar.gz +Download-URL: https://github.com/foutaise/texttable/archive/v1.4.0.tar.gz Description: texttable is a module to generate a formatted text table, using ASCII characters. Platform: any @@ -18,6 +18,11 @@ Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: POSIX Classifier: Operating System :: MacOS +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Text Processing Classifier: Topic :: Utilities diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texttable-1.1.1/README.md new/texttable-1.4.0/README.md --- old/texttable-1.1.1/README.md 2017-10-26 14:23:51.000000000 +0200 +++ new/texttable-1.4.0/README.md 2018-06-22 16:17:48.000000000 +0200 @@ -4,10 +4,14 @@ ## Availability -This module is available on [PypI](https://pypi.python.org/pypi/texttable/1.1.1), and has been packaged for several Linux/Unix platforms +This module is available on [PypI](https://pypi.python.org/pypi/texttable/1.4.0), and has been packaged for several Linux/Unix platforms ([Debian](https://packages.debian.org/search?&searchon=names&keywords=python-texttable+), [FreeBSD](https://www.freebsd.org/cgi/ports.cgi?query=texttable&stype=all), Fedora, Suse...). +## Dependencies + +If available, [cjkwrap](https://github.com/fgallaire/cjkwrap) library is used instead of textwrap, for a better wrapping of CJK text. + ## Documentation ``` @@ -174,6 +178,15 @@ | | Texttable.BORDER | Texttable.HEADER | + | set_header_align(self, array) + | Set the desired header alignment + | + | - the elements of the array should be either "l", "c" or "r": + | + | * "l": column flushed left + | * "c": column centered + | * "r": column flushed right + | | set_precision(self, width) | Set the desired precision for float/exponential formats | @@ -197,10 +210,10 @@ __author__ = 'Gerome Fournier <jef(at)foutaise.org>' __credits__ = 'Jeff Kowalczyk:\n - textwrap improved import\n ...at... __license__ = 'LGPL' - __version__ = '1.1.1' + __version__ = '1.4.0' VERSION - 1.1.1 + 1.4.0 AUTHOR Gerome Fournier <jef(at)foutaise.org> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texttable-1.1.1/setup.py new/texttable-1.4.0/setup.py --- old/texttable-1.1.1/setup.py 2017-10-26 14:23:51.000000000 +0200 +++ new/texttable-1.4.0/setup.py 2018-06-22 16:17:48.000000000 +0200 @@ -19,29 +19,24 @@ DESCRIPTION = "module for creating simple ASCII tables" -LONG_DESCRIPTION = """\ -texttable is a module to generate a formatted text table, using ASCII -characters.""" +with open("README.md") as f: + LONG_DESCRIPTION = f.read() import sys from distutils.core import setup -if sys.version < '2.2.3': - from distutils.dist import DistributionMetadata - DistributionMetadata.classifiers = None - DistributionMetadata.download_url = None - setup( name = "texttable", - version = "1.1.1", + version = "1.4.0", author = "Gerome Fournier", author_email = "j...@foutaise.org", url = "https://github.com/foutaise/texttable/", - download_url = "https://github.com/foutaise/texttable/archive/v1.1.1.tar.gz", + download_url = "https://github.com/foutaise/texttable/archive/v1.4.0.tar.gz", license = "LGPL", py_modules = ["texttable"], description = DESCRIPTION, long_description = LONG_DESCRIPTION, + long_description_content_type="text/markdown", platforms = "any", classifiers = [ 'Development Status :: 4 - Beta', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texttable-1.1.1/tests.py new/texttable-1.4.0/tests.py --- old/texttable-1.1.1/tests.py 2017-10-26 14:23:51.000000000 +0200 +++ new/texttable-1.4.0/tests.py 2018-06-22 16:17:48.000000000 +0200 @@ -196,3 +196,24 @@ | a | 1s | [3] | +-----+------------+---------+ ''') + +def test_cjkwarp(): + try: + import cjkwrap + table = Texttable() + + table.set_cols_align(["r", "l"]) + table.add_rows([ + ["Name", 'Discuz! 6.x/7.x 全局变量防御绕过导致命令执行'], + ["Description", '由于php5.3.x版本里php.ini的设置里request_order默认值为GP,导致Discuz! 6.x/7.x 全局变量防御绕过漏洞'], + ], header = False) + assert clean(table.draw()) == u_dedent('''\ + +-------------+----------------------------------------------------------------+ + | Name | Discuz! 6.x/7.x 全局变量防御绕过导致命令执行 | + +-------------+----------------------------------------------------------------+ + | Description | 由于php5.3.x版本里php.ini的设置里request_order默认值为GP,导致 | + | | Discuz! 6.x/7.x 全局变量防御绕过漏洞 | + +-------------+----------------------------------------------------------------+ + ''') + except ImportError: + True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texttable-1.1.1/texttable.py new/texttable-1.4.0/texttable.py --- old/texttable-1.1.1/texttable.py 2017-10-26 14:23:51.000000000 +0200 +++ new/texttable-1.4.0/texttable.py 2018-06-22 16:17:48.000000000 +0200 @@ -76,7 +76,7 @@ __author__ = 'Gerome Fournier <jef(at)foutaise.org>' __license__ = 'LGPL' -__version__ = '1.1.1' +__version__ = '1.4.0' __credits__ = """\ Jeff Kowalczyk: - textwrap improved import @@ -105,22 +105,26 @@ """ import sys -import string import unicodedata +# define a text wrapping function to wrap some text +# to a specific width: +# - use cjkwrap if available (better CJK support) +# - fallback to textwrap otherwise try: - if sys.version_info >= (2, 3): - import textwrap - elif sys.version_info >= (2, 2): - from optparse import textwrap - else: - from optik import textwrap + import cjkwrap + def textwrapper(txt, width): + return cjkwrap.wrap(txt, width) except ImportError: - sys.stderr.write("Can't import textwrap module!\n") - raise + try: + import textwrap + def textwrapper(txt, width): + return textwrap.wrap(txt, width) + except ImportError: + sys.stderr.write("Can't import textwrap module!\n") + raise -if sys.version_info >= (2, 7): - from functools import reduce +from functools import reduce if sys.version_info >= (3, 0): unicode_type = str @@ -150,11 +154,8 @@ """ if isinstance(iterable, bytes_type) or isinstance(iterable, unicode_type): unicode_data = obj2unicode(iterable) - if hasattr(unicodedata, 'east_asian_width'): - w = unicodedata.east_asian_width - return sum([w(c) in 'WF' and 2 or (0 if unicodedata.combining(c) else 1) for c in unicode_data]) - else: - return unicode_data.__len__() + w = unicodedata.east_asian_width + return sum([w(c) in 'WF' and 2 or (0 if unicodedata.combining(c) else 1) for c in unicode_data]) else: return iterable.__len__() @@ -248,6 +249,19 @@ self._deco = deco + def set_header_align(self, array): + """Set the desired header alignment + + - the elements of the array should be either "l", "c" or "r": + + * "l": column flushed left + * "c": column centered + * "r": column flushed right + """ + + self._check_row_size(array) + self._header_align = array + def set_cols_align(self, array): """Set the desired columns alignment @@ -608,6 +622,8 @@ """Check if alignment has been specified, set default one if not """ + if not hasattr(self, "_header_align"): + self._header_align = ["c"] * self._row_size if not hasattr(self, "_align"): self._align = ["l"] * self._row_size if not hasattr(self, "_valign"): @@ -631,7 +647,7 @@ cell_line = cell[i] fill = width - len(cell_line) if isheader: - align = "c" + align = self._header_align[length - 1] if align == "r": out += fill * space + cell_line elif align == "c": @@ -658,7 +674,7 @@ if c.strip() == "": array.append("") else: - array.extend(textwrap.wrap(c, width)) + array.extend(textwrapper(c, width)) line_wrapped.append(array) max_cell_lines = reduce(max, list(map(len, line_wrapped))) for cell, valign in zip(line_wrapped, self._valign): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texttable-1.1.1/tox.ini new/texttable-1.4.0/tox.ini --- old/texttable-1.1.1/tox.ini 2017-10-26 14:23:51.000000000 +0200 +++ new/texttable-1.4.0/tox.ini 2018-06-22 16:17:48.000000000 +0200 @@ -1,8 +1,9 @@ [tox] -envlist = py27,py35,py36 +envlist = py27,py34,py35,py36 [testenv] deps = pytest pytest-cov -commands = py.test --cov-report=term-missing --cov=texttable tests.py + cjkwrap +commands = pytest --cov-report=term-missing --cov=texttable tests.py