17
0
Files
python-python-cjson/python-python-cjson.spec
Tomáš Chvátal 41c5f562e0 Accepting request 824518 from home:mcalabkova:branches:devel:languages:python
- Update to 1.2.2
    * Fix encoding of UTF-16 surrogate pairs
    * Made MANIFEST.in more explicit
    * Refactored setup.py to be PEP-8 compliant
    * Pass command line arguments from build_inplace to setup.py
    * Cleanup after build_inplace
    * Explicitly use python2 in shebang lines
    * Updated license
- Rebase py3.patch

OBS-URL: https://build.opensuse.org/request/show/824518
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-cjson?expand=0&rev=7
2020-08-06 05:42:59 +00:00

87 lines
2.8 KiB
RPMSpec

#
# spec file for package python-python-cjson
#
# Copyright (c) 2020 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without python2
Name: python-python-cjson
Version: 1.2.2
Release: 0
Summary: C-accelerated JSON encoder/decoder for Python
License: LGPL-2.1-or-later
Group: Development/Languages/Python
URL: https://github.com/AGProjects/python-cjson
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_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%python_subpackages
%description
JSON (JavaScript Object Notation) is a text-based data exchange
format.
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}
%if %{with python2}
cp cjson.c cjson%{python2_bin_suffix}.c
cp jsontest.py jsontest%{python2_bin_suffix}.py
%endif
%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"
%if %{with python2}
rm cjson.c
ln -s cjson%{python2_bin_suffix}.c cjson.c
%python2_build
%endif
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