diff --git a/fix-do-not-use-2to3.patch b/fix-do-not-use-2to3.patch new file mode 100644 index 0000000..b133dc0 --- /dev/null +++ b/fix-do-not-use-2to3.patch @@ -0,0 +1,25 @@ +From 4571581397f0a8ff0a579c105901292cfef656e2 Mon Sep 17 00:00:00 2001 +From: wu-leilei +Date: Tue, 8 Feb 2022 17:00:49 +0800 +Subject: [PATCH] do not use 2to3 + +--- + setup.py | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/setup.py b/setup.py +index 9fe4902..f2098e1 100644 +--- a/setup.py ++++ b/setup.py +@@ -2,8 +2,6 @@ import os + import sys + + extra = {} +-if sys.version_info >= (3, 0): +- extra.update(use_2to3=True) + + try: + from setuptools import setup, find_packages +-- +2.23.0 + diff --git a/fix-py3k.patch b/fix-py3k.patch new file mode 100644 index 0000000..993ccbd --- /dev/null +++ b/fix-py3k.patch @@ -0,0 +1,80 @@ +From 1a1c2a69045b7fd7a60a59e6cbc3ece0e3f8bd75 Mon Sep 17 00:00:00 2001 +From: wu-leilei +Date: Tue, 8 Feb 2022 18:41:00 +0800 +Subject: [PATCH] py3k + +--- + anyjson/__init__.py | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/anyjson/__init__.py b/anyjson/__init__.py +index 1f671be..0fc9ece 100644 +--- a/anyjson/__init__.py ++++ b/anyjson/__init__.py +@@ -23,9 +23,9 @@ if sys.version_info[0] == 3: + from io import StringIO + else: + try: +- from cStringIO import StringIO # noqa ++ from io import StringIO # noqa + except ImportError: +- from StringIO import StringIO # noqa ++ from io import StringIO # noqa + + #: List of known json modules, and the names of their loads/dumps + #: methods, as well as the exceptions they throw. Exception can be either +@@ -47,7 +47,7 @@ class _JsonImplementation(object): + """Incapsulates a JSON implementation""" + + def __init__(self, modspec): +- modinfo = dict(zip(_fields, modspec)) ++ modinfo = dict(list(zip(_fields, modspec))) + + if modinfo["modname"] == "cjson": + import warnings +@@ -64,9 +64,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"] +@@ -85,8 +85,8 @@ class _JsonImplementation(object): + TypeError if the object could not be serialized.""" + try: + return self._encode(data) +- except self._encode_error, exc: +- raise TypeError, TypeError(*exc.args), sys.exc_info()[2] ++ except self._encode_error as exc: ++ raise TypeError(TypeError(*exc.args)).with_traceback(sys.exc_info()[2]) + serialize = dumps + + def loads(self, s): +@@ -97,8 +97,8 @@ class _JsonImplementation(object): + if self._filedecode and not isinstance(s, basestring): + return self._filedecode(StringIO(s)) + return self._decode(s) +- except self._decode_error, exc: +- raise ValueError, ValueError(*exc.args), sys.exc_info()[2] ++ except self._decode_error as exc: ++ raise ValueError(ValueError(*exc.args)).with_traceback(sys.exc_info()[2]) + deserialize = loads + + +@@ -117,7 +117,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: +-- +2.23.0 + diff --git a/python-anyjson.spec b/python-anyjson.spec index 34c6173..3c56e35 100644 --- a/python-anyjson.spec +++ b/python-anyjson.spec @@ -1,11 +1,13 @@ %global _empty_manifest_terminate_build 0 Name: python-anyjson Version: 0.3.3 -Release: 1 +Release: 2 Summary: Wraps the best available JSON implementation available in a common interface License: BSD URL: http://bitbucket.org/runeh/anyjson/ Source0: https://files.pythonhosted.org/packages/c3/4d/d4089e1a3dd25b46bebdb55a992b0797cff657b4477bc32ce28038fdecbc/anyjson-0.3.3.tar.gz +Patch01: fix-do-not-use-2to3.patch +Patch02: fix-py3k.patch BuildArch: noarch @@ -30,7 +32,7 @@ Anyjson loads whichever is the fastest JSON module installed and provides a uniform API regardless of which JSON implementation is used. %prep -%autosetup -n anyjson-0.3.3 +%autosetup -n anyjson-0.3.3 -p1 %build %py3_build @@ -70,5 +72,8 @@ mv %{buildroot}/doclist.lst . %{_docdir}/* %changelog +* Wed Feb 09 2022 wulei +- Fix in anyjson setup command use_2to3 is invalid + * Mon Jul 06 2020 Python_Bot - Package Spec generated