Blob Blame History Raw
%global srcname anyjson
%global sum Wraps the best available JSON implementation

Name:           python-%{srcname}
Version:        0.3.3
Release:        14%{?dist}
Summary:        %{sum}

License:        BSD
URL:            http://pypi.python.org/pypi/anyjson
Source0:        http://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
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:  python2-devel
BuildRequires:  python2-six
BuildRequires:  python2-nose
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-six
BuildRequires:  python3-nose

# The tests test whichever parsers they can find, so install as many
# as we can for the tests to use
# Note: there is a PR with a patch for ujson support:
# https://bitbucket.org/runeh/anyjson/pull-requests/6
# and we have python-ujson packaged, but ujson has very questionable
# default behaviour (it silently serializes all sorts of not-really-
# serializable things, lossily):
# https://github.com/esnme/ultrajson/issues/168
# so I don't think enabling this support is a good idea at present.
# AFAICT, we do not have these packaged:
# python-yajl
# python-jsonlib
# python-jsonlib2
# and django.utils.simplejson doesn't seem to exist upstream any more

# python2-simplejson provide is missing on f24
BuildRequires:  python-simplejson
BuildRequires:  python3-simplejson
# No Python 3 build of this
BuildRequires:  python-cjson

%if 0%{fedora} > 25
BuildRequires:  python2-ujson
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 python2-%{srcname}
Summary:        %{sum}
%{?python_provide:%python_provide python2-%{srcname}}
Requires:       python2-six

%description -n python2-%{srcname}
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
%py2_build
%py3_build

%install
%py2_install
%py3_install

%check
%{__python2} setup.py test
%{__python3} setup.py test
 
%files -n python2-%{srcname}
%doc CHANGELOG README
%license LICENSE
%{python2_sitelib}/%{srcname}/
%{python2_sitelib}/%{srcname}*.egg-info

%files -n python3-%{srcname}
%doc CHANGELOG README
%license LICENSE
%{python3_sitelib}/%{srcname}/
%{python3_sitelib}/%{srcname}*.egg-info

%changelog
* Fri Feb 10 2017 Adam Williamson <awilliam@redhat.com> - 0.3.3-14
- Add ujson support (for Fedora > 25, with ujson 2.0+)

* Sat Dec 24 2016 Adam Williamson <awilliam@redhat.com> - 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 <mhroncok@redhat.com>
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.3-12
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Sat May 14 2016 Fabian Affolter <mail@fabian-affolter.ch> - 0.3.3-11
- Fix FTBFS (rhbz#1307894)

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.3-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Sat Nov 14 2015 Fabian Affolter <mail@fabian-affolter.ch> - 0.3.3-9
- Cleanup

* Wed Nov 04 2015 Matej Stuchlik <mstuchli@redhat.com> - 0.3.3-8
- Rebuilt for Python 3.5

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.3-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed May 14 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 0.3.3-5
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sat Aug 04 2012 David Malcolm <dmalcolm@redhat.com> - 0.3.3-2
- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3

* Fri Aug 03 2012 Matthias Runge <mrunge@matthias-runge.de> - 0.3.3-1
- update to 0.3.3

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Tue Jan 31 2012 Fabian Affolter <mail@fabian-affolter.ch> - 0.3.1-3
- Minor py3 fixes

* Sun Jan 29 2012 Haïkel Guémar <hguemar@fedoraproject.org> - 0.3.1-2
- add python3 variant

* Sun Apr 03 2011 Fabian Affolter <fabian@bernewireless.net> - 0.3.1-1
- Updated to new upstream version 0.3.1

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Thu Jan 27 2011 Fabian Affolter <fabian@bernewireless.net> - 0.3-1
- Updated to new upstream version 0.3

* Sat Jul 31 2010 Orcan Ogetbil <oget[dot]fedora[at]gmail[dot]com> - 0.2.4-2
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Sat Jul 03 2010 Fabian Affolter <fabian@bernewireless.net> - 0.2.4-1
- Initial package