Hello community, here is the log from the commit of package python-jsonpatch for openSUSE:Factory checked in at 2015-02-13 08:35:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-jsonpatch (Old) and /work/SRC/openSUSE:Factory/.python-jsonpatch.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-jsonpatch" Changes: -------- --- /work/SRC/openSUSE:Factory/python-jsonpatch/python-jsonpatch.changes 2014-11-18 22:45:33.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-jsonpatch.new/python-jsonpatch.changes 2015-02-13 08:35:10.000000000 +0100 @@ -1,0 +2,15 @@ +Wed Feb 4 14:28:36 UTC 2015 - tbechtold@suse.com + +- update to version 1.9: + * bump version to 1.9 + * require jsonpointer>=1.5 + * Use ABCs instead of list/dict, fixes #33 + * Convert readme from markdown to rst for PyPI + * Added Python 3.4 and PyPy3 to the build matrix. + * bump version to 1.8 + * Fix installation of commandline scripts (fixes #31) + * raise JsonPatchException on missing patch attributes + * Add wheel as dev dependency for wheel packages +- Requires(pre) coreutils to be able to use "rm" cmd + +------------------------------------------------------------------- Old: ---- jsonpatch-1.7.tar.gz New: ---- jsonpatch-1.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-jsonpatch.spec ++++++ --- /var/tmp/diff_new_pack.LrZHBh/_old 2015-02-13 08:35:10.000000000 +0100 +++ /var/tmp/diff_new_pack.LrZHBh/_new 2015-02-13 08:35:10.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-jsonpatch # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 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,7 +17,7 @@ Name: python-jsonpatch -Version: 1.7 +Version: 1.9 Release: 0 Summary: Python - JSON-Patches License: BSD-3-Clause @@ -26,9 +26,10 @@ Source: http://pypi.python.org/packages/source/j/jsonpatch/jsonpatch-%{version}.tar.gz BuildRequires: python-devel BuildRequires: python-jsonpointer -Requires: python-jsonpointer >= 1.3 +Requires: python-jsonpointer >= 1.5 Requires(post): update-alternatives Requires(postun): update-alternatives +Requires(pre): coreutils BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} && 0%{?suse_version} <= 1110 %{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} ++++++ jsonpatch-1.7.tar.gz -> jsonpatch-1.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpatch-1.7/PKG-INFO new/jsonpatch-1.9/PKG-INFO --- old/jsonpatch-1.7/PKG-INFO 2014-07-03 22:07:40.000000000 +0200 +++ new/jsonpatch-1.9/PKG-INFO 2014-11-03 21:42:26.000000000 +0100 @@ -1,12 +1,34 @@ Metadata-Version: 1.1 Name: jsonpatch -Version: 1.7 +Version: 1.9 Summary: Apply JSON-Patches (RFC 6902) Home-page: https://github.com/stefankoegl/python-json-patch Author: Stefan Kögl Author-email: stefan@skoegl.net License: Modified BSD License -Description: UNKNOWN +Description: python-json-patch [![Build Status](https://secure.travis-ci.org/stefankoegl/python-json-patch.png?branch=master)](https://travis-ci.org/stefankoegl/python-json-patch) [![Coverage Status](https://coveralls.io/repos/stefankoegl/python-json-patch/badge.png?branch=master)](https://coveralls.io/r/stefankoegl/python-json-patch?branch=master) ![Downloads](https://pypip.in/d/jsonpatch/badge.png) ![Version](https://pypip.in/v/jsonpatch/badge.png) + ================= + Applying JSON Patches in Python + ------------------------------- + + Library to apply JSON Patches according to + [RFC 6902](http://tools.ietf.org/html/rfc6902) + + See Sourcecode for Examples + + * Website: https://github.com/stefankoegl/python-json-patch + * Repository: https://github.com/stefankoegl/python-json-patch.git + * Documentation: https://python-json-patch.readthedocs.org/ + * PyPI: https://pypi.python.org/pypi/jsonpatch + * Travis-CI: https://travis-ci.org/stefankoegl/python-json-patch + * Coveralls: https://coveralls.io/r/stefankoegl/python-json-patch + + Running external tests + ---------------------- + To run external tests (such as those from https://github.com/json-patch/json-patch-tests) use ext_test.py + + ./ext_tests.py ../json-patch-tests/tests.json + Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Console diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpatch-1.7/jsonpatch.egg-info/PKG-INFO new/jsonpatch-1.9/jsonpatch.egg-info/PKG-INFO --- old/jsonpatch-1.7/jsonpatch.egg-info/PKG-INFO 2014-07-03 22:07:40.000000000 +0200 +++ new/jsonpatch-1.9/jsonpatch.egg-info/PKG-INFO 2014-11-03 21:42:26.000000000 +0100 @@ -1,12 +1,34 @@ Metadata-Version: 1.1 Name: jsonpatch -Version: 1.7 +Version: 1.9 Summary: Apply JSON-Patches (RFC 6902) Home-page: https://github.com/stefankoegl/python-json-patch Author: Stefan Kögl Author-email: stefan@skoegl.net License: Modified BSD License -Description: UNKNOWN +Description: python-json-patch [![Build Status](https://secure.travis-ci.org/stefankoegl/python-json-patch.png?branch=master)](https://travis-ci.org/stefankoegl/python-json-patch) [![Coverage Status](https://coveralls.io/repos/stefankoegl/python-json-patch/badge.png?branch=master)](https://coveralls.io/r/stefankoegl/python-json-patch?branch=master) ![Downloads](https://pypip.in/d/jsonpatch/badge.png) ![Version](https://pypip.in/v/jsonpatch/badge.png) + ================= + Applying JSON Patches in Python + ------------------------------- + + Library to apply JSON Patches according to + [RFC 6902](http://tools.ietf.org/html/rfc6902) + + See Sourcecode for Examples + + * Website: https://github.com/stefankoegl/python-json-patch + * Repository: https://github.com/stefankoegl/python-json-patch.git + * Documentation: https://python-json-patch.readthedocs.org/ + * PyPI: https://pypi.python.org/pypi/jsonpatch + * Travis-CI: https://travis-ci.org/stefankoegl/python-json-patch + * Coveralls: https://coveralls.io/r/stefankoegl/python-json-patch + + Running external tests + ---------------------- + To run external tests (such as those from https://github.com/json-patch/json-patch-tests) use ext_test.py + + ./ext_tests.py ../json-patch-tests/tests.json + Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Console diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpatch-1.7/jsonpatch.egg-info/SOURCES.txt new/jsonpatch-1.9/jsonpatch.egg-info/SOURCES.txt --- old/jsonpatch-1.7/jsonpatch.egg-info/SOURCES.txt 2014-07-03 22:07:40.000000000 +0200 +++ new/jsonpatch-1.9/jsonpatch.egg-info/SOURCES.txt 2014-11-03 21:42:26.000000000 +0100 @@ -12,6 +12,5 @@ jsonpatch.egg-info/PKG-INFO jsonpatch.egg-info/SOURCES.txt jsonpatch.egg-info/dependency_links.txt -jsonpatch.egg-info/entry_points.txt jsonpatch.egg-info/requires.txt jsonpatch.egg-info/top_level.txt \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpatch-1.7/jsonpatch.egg-info/entry_points.txt new/jsonpatch-1.9/jsonpatch.egg-info/entry_points.txt --- old/jsonpatch-1.7/jsonpatch.egg-info/entry_points.txt 2014-07-03 22:07:40.000000000 +0200 +++ new/jsonpatch-1.9/jsonpatch.egg-info/entry_points.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -[console_scripts] -jsonpatch = jsonpatch:main -jsondiff = jsondiff:main - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpatch-1.7/jsonpatch.egg-info/requires.txt new/jsonpatch-1.9/jsonpatch.egg-info/requires.txt --- old/jsonpatch-1.7/jsonpatch.egg-info/requires.txt 2014-07-03 22:07:40.000000000 +0200 +++ new/jsonpatch-1.9/jsonpatch.egg-info/requires.txt 2014-11-03 21:42:26.000000000 +0100 @@ -1 +1 @@ -jsonpointer>=1.3 \ No newline at end of file +jsonpointer>=1.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpatch-1.7/jsonpatch.py new/jsonpatch-1.9/jsonpatch.py --- old/jsonpatch-1.7/jsonpatch.py 2014-07-03 22:03:46.000000000 +0200 +++ new/jsonpatch-1.9/jsonpatch.py 2014-11-03 18:49:38.000000000 +0100 @@ -42,11 +42,16 @@ import json import sys +try: + from collections.abc import MutableMapping, MutableSequence +except ImportError: + from collections import MutableMapping, MutableSequence + from jsonpointer import JsonPointer, JsonPointerException # Will be parsed by setup.py to determine package metadata __author__ = 'Stefan Kögl <stefan@skoegl.net>' -__version__ = '1.7' +__version__ = '1.9' __website__ = 'https://github.com/stefankoegl/python-json-patch' __license__ = 'Modified BSD License' @@ -60,6 +65,10 @@ """Base Json Patch exception""" +class InvalidJsonPatch(JsonPatchException): + """ Raised if an invalid JSON Patch is created """ + + class JsonPatchConflict(JsonPatchException): """Raised if patch could not be applied due to conflict situation such as: - attempt to add object key then it already exists; @@ -279,10 +288,12 @@ def compare_values(path, value, other): if value == other: return - if isinstance(value, dict) and isinstance(other, dict): + if isinstance(value, MutableMapping) and \ + isinstance(other, MutableMapping): for operation in compare_dicts(path, value, other): yield operation - elif isinstance(value, list) and isinstance(other, list): + elif isinstance(value, MutableSequence) and \ + isinstance(other, MutableSequence): for operation in compare_lists(path, value, other): yield operation else: @@ -341,15 +352,15 @@ def _get_operation(self, operation): if 'op' not in operation: - raise JsonPatchException("Operation does not contain 'op' member") + raise InvalidJsonPatch("Operation does not contain 'op' member") op = operation['op'] if not isinstance(op, basestring): - raise JsonPatchException("Operation must be a string") + raise InvalidJsonPatch("Operation must be a string") if op not in self.operations: - raise JsonPatchException("Unknown operation {0!r}".format(op)) + raise InvalidJsonPatch("Unknown operation {0!r}".format(op)) cls = self.operations[op] return cls(operation) @@ -397,10 +408,15 @@ """Adds an object property or an array element.""" def apply(self, obj): - value = self.operation["value"] + try: + value = self.operation["value"] + except KeyError as ex: + raise InvalidJsonPatch( + "The operation does not contain a 'value' member") + subobj, part = self.pointer.to_last(obj) - if isinstance(subobj, list): + if isinstance(subobj, MutableSequence): if part == '-': subobj.append(value) # pylint: disable=E1103 @@ -410,7 +426,7 @@ else: subobj.insert(part, value) # pylint: disable=E1103 - elif isinstance(subobj, dict): + elif isinstance(subobj, MutableMapping): if part is None: obj = value # we're replacing the root else: @@ -426,17 +442,22 @@ """Replaces an object property or an array element by new value.""" def apply(self, obj): - value = self.operation["value"] + try: + value = self.operation["value"] + except KeyError as ex: + raise InvalidJsonPatch( + "The operation does not contain a 'value' member") + subobj, part = self.pointer.to_last(obj) if part is None: return value - if isinstance(subobj, list): + if isinstance(subobj, MutableSequence): if part > len(subobj) or part < 0: raise JsonPatchConflict("can't replace outside of list") - elif isinstance(subobj, dict): + elif isinstance(subobj, MutableMapping): if not part in subobj: msg = "can't replace non-existent object '{0}'".format(part) raise JsonPatchConflict(msg) @@ -451,15 +472,21 @@ """Moves an object property or an array element to new location.""" def apply(self, obj): - from_ptr = JsonPointer(self.operation['from']) + try: + from_ptr = JsonPointer(self.operation['from']) + except KeyError as ex: + raise InvalidJsonPatch( + "The operation does not contain a 'from' member") + subobj, part = from_ptr.to_last(obj) try: value = subobj[part] except (KeyError, IndexError) as ex: raise JsonPatchConflict(str(ex)) - if isinstance(subobj, dict) and self.pointer.contains(from_ptr): - raise JsonPatchException('Cannot move values into its own children') + if isinstance(subobj, MutableMapping) and \ + self.pointer.contains(from_ptr): + raise JsonPatchConflict('Cannot move values into its own children') obj = RemoveOperation({ 'op': 'remove', @@ -488,12 +515,16 @@ except JsonPointerException as ex: raise JsonPatchTestFailed(str(ex)) - if 'value' in self.operation: + try: value = self.operation['value'] - if val != value: - msg = '{0} ({1}) is not equal to tested value {2} ({3})' - raise JsonPatchTestFailed(msg.format(val, type(val), - value, type(value))) + except KeyError as ex: + raise InvalidJsonPatch( + "The operation does not contain a 'value' member") + + if val != value: + msg = '{0} ({1}) is not equal to tested value {2} ({3})' + raise JsonPatchTestFailed(msg.format(val, type(val), + value, type(value))) return obj @@ -502,7 +533,12 @@ """ Copies an object property or an array element to a new location """ def apply(self, obj): - from_ptr = JsonPointer(self.operation['from']) + try: + from_ptr = JsonPointer(self.operation['from']) + except KeyError as ex: + raise InvalidJsonPatch( + "The operation does not contain a 'from' member") + subobj, part = from_ptr.to_last(obj) try: value = copy.deepcopy(subobj[part]) @@ -623,7 +659,7 @@ Yields JSON patch operations and list index shift. """ - if isinstance(left, list): + if isinstance(left, MutableSequence): for item, shift in _compare_with_shift(path, src, dst, *left, shift=shift): yield item, shift @@ -631,7 +667,7 @@ for item, shift in _compare_left(path, src, left, shift): yield item, shift - if isinstance(right, list): + if isinstance(right, MutableSequence): for item, shift in _compare_with_shift(path, src, dst, *right, shift=shift): yield item, shift @@ -693,7 +729,8 @@ add_remove = set(['add', 'remove']) for item in operations: # could we apply "move" optimization for dict values? - hashable_value = not isinstance(item['value'], (dict, list)) + hashable_value = not isinstance(item['value'], + (MutableMapping, MutableSequence)) if item['path'] in ops_by_path: _optimize_using_replace(ops_by_path[item['path']], item) continue diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpatch-1.7/requirements.txt new/jsonpatch-1.9/requirements.txt --- old/jsonpatch-1.7/requirements.txt 2014-06-24 20:17:59.000000000 +0200 +++ new/jsonpatch-1.9/requirements.txt 2014-11-03 18:49:06.000000000 +0100 @@ -1 +1 @@ -jsonpointer>=1.3 +jsonpointer>=1.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpatch-1.7/setup.py new/jsonpatch-1.9/setup.py --- old/jsonpatch-1.7/setup.py 2014-06-30 22:41:31.000000000 +0200 +++ new/jsonpatch-1.9/setup.py 2014-10-25 15:26:26.000000000 +0200 @@ -44,6 +44,14 @@ # Extract name and e-mail ("Firstname Lastname <mail@example.org>") AUTHOR, EMAIL = re.match(r'(.*) <(.*)>', AUTHOR_EMAIL).groups() +try: + from pypandoc import convert + read_md = lambda f: convert(f, 'rst') +except ImportError: + print('warning: pypandoc module not found, could not convert ' + 'Markdown to RST') + read_md = lambda f: open(f, 'r').read() + CLASSIFIERS = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', @@ -68,6 +76,7 @@ setup(name=PACKAGE, version=VERSION, description=DESCRIPTION, + long_description=read_md('README.md'), author=AUTHOR, author_email=EMAIL, license=LICENSE, @@ -75,11 +84,6 @@ py_modules=MODULES, package_data={'': ['requirements.txt']}, scripts=['bin/jsondiff', 'bin/jsonpatch'], - entry_points = { - 'console_scripts': [ - 'jsondiff = jsondiff:main', - 'jsonpatch = jsonpatch:main', - ]}, classifiers=CLASSIFIERS, **OPTIONS ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonpatch-1.7/tests.py new/jsonpatch-1.9/tests.py --- old/jsonpatch-1.7/tests.py 2014-06-24 20:30:31.000000000 +0200 +++ new/jsonpatch-1.9/tests.py 2014-07-03 22:43:36.000000000 +0200 @@ -158,7 +158,9 @@ def test_test_noval_existing(self): obj = {'bar': 'qux'} - jsonpatch.apply_patch(obj, [{'op': 'test', 'path': '/bar'}]) + self.assertRaises(jsonpatch.InvalidJsonPatch, + jsonpatch.apply_patch, + obj, [{'op': 'test', 'path': '/bar'}]) def test_test_noval_not_existing(self): -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org