Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-anyjson for openSUSE:Factory checked in at 2022-02-09 20:38:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-anyjson (Old) and /work/SRC/openSUSE:Factory/.python-anyjson.new.1898 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-anyjson" Wed Feb 9 20:38:15 2022 rev:21 rq:952682 version:0.3.3+git.1298315003.7bb1d18 Changes: -------- --- /work/SRC/openSUSE:Factory/python-anyjson/python-anyjson.changes 2021-12-12 21:27:21.140332402 +0100 +++ /work/SRC/openSUSE:Factory/.python-anyjson.new.1898/python-anyjson.changes 2022-02-09 20:38:27.298269040 +0100 @@ -1,0 +2,19 @@ +Tue Feb 08 11:14:08 UTC 2022 - [email protected] + +- Update to version 0.3.3+git.1298315003.7bb1d18: + * GitHub-like readmes + * Added tag 0.3 for changeset b5d33ab23b8f + * Bumped version number + * Added python3 support (Thanks asksol) + * Added tag 0.2.5 for changeset 40150de124d6 + * Bumped version, updated changelog + * Added dumps/loads as aliases for serializ/deserialize so it's + in line with the stdlib json module + * Removed a newline in desc that caused problems when building + RPMs (thanks csears) + * Added tag 0.2.4 for changeset 6a0a193e51e4 + * Bumped version and updated changelog +- Add port_to_py3k.patch (gh#kennethreitz-archive/anyjson#2) + which ports whole package to py3k and removes dependency on nose. + +------------------------------------------------------------------- Old: ---- anyjson-0.3.3.tar.gz New: ---- _service _servicedata anyjson-0.3.3+git.1298315003.7bb1d18.tar.gz port_to_py3k.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-anyjson.spec ++++++ --- /var/tmp/diff_new_pack.oetqKv/_old 2022-02-09 20:38:28.006270734 +0100 +++ /var/tmp/diff_new_pack.oetqKv/_new 2022-02-09 20:38:28.014270753 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-anyjson # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,14 +17,22 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define maj_version 0.3 Name: python-anyjson -Version: 0.3.3 +Version: 0.3.3+git.1298315003.7bb1d18 Release: 0 Summary: Provide the best available JSON implementation available License: BSD-3-Clause URL: https://bitbucket.org/runeh/anyjson -Source: https://files.pythonhosted.org/packages/source/a/anyjson/anyjson-%{version}.tar.gz +# Currently the official upstream is dead, trying to send patches to +# https://github.com/kennethreitz-archive/anyjson +Source: anyjson-%{version}.tar.gz +# PATCH-FIX-UPSTREAM port_to_py3k.patch gh#kennethreitz-archive/anyjson#2 [email protected] +# port to py3k and avoid nose (replace with pytest) +Patch0: port_to_py3k.patch +BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} +BuildRequires: fdupes BuildRequires: python-rpm-macros BuildArch: noarch %python_subpackages @@ -37,17 +45,22 @@ %prep %setup -q -n anyjson-%{version} +%autopatch -p1 %build %python_build %install %python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pytest %files %{python_files} %license LICENSE %doc CHANGELOG README %{python_sitelib}/anyjson/ -%{python_sitelib}/anyjson-%{version}-py*.egg-info +%{python_sitelib}/anyjson-%{maj_version}-py*.egg-info %changelog ++++++ _service ++++++ <services> <service name="tar_scm" mode="disabled"> <param name="versionprefix">0.3.3+git</param> <param name="url">https://github.com/kennethreitz-archive/anyjson.git</param> <param name="scm">git</param> <param name="exclude">.git*</param> <param name="changesgenerate">enable</param> <param name="changesauthor">[email protected]</param> </service> <service name="recompress" mode="disabled"> <param name="file">*.tar</param> <param name="compression">gz</param> </service> <service name="set_version" mode="disabled" /> </services> ++++++ _servicedata ++++++ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/kennethreitz-archive/anyjson.git</param> <param name="changesrevision">7bb1d1808c42bbb20db2e095d566a881f7bcffef</param></service></servicedata> (No newline at EOF) ++++++ port_to_py3k.patch ++++++ --- anyjson/__init__.py | 12 ++++++------ setup.py | 7 +------ tests/benchmark.py | 20 ++++++++++---------- tests/test_implementations.py | 15 +++++++++------ 4 files changed, 26 insertions(+), 28 deletions(-) --- a/anyjson/__init__.py +++ b/anyjson/__init__.py @@ -50,7 +50,7 @@ class _JsonImplementation(object): """Incapsulates a JSON implementation""" def __init__(self, modspec): - modinfo = dict(zip(_fields, modspec)) + modinfo = dict(list(zip(_fields, modspec))) # No try block. We want importerror to end up at caller module = self._attempt_load(modinfo["modname"]) @@ -61,9 +61,9 @@ class _JsonImplementation(object): self._encode_error = modinfo["encerror"] self._decode_error = modinfo["decerror"] - if isinstance(modinfo["encerror"], basestring): + if isinstance(modinfo["encerror"], str): self._encode_error = getattr(module, modinfo["encerror"]) - if isinstance(modinfo["decerror"], basestring): + if isinstance(modinfo["decerror"], str): self._decode_error = getattr(module, modinfo["decerror"]) self.name = modinfo["modname"] @@ -82,7 +82,7 @@ class _JsonImplementation(object): TypeError if the object could not be serialized.""" try: return self._encode(data) - except self._encode_error, exc: + except self._encode_error as exc: raise TypeError(*exc.args) def deserialize(self, s): @@ -90,7 +90,7 @@ class _JsonImplementation(object): ValueError if the string vould not be parsed.""" try: return self._decode(s) - except self._decode_error, exc: + except self._decode_error as exc: raise ValueError(*exc.args) @@ -109,7 +109,7 @@ if __name__ == "__main__": # We do NOT try to load a compatible module because that may throw an # exception, which renders the package uninstallable with easy_install # (It trys to execfile the script when installing, to make sure it works) - print "Running anyjson as a stand alone script is not supported" + print("Running anyjson as a stand alone script is not supported") sys.exit(1) else: for modspec in _modules: --- a/setup.py +++ b/setup.py @@ -1,8 +1,4 @@ -import sys - extra = {} -if sys.version_info >= (3, 0): - extra.update(use_2to3=True) try: from setuptools import setup, find_packages @@ -12,7 +8,7 @@ except ImportError: author = "Rune Halvorsen" email = "[email protected]" version = "0.3" -desc = """Wraps the best available JSON implementation available in a common interface""" +desc = """Wraps the best JSON implementation available in a common interface""" setup(name='anyjson', version=version, @@ -38,6 +34,5 @@ setup(name='anyjson', packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), zip_safe=False, platforms=["any"], - test_suite = 'nose.collector', **extra ) --- a/tests/benchmark.py +++ b/tests/benchmark.py @@ -4,7 +4,7 @@ Simple benchmark script to do some basic import sys import time -import urllib +import urllib.request, urllib.parse, urllib.error _small = """ { @@ -77,8 +77,8 @@ _twitter = "[]" def load_external_json(): global _reddit, _twitter - _reddit = urllib.urlopen("http://reddit.com/.json").read() - _twitter = urllib.urlopen("http://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitterapi&count=200").read() + _reddit = urllib.request.urlopen("http://reddit.com/.json").read() + _twitter = urllib.request.urlopen("http://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitterapi&count=200").read() def do_benchmark(impspec, json, runs=10): @@ -93,13 +93,13 @@ def do_benchmark(impspec, json, runs=10) return None start = time.time() - for n in xrange(runs): + for n in range(runs): data = reads(json) readtime = time.time() - start start = time.time() - for n in xrange(runs): + for n in range(runs): devnull = dumps(data) return readtime, time.time() - start # tuple (readtime, writetime) @@ -131,13 +131,13 @@ for e in modules: no_res = set([e for e in res if e[1] is None]) res = list(set(res) - no_res) -res = [(e[0], sum(map(lambda x:x[0], e[1:])), sum(map(lambda x:x[1], e[1:]))) for e in res] +res = [(e[0], sum([x[0] for x in e[1:]]), sum([x[1] for x in e[1:]])) for e in res] res.sort(lambda a,b: cmp((a[1]+a[2]), b[1]+b[2])) -print "Total Read Write Implementation" -print "-----------------------------------" +print("Total Read Write Implementation") +print("-----------------------------------") for e in res: - print "%.3f %.3f %.3f %s" % (e[1]+e[2], e[1], e[2], e[0]) + print("%.3f %.3f %.3f %s" % (e[1]+e[2], e[1], e[2], e[0])) for e in no_res: - print "Not installed:", e[0] + print("Not installed:", e[0]) --- a/tests/test_implementations.py +++ b/tests/test_implementations.py @@ -1,4 +1,4 @@ -from nose.tools import assert_raises +import pytest import anyjson modnames = [e[0] for e in anyjson._modules] @@ -42,8 +42,11 @@ def test_exceptions(): except ImportError: continue # module can't be tested, try next - assert_raises(TypeError, anyjson.serialize, [object()]) - assert_raises(TypeError, anyjson.dumps, [object()]) - assert_raises(ValueError, anyjson.deserialize, "[") - assert_raises(ValueError, anyjson.loads, "[") - + with pytest.raises(TypeError): + anyjson.serialize([object()]) + with pytest.raises(TypeError): + anyjson.dumps([object()]) + with pytest.raises(ValueError): + anyjson.deserialize("[") + with pytest.raises(ValueError): + anyjson.loads("[")
