##
##  python-json.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package versions
%define       V_python        3.14
%define       V_simplejson    3.20.2
%define       V_ujson         5.11.0
%define       V_cbor          1.0.0
%define       V_msgpack       0.5.6
%define       V_ubjson        0.16.1
%define       V_umsgpack      2.8.0

#   package information
Name:         python-json
Summary:      Python Modules for JSON Encoding/Decoding
URL:          http://code.google.com/p/simplejson/
Vendor:       Python Community
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        BASE
Group:        Language
License:      MIT
Version:      %{V_python}
Release:      20251008

#   list of sources
Source0:      https://files.pythonhosted.org/packages/source/s/simplejson/simplejson-%{V_simplejson}.tar.gz
Source1:      https://files.pythonhosted.org/packages/source/u/ujson/ujson-%{V_ujson}.tar.gz
Source2:      https://files.pythonhosted.org/packages/source/c/cbor/cbor-%{V_cbor}.tar.gz
Source3:      https://files.pythonhosted.org/packages/source/m/msgpack-python/msgpack-python-%{V_msgpack}.tar.gz
Source4:      https://files.pythonhosted.org/packages/source/p/py-ubjson/py-ubjson-%{V_ubjson}.tar.gz
Source5:      https://files.pythonhosted.org/packages/source/u/u-msgpack-python/u-msgpack-python-%{V_umsgpack}.tar.gz

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, python >= %{V_python}
PreReq:       OpenPKG, openpkg >= 20160101, python >= %{V_python}

%description
    This is a set of Python extension modules for JSON encoding/decoding.

%track
    prog python-json:simplejson = {
        version   = %{V_simplejson}
        url       = http://pypi.python.org/pypi/simplejson
        regex     = simplejson-(__VER__)\.tar\.gz
    }
    prog python-json:ujson = {
        version   = %{V_ujson}
        url       = https://pypi.python.org/pypi/ujson
        regex     = ujson-(__VER__)\.tar\.gz
    }
    prog python-json:cbor = {
        version   = %{V_cbor}
        url       = https://pypi.python.org/pypi/cbor
        regex     = cbor-(__VER__)\.tar\.gz
    }
    prog python-json:msgpack = {
        version   = %{V_msgpack}
        url       = https://pypi.python.org/pypi/msgpack-python
        regex     = msgpack-python-(__VER__)\.tar\.gz
    }
    prog python-json:ubjson = {
        version   = %{V_ubjson}
        url       = https://pypi.python.org/pypi/py-ubjson
        regex     = py-ubjson-(__VER__)\.tar\.gz
    }
    prog python-json:umsgpack = {
        version   = %{V_umsgpack}
        url       = https://pypi.python.org/pypi/u-msgpack-python
        regex     = u-msgpack-python-(__VER__)\.tar\.gz
    }

%prep
    %setup -q -c
    %setup -q -T -D -a 1
    %setup -q -T -D -a 2
    %setup -q -T -D -a 3
    %setup -q -T -D -a 4
    %setup -q -T -D -a 5

%build

%install
    export PYTHONPATH=$RPM_BUILD_ROOT%{l_prefix}/lib/python%{V_python}/site-packages
    ( cd simplejson-%{V_simplejson}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd ujson-%{V_ujson}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd cbor-%{V_cbor}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd msgpack-python-%{V_msgpack}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd py-ubjson-%{V_ubjson}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    ( cd u-msgpack-python-%{V_umsgpack}
      %{l_prefix}/bin/python \
          setup.py install \
          --root=$RPM_BUILD_ROOT \
          --prefix=%{l_prefix}
    ) || exit $?
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

