diff --git a/.python-anyjson.metadata b/.python-anyjson.metadata new file mode 100644 index 0000000..6fe2690 --- /dev/null +++ b/.python-anyjson.metadata @@ -0,0 +1 @@ +2cd3c6cc61206664268e0e8684dbadf6e2428497 SOURCES/anyjson-0.3.3.tar.gz diff --git a/SOURCES/anyjson-python3.patch b/SOURCES/anyjson-python3.patch new file mode 100644 index 0000000..521325b --- /dev/null +++ b/SOURCES/anyjson-python3.patch @@ -0,0 +1,58 @@ +--- anyjson-0.3.3/anyjson/__init__.py 2012-06-21 16:08:51.000000000 -0700 ++++ anyjson-0.3.3/anyjson/__init__.py.new 2016-12-24 14:52:05.027940293 -0800 +@@ -1,6 +1,7 @@ + """Wraps the best available JSON implementation available in a common + interface""" + ++from six import (reraise, string_types) + import sys + + VERSION = (0, 3, 3) +@@ -64,9 +65,9 @@ + self._encode_error = modinfo["encerror"] + self._decode_error = modinfo["decerror"] + +- if isinstance(modinfo["encerror"], basestring): ++ if isinstance(modinfo["encerror"], string_types): + self._encode_error = getattr(module, modinfo["encerror"]) +- if isinstance(modinfo["decerror"], basestring): ++ if isinstance(modinfo["decerror"], string_types): + self._decode_error = getattr(module, modinfo["decerror"]) + + self.name = modinfo["modname"] +@@ -85,8 +86,8 @@ + 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: ++ reraise(TypeError, TypeError(*exc.args), sys.exc_info()[2]) + serialize = dumps + + def loads(self, s): +@@ -94,11 +95,11 @@ + ValueError if the string could not be parsed.""" + # uses StringIO to support buffer objects. + try: +- if self._filedecode and not isinstance(s, basestring): ++ if self._filedecode and not isinstance(s, string_types): + 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: ++ reraise(ValueError, ValueError(*exc.args), sys.exc_info()[2]) + deserialize = loads + + +@@ -117,8 +118,7 @@ + # 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" +- sys.exit(1) ++ sys.exit("Running anyjson as a stand alone script is not supported") + else: + for modspec in _modules: + try: diff --git a/SOURCES/python-anyjson-update-order-ujson.patch b/SOURCES/python-anyjson-update-order-ujson.patch new file mode 100644 index 0000000..c1a0f16 --- /dev/null +++ b/SOURCES/python-anyjson-update-order-ujson.patch @@ -0,0 +1,30 @@ +--- anyjson-0.3.3/anyjson/__init__.py 2017-02-10 14:40:44.238386339 -0800 ++++ anyjson-0.3.3/anyjson/__init__.py.new 2017-02-10 14:40:46.551395839 -0800 +@@ -31,13 +31,11 @@ + #: List of known json modules, and the names of their loads/dumps + #: methods, as well as the exceptions they throw. Exception can be either + #: an exception class or a string. +-_modules = [("yajl", "dumps", TypeError, "loads", ValueError, "load"), +- ("jsonlib2", "write", "WriteError", "read", "ReadError", None), +- ("jsonlib", "write", "WriteError", "read", "ReadError", None), ++_modules = [("ujson", "dumps", TypeError, "loads", ValueError, None), ++ ("yajl", "dumps", TypeError, "loads", ValueError, "load"), ++ ("cjson", "encode", "EncodeError", "decode", "DecodeError", None), + ("simplejson", "dumps", TypeError, "loads", ValueError, "load"), + ("json", "dumps", TypeError, "loads", ValueError, "load"), +- ("django.utils.simplejson", "dumps", TypeError, "loads", ValueError, "load"), +- ("cjson", "encode", "EncodeError", "decode", "DecodeError", None) + ] + + _fields = ("modname", "encoder", "encerror", +@@ -50,10 +48,6 @@ + def __init__(self, modspec): + modinfo = dict(zip(_fields, modspec)) + +- if modinfo["modname"] == "cjson": +- import warnings +- warnings.warn("cjson is deprecated! See http://pypi.python.org/pypi/python-cjson/1.0.5", DeprecationWarning) +- + # No try block. We want importerror to end up at caller + module = self._attempt_load(modinfo["modname"]) + diff --git a/SOURCES/python-anyjson-update-order.patch b/SOURCES/python-anyjson-update-order.patch new file mode 100644 index 0000000..45d3542 --- /dev/null +++ b/SOURCES/python-anyjson-update-order.patch @@ -0,0 +1,27 @@ +--- anyjson-0.3.3/anyjson/__init__.py 2017-02-10 14:45:17.898510326 -0800 ++++ anyjson-0.3.3/anyjson/__init__.py.new 2017-02-10 14:45:27.501549767 -0800 +@@ -32,12 +32,9 @@ + #: methods, as well as the exceptions they throw. Exception can be either + #: an exception class or a string. + _modules = [("yajl", "dumps", TypeError, "loads", ValueError, "load"), +- ("jsonlib2", "write", "WriteError", "read", "ReadError", None), +- ("jsonlib", "write", "WriteError", "read", "ReadError", None), ++ ("cjson", "encode", "EncodeError", "decode", "DecodeError", None), + ("simplejson", "dumps", TypeError, "loads", ValueError, "load"), + ("json", "dumps", TypeError, "loads", ValueError, "load"), +- ("django.utils.simplejson", "dumps", TypeError, "loads", ValueError, "load"), +- ("cjson", "encode", "EncodeError", "decode", "DecodeError", None) + ] + + _fields = ("modname", "encoder", "encerror", +@@ -50,10 +47,6 @@ + def __init__(self, modspec): + modinfo = dict(zip(_fields, modspec)) + +- if modinfo["modname"] == "cjson": +- import warnings +- warnings.warn("cjson is deprecated! See http://pypi.python.org/pypi/python-cjson/1.0.5", DeprecationWarning) +- + # No try block. We want importerror to end up at caller + module = self._attempt_load(modinfo["modname"]) + diff --git a/SPECS/python-anyjson.spec b/SPECS/python-anyjson.spec new file mode 100644 index 0000000..80e29c2 --- /dev/null +++ b/SPECS/python-anyjson.spec @@ -0,0 +1,187 @@ +%global srcname anyjson +%global sum Wraps the best available JSON implementation + +Name: python-%{srcname} +Version: 0.3.3 +Release: 29%{?dist} +Summary: %{sum} + +License: BSD +URL: http://pypi.python.org/pypi/anyjson +Source0: https://pypi.python.org/packages/source/a/%{srcname}/%{srcname}-%{version}.tar.gz +# Fix Python 3 compatibility +Patch0: anyjson-python3.patch +# Include ujson, raise priority of cjson and drop the 'deprecation' +# warning (it's about as alive as half the others), drop jsonlib, +# jsonlib2 and django.utils.simplejson (which all appear to be dead +# as doornails) +%if 0%{?fedora} > 25 || 0%{?rhel} > 7 +Patch1: python-anyjson-update-order-ujson.patch +%else +# Just the same, but don't include ujson, as its behaviour pre-2.0 +# was very weird and unexpected, it would 'serialize' all sorts of +# unserializable things +Patch1: python-anyjson-update-order.patch +%endif +BuildArch: noarch + +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-six +BuildRequires: python3-nose + +BuildRequires: python3-simplejson + +%if 0%{?fedora} > 25 || 0%{?rhel} > 7 +BuildRequires: python3-ujson +%endif + +%description +Anyjson loads whichever is the fastest JSON module installed and +provides a uniform API regardless of which JSON implementation is used. + +%package -n python3-%{srcname} +Summary: %{sum} +%{?python_provide:%python_provide python3-%{srcname}} +Requires: python3-six + +%description -n python3-%{srcname} +Anyjson loads whichever is the fastest JSON module installed and +provides a uniform API regardless of which JSON implementation is used. + +%prep +%autosetup -n %{srcname}-%{version} -p1 + +%build +%py3_build + +%install +%py3_install + +%check +%{__python3} setup.py test + +%files -n python3-%{srcname} +%doc CHANGELOG README +%license LICENSE +%{python3_sitelib}/%{srcname}/ +%{python3_sitelib}/%{srcname}*.egg-info + +%changelog +* Wed Jan 27 2021 Fedora Release Engineering - 0.3.3-29 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 0.3.3-28 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue May 26 2020 Miro Hrončok - 0.3.3-27 +- Rebuilt for Python 3.9 + +* Thu May 21 2020 Yatin Karel - 0.3.3-26 +- Make anyjson buildable in El8 (#1787123) + +* Thu Jan 30 2020 Fedora Release Engineering - 0.3.3-25 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Oct 03 2019 Miro Hrončok - 0.3.3-24 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Mon Aug 19 2019 Miro Hrončok - 0.3.3-23 +- Rebuilt for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 0.3.3-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon Feb 11 2019 Miro Hrončok - 0.3.3-21 +- Subpackage python2-anyjson has been removed + See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal + +* Sat Feb 02 2019 Fedora Release Engineering - 0.3.3-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Jul 13 2018 Fedora Release Engineering - 0.3.3-19 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 0.3.3-18 +- Rebuilt for Python 3.7 + +* Fri Feb 09 2018 Iryna Shcherbina - 0.3.3-17 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Fri Feb 09 2018 Fedora Release Engineering - 0.3.3-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 0.3.3-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Adam Williamson - 0.3.3-14 +- Add ujson support (for Fedora > 25, with ujson 2.0+) + +* Sat Dec 24 2016 Adam Williamson - 0.3.3-13 +- update the Python 3 compatibility patch (fixes build) +- enable tests +- add some more BuildRequires to extend test coverage + +* Mon Dec 19 2016 Miro Hrončok +- Rebuild for Python 3.6 + +* Tue Jul 19 2016 Fedora Release Engineering - 0.3.3-12 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Sat May 14 2016 Fabian Affolter - 0.3.3-11 +- Fix FTBFS (rhbz#1307894) + +* Thu Feb 04 2016 Fedora Release Engineering - 0.3.3-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Sat Nov 14 2015 Fabian Affolter - 0.3.3-9 +- Cleanup + +* Wed Nov 04 2015 Matej Stuchlik - 0.3.3-8 +- Rebuilt for Python 3.5 + +* Thu Jun 18 2015 Fedora Release Engineering - 0.3.3-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 0.3.3-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Wed May 14 2014 Bohuslav Kabrda - 0.3.3-5 +- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4 + +* Sun Aug 04 2013 Fedora Release Engineering - 0.3.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 0.3.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sat Aug 04 2012 David Malcolm - 0.3.3-2 +- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3 + +* Fri Aug 03 2012 Matthias Runge - 0.3.3-1 +- update to 0.3.3 + +* Sat Jul 21 2012 Fedora Release Engineering - 0.3.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue Jan 31 2012 Fabian Affolter - 0.3.1-3 +- Minor py3 fixes + +* Sun Jan 29 2012 Haïkel Guémar - 0.3.1-2 +- add python3 variant + +* Sun Apr 03 2011 Fabian Affolter - 0.3.1-1 +- Updated to new upstream version 0.3.1 + +* Tue Feb 08 2011 Fedora Release Engineering - 0.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Thu Jan 27 2011 Fabian Affolter - 0.3-1 +- Updated to new upstream version 0.3 + +* Sat Jul 31 2010 Orcan Ogetbil - 0.2.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Sat Jul 03 2010 Fabian Affolter - 0.2.4-1 +- Initial package