17
0
Files
python-python-cjson/python-python-cjson.spec
Tomáš Chvátal d0603d1783 Accepting request 702069 from home:jayvdb:django
- Rename package from python-cjson to python-python-cjson
- Add Python 3 support using py3.patch
- Update to v1.2.1

OBS-URL: https://build.opensuse.org/request/show/702069
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-cjson?expand=0&rev=1
2019-05-14 21:40:56 +00:00

86 lines
3.0 KiB
RPMSpec

#
# spec file for package python-python-cjson
#
# Copyright (c) 2019 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
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-python-cjson
Version: 1.2.1
Release: 0
License: LGPL-2.0-or-later
Summary: Fast JSON encoder/decoder for Python
Url: https://github.com/AGProjects/python-cjson
Group: Development/Languages/Python
Source: https://files.pythonhosted.org/packages/source/p/python-cjson/python-cjson-%{version}.tar.gz
# https://github.com/AGProjects/python-cjson/issues/6
Patch0: py3.patch
BuildRequires: python-rpm-macros
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
%python_subpackages
%description
Fast JSON encoder/decoder for Python.
JSON stands for JavaScript Object Notation and is a text based lightweight data
exchange format which is easy for humans to read/write and for machines to
parse/generate. JSON is completely language independent and has multiple
implementations in most of the programming languages, making it ideal for data
exchange and storage.
The module is written in C and it is up to 250 times faster when compared to
the other python JSON implementations which are written directly in python.
This speed gain varies with the complexity of the data and the operation and is
the the range of 10-200 times for encoding operations and in the range of
100-250 times for decoding operations.
%prep
%setup -q -n python-cjson-%{version}
cp cjson.c cjson%{python2_bin_suffix}.c
cp jsontest.py jsontest%{python2_bin_suffix}.py
%patch0 -p1
cp cjson.c cjson%{python3_bin_suffix}.c
cp jsontest.py jsontest%{python3_bin_suffix}.py
# Workaround dict order differences on Python 3.4
if [ %{python3_bin_suffix} = '3.4' ]; then
sed -i 's/\(testWriteComplexArray\|testWriteSmallObject\)/_\1/' jsontest%{python3_bin_suffix}.py
fi
%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
rm cjson.c
ln -s cjson%{python2_bin_suffix}.c cjson.c
%python2_build
rm cjson.c
ln -s cjson%{python3_bin_suffix}.c cjson.c
%python3_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%check
%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python jsontest%{$python_bin_suffix}.py
%files %{python_files}
%doc ChangeLog README
%license LICENSE
%{python_sitearch}/*
%changelog