Hello community, here is the log from the commit of package python-oslo.utils for openSUSE:Factory checked in at 2018-01-17 21:56:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-oslo.utils (Old) and /work/SRC/openSUSE:Factory/.python-oslo.utils.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-oslo.utils" Wed Jan 17 21:56:30 2018 rev:13 rq:565767 version:3.34.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-oslo.utils/python-oslo.utils.changes 2018-01-06 18:48:29.301196633 +0100 +++ /work/SRC/openSUSE:Factory/.python-oslo.utils.new/python-oslo.utils.changes 2018-01-17 21:56:33.672133766 +0100 @@ -1,0 +2,13 @@ +Mon Jan 15 12:01:36 UTC 2018 - [email protected] + +- update to version 3.34.0 + - Follow the new PTI for document build + - Add method validate_integer + - improve docstring for last_bytes() + - Add method to escape ipv6 ip addresses + - Add missing information in docstring of validate_integer + - Add method last_bytes in fileutils + - Cleanup test-requirements + - Updated from global requirements + +------------------------------------------------------------------- Old: ---- oslo.utils-3.32.0.tar.gz New: ---- oslo.utils-3.34.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-oslo.utils.spec ++++++ --- /var/tmp/diff_new_pack.1aWeVI/_old 2018-01-17 21:56:34.232107573 +0100 +++ /var/tmp/diff_new_pack.1aWeVI/_new 2018-01-17 21:56:34.236107385 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-oslo.utils # -# 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,15 +17,16 @@ Name: python-oslo.utils -Version: 3.32.0 +Version: 3.34.0 Release: 0 Summary: OpenStack Utils Library License: Apache-2.0 Group: Development/Languages/Python Url: https://launchpad.net/oslo.utils -Source0: https://files.pythonhosted.org/packages/source/o/oslo.utils/oslo.utils-3.32.0.tar.gz +Source0: https://files.pythonhosted.org/packages/source/o/oslo.utils/oslo.utils-3.34.0.tar.gz BuildRequires: openstack-macros BuildRequires: python2-Babel +BuildRequires: python2-ddt BuildRequires: python2-debtcollector BuildRequires: python2-fixtures >= 3.0.0 BuildRequires: python2-iso8601 @@ -42,6 +43,7 @@ BuildRequires: python2-testscenarios BuildRequires: python2-testtools BuildRequires: python3-Babel +BuildRequires: python3-ddt BuildRequires: python3-debtcollector BuildRequires: python3-fixtures >= 3.0.0 BuildRequires: python3-iso8601 @@ -83,7 +85,7 @@ Documentation for OpenStack utils library. %prep -%autosetup -p1 -n oslo.utils-3.32.0 +%autosetup -p1 -n oslo.utils-3.34.0 sed -i 's/^warning-is-error.*/warning-is-error = 0/g' setup.cfg %py_req_cleanup @@ -98,8 +100,6 @@ # remove the sphinx-build leftovers rm -rf doc/build/html/.{doctrees,buildinfo} -%check - %files %{python_files} %license LICENSE %doc ChangeLog README.rst ++++++ oslo.utils-3.32.0.tar.gz -> oslo.utils-3.34.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/AUTHORS new/oslo.utils-3.34.0/AUTHORS --- old/oslo.utils-3.32.0/AUTHORS 2017-12-04 11:38:16.000000000 +0100 +++ new/oslo.utils-3.34.0/AUTHORS 2018-01-08 15:14:46.000000000 +0100 @@ -35,6 +35,7 @@ Davanum Srinivas <[email protected]> Davanum Srinivas <[email protected]> David Stanek <[email protected]> +Derek Higgins <[email protected]> Dina Belova <[email protected]> Dirk Mueller <[email protected]> Dmitry Mescheryakov <[email protected]> @@ -120,6 +121,7 @@ Zhongyue Luo <[email protected]> Zuul <[email protected]> avnish <[email protected]> +bhagyashris <[email protected]> dharmendra <[email protected]> ekudryashova <[email protected]> gecong1973 <[email protected]> @@ -129,6 +131,7 @@ lin-hua-cheng <[email protected]> lingyongxu <[email protected]> lvdongbing <[email protected]> +malei <[email protected]> melissaml <[email protected]> paul-carlton2 <[email protected]> pran1990 <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/ChangeLog new/oslo.utils-3.34.0/ChangeLog --- old/oslo.utils-3.32.0/ChangeLog 2017-12-04 11:38:16.000000000 +0100 +++ new/oslo.utils-3.34.0/ChangeLog 2018-01-08 15:14:46.000000000 +0100 @@ -1,6 +1,20 @@ CHANGES ======= +3.34.0 +------ + +* Updated from global requirements +* Cleanup test-requirements +* improve docstring for last\_bytes() +* Add method last\_bytes in fileutils +* Follow the new PTI for document build +* Add missing information in docstring of validate\_integer + +3.33.0 +------ + + 3.32.0 ------ @@ -14,6 +28,7 @@ * Add method to compute a file's checksum to fileutils * Imported Translations from Zanata +* Add method validate\_integer 3.30.0 ------ @@ -27,6 +42,7 @@ ------ * Imported Translations from Zanata +* Add method to escape ipv6 ip addresses * Updated from global requirements * Update reno for stable/pike * Updated from global requirements diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/PKG-INFO new/oslo.utils-3.34.0/PKG-INFO --- old/oslo.utils-3.32.0/PKG-INFO 2017-12-04 11:38:17.000000000 +0100 +++ new/oslo.utils-3.34.0/PKG-INFO 2018-01-08 15:14:46.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: oslo.utils -Version: 3.32.0 +Version: 3.34.0 Summary: Oslo Utility library Home-page: https://docs.openstack.org/oslo.utils/latest/ Author: OpenStack diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/doc/requirements.txt new/oslo.utils-3.34.0/doc/requirements.txt --- old/oslo.utils-3.32.0/doc/requirements.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/oslo.utils-3.34.0/doc/requirements.txt 2018-01-08 15:12:19.000000000 +0100 @@ -0,0 +1,8 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. +# this is required for the docs build jobs +sphinx>=1.6.2 # BSD +openstackdocstheme>=1.17.0 # Apache-2.0 +reno>=2.5.0 # Apache-2.0 +fixtures>=3.0.0 # Apache-2.0/BSD diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/oslo.utils.egg-info/PKG-INFO new/oslo.utils-3.34.0/oslo.utils.egg-info/PKG-INFO --- old/oslo.utils-3.32.0/oslo.utils.egg-info/PKG-INFO 2017-12-04 11:38:16.000000000 +0100 +++ new/oslo.utils-3.34.0/oslo.utils.egg-info/PKG-INFO 2018-01-08 15:14:46.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: oslo.utils -Version: 3.32.0 +Version: 3.34.0 Summary: Oslo Utility library Home-page: https://docs.openstack.org/oslo.utils/latest/ Author: OpenStack diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/oslo.utils.egg-info/SOURCES.txt new/oslo.utils-3.34.0/oslo.utils.egg-info/SOURCES.txt --- old/oslo.utils-3.32.0/oslo.utils.egg-info/SOURCES.txt 2017-12-04 11:38:17.000000000 +0100 +++ new/oslo.utils-3.34.0/oslo.utils.egg-info/SOURCES.txt 2018-01-08 15:14:46.000000000 +0100 @@ -13,6 +13,7 @@ setup.py test-requirements.txt tox.ini +doc/requirements.txt doc/source/conf.py doc/source/index.rst doc/source/contributor/index.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/oslo.utils.egg-info/pbr.json new/oslo.utils-3.34.0/oslo.utils.egg-info/pbr.json --- old/oslo.utils-3.32.0/oslo.utils.egg-info/pbr.json 2017-12-04 11:38:16.000000000 +0100 +++ new/oslo.utils-3.34.0/oslo.utils.egg-info/pbr.json 2018-01-08 15:14:46.000000000 +0100 @@ -1 +1 @@ -{"git_version": "464a948", "is_release": true} \ No newline at end of file +{"git_version": "d9ec025", "is_release": true} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/oslo_utils/fileutils.py new/oslo.utils-3.34.0/oslo_utils/fileutils.py --- old/oslo.utils-3.32.0/oslo_utils/fileutils.py 2017-12-04 11:35:47.000000000 +0100 +++ new/oslo.utils-3.34.0/oslo_utils/fileutils.py 2018-01-08 15:12:19.000000000 +0100 @@ -124,3 +124,34 @@ for chunk in iter(lambda: f.read(read_chunksize), b''): checksum.update(chunk) return checksum.hexdigest() + + +def last_bytes(path, num): + """Return num bytes from the end of the file and unread byte count. + + Returns a tuple containing some content from the file and the + number of bytes that appear in the file before the point at which + reading started. The content will be at most ``num`` bytes, taken + from the end of the file. If the file is smaller than ``num`` + bytes the entire content of the file is returned. + + :param path: The file path to read + :param num: The number of bytes to return + + :returns: (data, unread_bytes) + + """ + + with open(path, 'rb') as fp: + try: + fp.seek(-num, os.SEEK_END) + except IOError as e: + # seek() fails with EINVAL when trying to go before the start of + # the file. It means that num is larger than the file size, so + # just go to the start. + if e.errno == errno.EINVAL: + fp.seek(0, os.SEEK_SET) + else: + raise + unread_bytes = fp.tell() + return (fp.read(), unread_bytes) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/oslo_utils/netutils.py new/oslo.utils-3.34.0/oslo_utils/netutils.py --- old/oslo.utils-3.32.0/oslo_utils/netutils.py 2017-12-04 11:35:47.000000000 +0100 +++ new/oslo.utils-3.34.0/oslo_utils/netutils.py 2018-01-08 15:12:19.000000000 +0100 @@ -217,6 +217,20 @@ return _IS_IPV6_ENABLED +def escape_ipv6(address): + """Escape an IP address in square brackets if IPv6 + + :param address: address to optionaly escape + :type address: string + :returns: string + + .. versionadded:: 3.29.0 + """ + if is_valid_ipv6(address): + return "[%s]" % address + return address + + def is_valid_ip(address): """Verify that address represents a valid IP address. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/oslo_utils/strutils.py new/oslo.utils-3.34.0/oslo_utils/strutils.py --- old/oslo.utils-3.32.0/oslo_utils/strutils.py 2017-12-04 11:35:47.000000000 +0100 +++ new/oslo.utils-3.34.0/oslo_utils/strutils.py 2018-01-08 15:12:19.000000000 +0100 @@ -438,6 +438,38 @@ raise ValueError(msg) +def validate_integer(value, name, min_value=None, max_value=None): + """Make sure that value is a valid integer, potentially within range. + + :param value: value of the integer + :param name: name of the integer + :param min_value: min_value of the integer + :param max_value: max_value of the integer + :returns: integer + :raises: ValueError if value is an invalid integer + + .. versionadded:: 3.33 + """ + try: + value = int(str(value)) + except (ValueError, UnicodeEncodeError): + msg = _('%(value_name)s must be an integer' + ) % {'value_name': name} + raise ValueError(msg) + + if min_value is not None and value < min_value: + msg = _('%(value_name)s must be >= %(min_value)d' + ) % {'value_name': name, 'min_value': min_value} + raise ValueError(msg) + + if max_value is not None and value > max_value: + msg = _('%(value_name)s must be <= %(max_value)d' + ) % {'value_name': name, 'max_value': max_value} + raise ValueError(msg) + + return value + + def split_path(path, minsegs=1, maxsegs=None, rest_with_last=False): """Validate and split the given HTTP request path. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/oslo_utils/tests/test_fileutils.py new/oslo.utils-3.34.0/oslo_utils/tests/test_fileutils.py --- old/oslo.utils-3.32.0/oslo_utils/tests/test_fileutils.py 2017-12-04 11:35:47.000000000 +0100 +++ new/oslo.utils-3.34.0/oslo_utils/tests/test_fileutils.py 2018-01-08 15:12:19.000000000 +0100 @@ -244,3 +244,29 @@ def test_generic_io_error(self): tempdir = tempfile.mkdtemp() self.assertRaises(IOError, fileutils.compute_file_checksum, tempdir) + + +class LastBytesTestCase(test_base.BaseTestCase): + """Test the last_bytes() utility method.""" + + def setUp(self): + super(LastBytesTestCase, self).setUp() + self.content = b'1234567890' + + def test_truncated(self): + res = fileutils.write_to_tempfile(self.content) + self.assertTrue(os.path.exists(res)) + out, unread_bytes = fileutils.last_bytes(res, 5) + self.assertEqual(b'67890', out) + self.assertGreater(unread_bytes, 0) + + def test_read_all(self): + res = fileutils.write_to_tempfile(self.content) + self.assertTrue(os.path.exists(res)) + out, unread_bytes = fileutils.last_bytes(res, 1000) + self.assertEqual(b'1234567890', out) + self.assertEqual(0, unread_bytes) + + def test_non_exist_file(self): + self.assertRaises(IOError, fileutils.last_bytes, + 'non_exist_file', 1000) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/oslo_utils/tests/test_netutils.py new/oslo.utils-3.34.0/oslo_utils/tests/test_netutils.py --- old/oslo.utils-3.32.0/oslo_utils/tests/test_netutils.py 2017-12-04 11:35:47.000000000 +0100 +++ new/oslo.utils-3.34.0/oslo_utils/tests/test_netutils.py 2018-01-08 15:12:19.000000000 +0100 @@ -172,6 +172,10 @@ self.assertFalse(netutils.is_valid_ipv6('')) + def test_escape_ipv6(self): + self.assertEqual('[1234::1234]', netutils.escape_ipv6('1234::1234')) + self.assertEqual('127.0.0.1', netutils.escape_ipv6('127.0.0.1')) + def test_is_valid_ip(self): self.assertTrue(netutils.is_valid_ip('127.0.0.1')) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/oslo_utils/tests/test_strutils.py new/oslo.utils-3.34.0/oslo_utils/tests/test_strutils.py --- old/oslo.utils-3.32.0/oslo_utils/tests/test_strutils.py 2017-12-04 11:35:47.000000000 +0100 +++ new/oslo.utils-3.34.0/oslo_utils/tests/test_strutils.py 2018-01-08 15:12:02.000000000 +0100 @@ -18,6 +18,7 @@ import copy import math +import ddt import mock from oslotest import base as test_base import six @@ -804,3 +805,35 @@ def test_with_escaped_quotes_in_row_inside_quoted(self): self.check(['a"b""c', 'd'], r'"a\"b\"\"c",d') + + [email protected] +class ValidateIntegerTestCase(test_base.BaseTestCase): + + @ddt.unpack + @ddt.data({"value": 42, "name": "answer", "output": 42}, + {"value": "42", "name": "answer", "output": 42}, + {"value": "7", "name": "lucky", "output": 7, + "min_value": 7, "max_value": 8}, + {"value": 7, "name": "lucky", "output": 7, + "min_value": 6, "max_value": 7}, + {"value": 300, "name": "Spartaaa!!!", "output": 300, + "min_value": 300}, + {"value": "300", "name": "Spartaaa!!!", "output": 300, + "max_value": 300}) + def test_valid_inputs(self, output, value, name, **kwargs): + self.assertEqual(strutils.validate_integer(value, name, + **kwargs), output) + + @ddt.unpack + @ddt.data({"value": "im-not-an-int", "name": ''}, + {"value": 3.14, "name": "Pie"}, + {"value": "299", "name": "Sparta no-show", + "min_value": 300, "max_value": 300}, + {"value": 55, "name": "doing 55 in a 54", + "max_value": 54}, + {"value": six.unichr(129), "name": "UnicodeError", + "max_value": 1000}) + def test_invalid_inputs(self, value, name, **kwargs): + self.assertRaises(ValueError, strutils.validate_integer, + value, name, **kwargs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/test-requirements.txt new/oslo.utils-3.34.0/test-requirements.txt --- old/oslo.utils-3.32.0/test-requirements.txt 2017-12-04 11:35:47.000000000 +0100 +++ new/oslo.utils-3.34.0/test-requirements.txt 2018-01-08 15:12:19.000000000 +0100 @@ -5,21 +5,17 @@ hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD -python-subunit>=1.0.0 # Apache-2.0/BSD testrepository>=0.0.18 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT oslotest>=1.10.0 # Apache-2.0 +ddt>=1.0.1 # MIT # when we can require tox>= 1.4, this can go into tox.ini: # [testenv:cover] # deps = {[testenv]deps} coverage coverage!=4.4,>=4.0 # Apache-2.0 -# this is required for the docs build jobs -sphinx>=1.6.2 # BSD -openstackdocstheme>=1.17.0 # Apache-2.0 - # mocking framework mock>=2.0.0 # BSD @@ -28,5 +24,3 @@ # Bandit security code scanner bandit>=1.1.0 # Apache-2.0 - -reno>=2.5.0 # Apache-2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.utils-3.32.0/tox.ini new/oslo.utils-3.34.0/tox.ini --- old/oslo.utils-3.32.0/tox.ini 2017-12-04 11:35:47.000000000 +0100 +++ new/oslo.utils-3.34.0/tox.ini 2018-01-08 15:12:19.000000000 +0100 @@ -20,7 +20,8 @@ commands = {posargs} [testenv:docs] -commands = python setup.py build_sphinx +deps = -r{toxinidir}/doc/requirements.txt +commands = sphinx-build -b html doc/source doc/build/html [testenv:cover] commands = python setup.py test --coverage --coverage-package-name=oslo_utils --testr-args='{posargs}' @@ -42,4 +43,5 @@ commands = pip-missing-reqs -d --ignore-module=oslo_utils* --ignore-module=pkg_resources --ignore-file=oslo_utils/test.py --ignore-file=oslo_utils/tests/* oslo_utils [testenv:releasenotes] +deps = -r{toxinidir}/doc/requirements.txt commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
