Hello community,

here is the log from the commit of package python-oslo.serialization for 
openSUSE:Factory checked in at 2018-01-17 21:56:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-oslo.serialization (Old)
 and      /work/SRC/openSUSE:Factory/.python-oslo.serialization.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-oslo.serialization"

Wed Jan 17 21:56:45 2018 rev:9 rq:565777 version:2.21.1

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-oslo.serialization/python-oslo.serialization.changes
      2017-08-28 15:31:35.759029598 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-oslo.serialization.new/python-oslo.serialization.changes
 2018-01-17 21:56:46.939513170 +0100
@@ -1,0 +2,9 @@
+Mon Jan 15 11:59:43 UTC 2018 - [email protected]
+
+- update to version 2.21.1
+  - Update reno for stable/pike
+  - warn developers when can't convert value into primitive
+  - Updated from global requirements
+  - jsonutils.to_primitive(): add fallback parameter
+
+-------------------------------------------------------------------

Old:
----
  oslo.serialization-2.20.0.tar.gz

New:
----
  oslo.serialization-2.21.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-oslo.serialization.spec ++++++
--- /var/tmp/diff_new_pack.PHlD7N/_old  2018-01-17 21:56:48.775427293 +0100
+++ /var/tmp/diff_new_pack.PHlD7N/_new  2018-01-17 21:56:48.775427293 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-oslo.serialization
 #
-# 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
@@ -16,53 +16,61 @@
 #
 
 
-%global sname oslo.serialization
 Name:           python-oslo.serialization
-Version:        2.20.0
+Version:        2.21.1
 Release:        0
 Summary:        OpenStack serialization library
 License:        Apache-2.0
 Group:          Development/Languages/Python
-Url:            https://launchpad.net/%{sname}
-Source0:        
https://pypi.io/packages/source/o/%{sname}/%{sname}-%{version}.tar.gz
+Url:            https://launchpad.net/oslo.serialization
+Source0:        
https://files.pythonhosted.org/packages/source/o/oslo.serialization/oslo.serialization-2.21.1.tar.gz
 BuildRequires:  openstack-macros
 BuildRequires:  python-devel
-BuildRequires:  python-ipaddress >= 1.0.7
-BuildRequires:  python-mock >= 2.0
-BuildRequires:  python-msgpack-python >= 0.4.0
-BuildRequires:  python-netaddr >= 0.7.13
-BuildRequires:  python-oslo.i18n >= 2.1.0
-BuildRequires:  python-oslo.utils >= 3.20.0
-BuildRequires:  python-oslotest >= 1.10.0
-BuildRequires:  python-pbr >= 2.0.0
+BuildRequires:  python2-ipaddress >= 1.0.16
+BuildRequires:  python2-mock >= 2.0.0
+BuildRequires:  python2-msgpack-python >= 0.4.0
+BuildRequires:  python2-netaddr >= 0.7.18
+BuildRequires:  python2-oslo.i18n >= 3.15.3
+BuildRequires:  python2-oslo.utils >= 3.31.0
+BuildRequires:  python2-oslotest >= 1.10.0
+BuildRequires:  python2-pbr >= 2.0.0
+BuildRequires:  python3-devel
+BuildRequires:  python3-mock >= 2.0.0
+BuildRequires:  python3-msgpack-python >= 0.4.0
+BuildRequires:  python3-netaddr >= 0.7.18
+BuildRequires:  python3-oslo.i18n >= 3.15.3
+BuildRequires:  python3-oslo.utils >= 3.31.0
+BuildRequires:  python3-oslotest >= 1.10.0
+BuildRequires:  python3-pbr >= 2.0.0
 Requires:       python-msgpack-python >= 0.4.0
-Requires:       python-oslo.utils >= 3.20.0
+Requires:       python-oslo.utils >= 3.31.0
 Requires:       python-pytz >= 2013.6
-Requires:       python-six >= 1.9.0
+Requires:       python-six >= 1.10.0
 BuildArch:      noarch
+%python_subpackages
 
 %description
 The oslo.serialization library provides support for representing objects
 in transmittable and storable formats, such as Base64, JSON and MessagePack.
 
-%package doc
+%package -n python-oslo.serialization-doc
 Summary:        Documentation for OpenStack serialization library
 Group:          Development/Languages/Python
 BuildRequires:  python-Sphinx
-BuildRequires:  python-openstackdocstheme >= 1.11.0
+BuildRequires:  python-openstackdocstheme >= 1.17.0
 
-%description doc
+%description -n python-oslo.serialization-doc
 The oslo.serialization library provides support for representing objects
 in transmittable and storable formats, such as Base64, JSON and MessagePack.
 This package contains the documentation.
 
 %prep
-%autosetup -n %{sname}-%{version}
+%autosetup -p1 -n oslo.serialization-2.21.1
 %py_req_cleanup
 sed -i 's/^warning-is-error.*/warning-is-error = 0/g' setup.cfg
 
 %build
-%{py2_build}
+%{python_build}
 
 # generate html docs
 %{__python2} setup.py build_sphinx
@@ -70,18 +78,20 @@
 rm -rf doc/build/html/.{doctrees,buildinfo}
 
 %install
-%{py2_install}
+%{python_install}
 
 %check
-%{__python2} setup.py test
+%{python_expand rm -rf .testrepository
+$python setup.py test
+}
 
-%files
+%files %{python_files}
 %license LICENSE
 %doc README.rst ChangeLog
-%{python2_sitelib}/oslo_serialization
-%{python2_sitelib}/*.egg-info
+%{python_sitelib}/oslo_serialization
+%{python_sitelib}/*.egg-info
 
-%files doc
+%files -n python-oslo.serialization-doc
 %license LICENSE
 %doc doc/build/html
 

++++++ _service ++++++
--- /var/tmp/diff_new_pack.PHlD7N/_old  2018-01-17 21:56:48.823425048 +0100
+++ /var/tmp/diff_new_pack.PHlD7N/_new  2018-01-17 21:56:48.827424861 +0100
@@ -1,8 +1,8 @@
 <services>
   <service mode="disabled" name="renderspec">
-    <param 
name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/pike/openstack/oslo.serialization/oslo.serialization.spec.j2</param>
+    <param 
name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/master/openstack/oslo.serialization/oslo.serialization.spec.j2</param>
     <param name="output-name">python-oslo.serialization.spec</param>
-    <param 
name="requirements">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/pike/global-requirements.txt</param>
+    <param 
name="requirements">https://raw.githubusercontent.com/openstack/rpm-packaging/master/requirements.txt</param>
     <param name="changelog-email">[email protected]</param>
     <param name="changelog-provider">gh,openstack,oslo.serialization</param>
   </service>

++++++ oslo.serialization-2.20.0.tar.gz -> oslo.serialization-2.21.1.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/oslo.serialization-2.20.0/ChangeLog 
new/oslo.serialization-2.21.1/ChangeLog
--- old/oslo.serialization-2.20.0/ChangeLog     2017-07-18 15:11:29.000000000 
+0200
+++ new/oslo.serialization-2.21.1/ChangeLog     2017-10-04 16:06:17.000000000 
+0200
@@ -1,6 +1,21 @@
 CHANGES
 =======
 
+2.21.1
+------
+
+* jsonutils.to\_primitive(): add fallback parameter
+
+2.21.0
+------
+
+* Updated from global requirements
+* warn developers when can't convert value into primitive
+* Updated from global requirements
+* Updated from global requirements
+* Update reno for stable/pike
+* Updated from global requirements
+
 2.20.0
 ------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/oslo.serialization-2.20.0/PKG-INFO 
new/oslo.serialization-2.21.1/PKG-INFO
--- old/oslo.serialization-2.20.0/PKG-INFO      2017-07-18 15:11:29.000000000 
+0200
+++ new/oslo.serialization-2.21.1/PKG-INFO      2017-10-04 16:06:18.000000000 
+0200
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: oslo.serialization
-Version: 2.20.0
+Version: 2.21.1
 Summary: Oslo Serialization library
 Home-page: http://docs.openstack.org/developer/oslo.serialization/
 Author: OpenStack
 Author-email: [email protected]
 License: UNKNOWN
+Description-Content-Type: UNKNOWN
 Description: ========================
         Team and repository tags
         ========================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/oslo.serialization-2.20.0/oslo.serialization.egg-info/PKG-INFO 
new/oslo.serialization-2.21.1/oslo.serialization.egg-info/PKG-INFO
--- old/oslo.serialization-2.20.0/oslo.serialization.egg-info/PKG-INFO  
2017-07-18 15:11:29.000000000 +0200
+++ new/oslo.serialization-2.21.1/oslo.serialization.egg-info/PKG-INFO  
2017-10-04 16:06:17.000000000 +0200
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: oslo.serialization
-Version: 2.20.0
+Version: 2.21.1
 Summary: Oslo Serialization library
 Home-page: http://docs.openstack.org/developer/oslo.serialization/
 Author: OpenStack
 Author-email: [email protected]
 License: UNKNOWN
+Description-Content-Type: UNKNOWN
 Description: ========================
         Team and repository tags
         ========================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/oslo.serialization-2.20.0/oslo.serialization.egg-info/SOURCES.txt 
new/oslo.serialization-2.21.1/oslo.serialization.egg-info/SOURCES.txt
--- old/oslo.serialization-2.20.0/oslo.serialization.egg-info/SOURCES.txt       
2017-07-18 15:11:29.000000000 +0200
+++ new/oslo.serialization-2.21.1/oslo.serialization.egg-info/SOURCES.txt       
2017-10-04 16:06:18.000000000 +0200
@@ -43,6 +43,7 @@
 releasenotes/source/conf.py
 releasenotes/source/index.rst
 releasenotes/source/ocata.rst
+releasenotes/source/pike.rst
 releasenotes/source/unreleased.rst
 releasenotes/source/_static/.placeholder
 releasenotes/source/_templates/.placeholder
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/oslo.serialization-2.20.0/oslo.serialization.egg-info/pbr.json 
new/oslo.serialization-2.21.1/oslo.serialization.egg-info/pbr.json
--- old/oslo.serialization-2.20.0/oslo.serialization.egg-info/pbr.json  
2017-07-18 15:11:29.000000000 +0200
+++ new/oslo.serialization-2.21.1/oslo.serialization.egg-info/pbr.json  
2017-10-04 16:06:17.000000000 +0200
@@ -1 +1 @@
-{"git_version": "bbee6d1", "is_release": true}
\ No newline at end of file
+{"git_version": "cdb2f60", "is_release": true}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/oslo.serialization-2.20.0/oslo.serialization.egg-info/requires.txt 
new/oslo.serialization-2.21.1/oslo.serialization.egg-info/requires.txt
--- old/oslo.serialization-2.20.0/oslo.serialization.egg-info/requires.txt      
2017-07-18 15:11:29.000000000 +0200
+++ new/oslo.serialization-2.21.1/oslo.serialization.egg-info/requires.txt      
2017-10-04 16:06:17.000000000 +0200
@@ -1,5 +1,5 @@
 pbr!=2.1.0,>=2.0.0
 six>=1.9.0
 msgpack-python>=0.4.0
-oslo.utils>=3.20.0
+oslo.utils>=3.28.0
 pytz>=2013.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/oslo.serialization-2.20.0/oslo_serialization/jsonutils.py 
new/oslo.serialization-2.21.1/oslo_serialization/jsonutils.py
--- old/oslo.serialization-2.20.0/oslo_serialization/jsonutils.py       
2017-07-18 15:09:01.000000000 +0200
+++ new/oslo.serialization-2.21.1/oslo_serialization/jsonutils.py       
2017-10-04 16:03:51.000000000 +0200
@@ -36,6 +36,7 @@
 import itertools
 import json
 import uuid
+import warnings
 
 from oslo_utils import encodeutils
 from oslo_utils import importutils
@@ -57,7 +58,8 @@
 
 
 def to_primitive(value, convert_instances=False, convert_datetime=True,
-                 level=0, max_depth=3, encoding='utf-8'):
+                 level=0, max_depth=3, encoding='utf-8',
+                 fallback=None):
     """Convert a complex object into primitives.
 
     Handy for JSON serialization. We can optionally handle instances,
@@ -70,12 +72,22 @@
 
     Therefore, ``convert_instances=True`` is lossy ... be aware.
 
+    If the object cannot be converted to primitive, it is returned unchanged
+    if fallback is not set, return fallback(value) otherwise.
+
+    .. versionchanged:: 2.22
+       Added *fallback* parameter.
+
     .. versionchanged:: 1.3
        Support UUID encoding.
 
     .. versionchanged:: 1.6
        Dictionary keys are now also encoded.
     """
+    orig_fallback = fallback
+    if fallback is None:
+        fallback = six.text_type
+
     # handle obvious types first - order of basic types determined by running
     # full tests on nova project, resulting in the following counts:
     # 572754 <type 'NoneType'>
@@ -123,10 +135,10 @@
     # value of itertools.count doesn't get caught by nasty_type_tests
     # and results in infinite loop when list(value) is called.
     if type(value) == itertools.count:
-        return six.text_type(value)
+        return fallback(value)
 
     if any(test(value) for test in _nasty_type_tests):
-        return six.text_type(value)
+        return fallback(value)
 
     # FIXME(vish): Workaround for LP bug 852095. Without this workaround,
     #              tests that raise an exception in a mocked method that
@@ -147,7 +159,8 @@
                                       convert_datetime=convert_datetime,
                                       level=level,
                                       max_depth=max_depth,
-                                      encoding=encoding)
+                                      encoding=encoding,
+                                      fallback=orig_fallback)
         if isinstance(value, dict):
             return {recursive(k): recursive(v)
                     for k, v in value.items()}
@@ -165,8 +178,14 @@
     except TypeError:
         # Class objects are tricky since they may define something like
         # __iter__ defined but it isn't callable as list().
-        return six.text_type(value)
+        return fallback(value)
+
+    if orig_fallback is not None:
+        return orig_fallback(value)
 
+    # TODO(gcb) raise ValueError in version 3.0
+    warnings.warn("Cannot convert %r to primitive, will raise ValueError "
+                  "instead of warning in version 3.0" % (value,))
     return value
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/oslo.serialization-2.20.0/oslo_serialization/tests/test_jsonutils.py 
new/oslo.serialization-2.21.1/oslo_serialization/tests/test_jsonutils.py
--- old/oslo.serialization-2.20.0/oslo_serialization/tests/test_jsonutils.py    
2017-07-18 15:09:01.000000000 +0200
+++ new/oslo.serialization-2.21.1/oslo_serialization/tests/test_jsonutils.py    
2017-10-04 16:03:51.000000000 +0200
@@ -15,7 +15,9 @@
 
 import collections
 import datetime
+import functools
 import ipaddress
+import itertools
 import json
 
 import mock
@@ -28,6 +30,11 @@
 from oslo_serialization import jsonutils
 
 
+class ReprObject(object):
+    def __repr__(self):
+        return 'repr'
+
+
 class JSONUtilsTestMixin(object):
 
     json_impl = None
@@ -46,6 +53,11 @@
     def test_dumps(self):
         self.assertEqual('{"a": "b"}', jsonutils.dumps({'a': 'b'}))
 
+    def test_dumps_default(self):
+        args = [ReprObject()]
+        convert = functools.partial(jsonutils.to_primitive, fallback=repr)
+        self.assertEqual('["repr"]', jsonutils.dumps(args, default=convert))
+
     def test_dump_as_bytes(self):
         self.assertEqual(b'{"a": "b"}', jsonutils.dump_as_bytes({'a': 'b'}))
 
@@ -243,7 +255,8 @@
         p = jsonutils.to_primitive(x)
         self.assertEqual({'a': 1, 'b': 2, 'c': 3}, p)
 
-    def test_instance(self):
+    @mock.patch('warnings.warn')
+    def test_instance(self, warn_mock):
         class MysteryClass(object):
             a = 10
 
@@ -255,6 +268,7 @@
                          jsonutils.to_primitive(x, convert_instances=True))
 
         self.assertEqual(x, jsonutils.to_primitive(x))
+        warn_mock.assert_called_once()
 
     def test_typeerror(self):
         x = bytearray  # Class, not instance
@@ -336,3 +350,54 @@
         msg = msg % {'param': 'hello'}
         ret = jsonutils.to_primitive(msg)
         self.assertEqual(msg, ret)
+
+    def test_fallback(self):
+        obj = ReprObject()
+
+        ret = jsonutils.to_primitive(obj)
+        self.assertIs(obj, ret)
+
+        ret = jsonutils.to_primitive(obj, fallback=repr)
+        self.assertEqual('repr', ret)
+
+    def test_fallback_list(self):
+        obj = ReprObject()
+        obj_list = [obj]
+
+        ret = jsonutils.to_primitive(obj_list)
+        self.assertEqual([obj], ret)
+
+        ret = jsonutils.to_primitive(obj_list, fallback=repr)
+        self.assertEqual(['repr'], ret)
+
+    def test_fallback_itertools_count(self):
+        obj = itertools.count(1)
+
+        ret = jsonutils.to_primitive(obj)
+        self.assertEqual(six.text_type(obj), ret)
+
+        ret = jsonutils.to_primitive(obj, fallback=lambda _: 'itertools_count')
+        self.assertEqual('itertools_count', ret)
+
+    def test_fallback_nasty(self):
+        obj = int
+        ret = jsonutils.to_primitive(obj)
+        self.assertEqual(six.text_type(obj), ret)
+
+        def formatter(typeobj):
+            return 'type:%s' % typeobj.__name__
+        ret = jsonutils.to_primitive(obj, fallback=formatter)
+        self.assertEqual("type:int", ret)
+
+    def test_fallback_typeerror(self):
+        class NotIterable(object):
+            # __iter__ is not callable, cause a TypeError in to_primitive()
+            __iter__ = None
+
+        obj = NotIterable()
+
+        ret = jsonutils.to_primitive(obj)
+        self.assertEqual(six.text_type(obj), ret)
+
+        ret = jsonutils.to_primitive(obj, fallback=lambda _: 'fallback')
+        self.assertEqual('fallback', ret)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/oslo.serialization-2.20.0/releasenotes/source/index.rst 
new/oslo.serialization-2.21.1/releasenotes/source/index.rst
--- old/oslo.serialization-2.20.0/releasenotes/source/index.rst 2017-07-18 
15:09:00.000000000 +0200
+++ new/oslo.serialization-2.21.1/releasenotes/source/index.rst 2017-10-04 
16:03:51.000000000 +0200
@@ -6,4 +6,5 @@
    :maxdepth: 1
 
    unreleased
+   pike
    ocata
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/oslo.serialization-2.20.0/releasenotes/source/pike.rst 
new/oslo.serialization-2.21.1/releasenotes/source/pike.rst
--- old/oslo.serialization-2.20.0/releasenotes/source/pike.rst  1970-01-01 
01:00:00.000000000 +0100
+++ new/oslo.serialization-2.21.1/releasenotes/source/pike.rst  2017-10-04 
16:03:51.000000000 +0200
@@ -0,0 +1,6 @@
+===================================
+ Pike Series Release Notes
+===================================
+
+.. release-notes::
+   :branch: stable/pike
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/oslo.serialization-2.20.0/requirements.txt 
new/oslo.serialization-2.21.1/requirements.txt
--- old/oslo.serialization-2.20.0/requirements.txt      2017-07-18 
15:09:00.000000000 +0200
+++ new/oslo.serialization-2.21.1/requirements.txt      2017-10-04 
16:03:51.000000000 +0200
@@ -10,5 +10,5 @@
 pbr!=2.1.0,>=2.0.0 # Apache-2.0
 six>=1.9.0 # MIT
 msgpack-python>=0.4.0 # Apache-2.0
-oslo.utils>=3.20.0 # Apache-2.0
+oslo.utils>=3.28.0 # Apache-2.0
 pytz>=2013.6 # MIT
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/oslo.serialization-2.20.0/test-requirements.txt 
new/oslo.serialization-2.21.1/test-requirements.txt
--- old/oslo.serialization-2.20.0/test-requirements.txt 2017-07-18 
15:09:00.000000000 +0200
+++ new/oslo.serialization-2.21.1/test-requirements.txt 2017-10-04 
16:03:51.000000000 +0200
@@ -2,15 +2,15 @@
 # of appearance. Changing the order has an impact on the overall integration
 # process, which may cause wedges in the gate later.
 hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
-ipaddress>=1.0.7;python_version<'3.3' # PSF
-mock>=2.0 # BSD
-netaddr!=0.7.16,>=0.7.13 # BSD
+ipaddress>=1.0.16;python_version<'3.3' # PSF
+mock>=2.0.0 # BSD
+netaddr>=0.7.18 # BSD
 
 # this is required for the docs build jobs
 sphinx>=1.6.2 # BSD
-openstackdocstheme>=1.11.0 # Apache-2.0
+openstackdocstheme>=1.17.0 # Apache-2.0
 
 oslotest>=1.10.0 # Apache-2.0
-oslo.i18n!=3.15.2,>=2.1.0 # Apache-2.0
+oslo.i18n>=3.15.3 # Apache-2.0
 coverage!=4.4,>=4.0 # Apache-2.0
-reno!=2.3.1,>=1.8.0 # Apache-2.0
+reno>=2.5.0 # Apache-2.0


Reply via email to