8e061b
%global pypi_name jsonpatch
8e061b
8e061b
%if 0%{?fedora} || 0%{?rhel} > 7
8e061b
# Enable python3 build by default
8e061b
%bcond_without python3
8e061b
%else
8e061b
%bcond_with python3
8e061b
%endif
8e061b
8e061b
%if 0%{?fedora} || 0%{?rhel} > 7
8e061b
# Disable python2 build by default
8e061b
%bcond_with python2
8e061b
%else
8e061b
%bcond_without python2
8e061b
%endif
8e061b
8e061b
Name:           python-%{pypi_name}
8e061b
Version:        1.21
8e061b
Release:        16%{?dist}
8e061b
Summary:        Applying JSON Patches in Python
8e061b
8e061b
License:        BSD
8e061b
URL:            https://github.com/stefankoegl/%{github_name}
8e061b
Source0:        https://pypi.io/packages/source/j/jsonpatch/%{pypi_name}-%{version}.tar.gz
8e061b
# tarball from pypi does not include file tests.js required for a specific test.
8e061b
# upstream issue https://github.com/stefankoegl/python-json-patch/issues/82
8e061b
Patch0:         0001-Skip-unit-test-in-packaging.patch
8e061b
8e061b
BuildArch:      noarch
8e061b
8e061b
%description
8e061b
Library to apply JSON Patches according to RFC 6902 - Python 2 build.
8e061b
8e061b
%if %{with python2}
8e061b
%package -n python2-%{pypi_name}
8e061b
Summary:        Applying JSON Patches in Python 2
8e061b
8e061b
BuildRequires:  python2-devel
8e061b
BuildRequires:  python2-setuptools
8e061b
BuildRequires:  python2-jsonpointer
8e061b
Requires:       python2-jsonpointer
8e061b
8e061b
%{?python_provide:%python_provide python2-%{pypi_name}}
8e061b
8e061b
%description -n python2-%{pypi_name}
8e061b
Library to apply JSON Patches according to RFC 6902 - Python 2 build.
8e061b
%endif # with python2
8e061b
8e061b
%if %{with python3}
8e061b
%package -n python3-%{pypi_name}
8e061b
Summary:        Applying JSON Patches in Python 3
8e061b
8e061b
BuildRequires:  python3-devel
8e061b
BuildRequires:  python3-setuptools
8e061b
BuildRequires:  python3-jsonpointer
8e061b
Requires:       python3-jsonpointer
8e061b
8e061b
%{?python_provide:%python_provide python3-%{pypi_name}}
8e061b
8e061b
%description -n python3-%{pypi_name}
8e061b
Library to apply JSON Patches according to RFC 6902 - Python 3 build.
8e061b
%endif # with python3
8e061b
8e061b
%prep
8e061b
%setup -qn %{pypi_name}-%{version}
8e061b
%patch0 -p1
8e061b
8e061b
8e061b
%build
8e061b
%if %{with python2}
8e061b
%py2_build
8e061b
%endif # with python2
8e061b
8e061b
%if %{with python3}
8e061b
%py3_build
8e061b
%endif # with python3
8e061b
8e061b
%install
8e061b
%if %{with python2}
8e061b
%py2_install
8e061b
for bin in jsondiff jsonpatch; do
8e061b
mv %{buildroot}%{_bindir}/$bin %{buildroot}%{_bindir}/$bin-%{python2_version}
8e061b
ln -s ./$bin-%{python2_version} %{buildroot}%{_bindir}/$bin-2
8e061b
%if !0%{?with_python3}
8e061b
ln -s ./$bin-%{python2_version} %{buildroot}%{_bindir}/$bin
8e061b
%endif
8e061b
done;
8e061b
%endif # with python2
8e061b
8e061b
%if %{with python3}
8e061b
%py3_install
8e061b
for bin in jsondiff jsonpatch; do
8e061b
mv %{buildroot}%{_bindir}/$bin %{buildroot}%{_bindir}/$bin-%{python3_version}
8e061b
ln -s ./$bin-%{python3_version} %{buildroot}%{_bindir}/$bin-3
8e061b
ln -s ./$bin-%{python3_version} %{buildroot}%{_bindir}/$bin
8e061b
done;
8e061b
%endif # with python3
8e061b
8e061b
%check
8e061b
%if %{with python2}
8e061b
%{__python2} tests.py
8e061b
%endif # with python2
8e061b
8e061b
%if %{with python3}
8e061b
%{__python3} tests.py
8e061b
%endif # with python3
8e061b
8e061b
%if %{with python2}
8e061b
%files -n python2-%{pypi_name}
8e061b
%doc README.md
8e061b
%license COPYING
8e061b
%if !0%{?with_python3}
8e061b
%{_bindir}/jsondiff
8e061b
%{_bindir}/jsonpatch
8e061b
%endif
8e061b
%{_bindir}/jsondiff-2*
8e061b
%{_bindir}/jsonpatch-2*
8e061b
%{python2_sitelib}/%{pypi_name}.py*
8e061b
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
8e061b
%endif # with python2
8e061b
8e061b
%if %{with python3}
8e061b
%files -n python3-%{pypi_name}
8e061b
%doc README.md
8e061b
%license COPYING
8e061b
%{_bindir}/jsondiff
8e061b
%{_bindir}/jsonpatch
8e061b
%{_bindir}/jsondiff-3*
8e061b
%{_bindir}/jsonpatch-3*
8e061b
%{python3_sitelib}/%{pypi_name}.py*
8e061b
%{python3_sitelib}/__pycache__/*
8e061b
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
8e061b
%endif # with python3
8e061b
8e061b
%changelog
8e061b
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 1.21-16
8e061b
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
8e061b
  Related: rhbz#1991688
8e061b
8e061b
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.21-15
8e061b
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
8e061b
8e061b
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.21-14
8e061b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
8e061b
8e061b
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.21-13
8e061b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
8e061b
8e061b
* Sat May 23 2020 Miro Hrončok <mhroncok@redhat.com> - 1.21-12
8e061b
- Rebuilt for Python 3.9
8e061b
8e061b
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.21-11
8e061b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
8e061b
8e061b
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.21-10
8e061b
- Rebuilt for Python 3.8.0rc1 (#1748018)
8e061b
8e061b
* Thu Aug 15 2019 Miro Hrončok <mhroncok@redhat.com> - 1.21-9
8e061b
- Rebuilt for Python 3.8
8e061b
8e061b
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.21-8
8e061b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
8e061b
8e061b
* Wed Feb 27 2019 Yatin Karel <ykarel@redhat.com> - 1.21-7
8e061b
- Disable python2 build in Fedora
8e061b
8e061b
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.21-6
8e061b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
8e061b
8e061b
* Sun Nov 18 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.21-5
8e061b
- Drop explicit locale setting
8e061b
  See https://fedoraproject.org/wiki/Changes/Remove_glibc-langpacks-all_from_buildroot
8e061b
8e061b
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.21-4
8e061b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
8e061b
8e061b
* Fri Jun 15 2018 Miro Hrončok <mhroncok@redhat.com> - 1.21-3
8e061b
- Rebuilt for Python 3.7
8e061b
8e061b
* Thu Mar 15 2018 Charalampos Stratakis <cstratak@redhat.com> - 1.21-2
8e061b
- Don't build Python 2 subpackage on EL > 7
8e061b
8e061b
* Tue Feb 6 2018 Alfredo Moralejo <amoralej@redhat.com> - 1.21-1
8e061b
- Update to 1.21
8e061b
8e061b
* Fri Sep 29 2017 Troy Dawson <tdawson@redhat.com> - 1.14-5
8e061b
- Cleanup spec file conditionals
8e061b
8e061b
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.14-4
8e061b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
8e061b
8e061b
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.14-3
8e061b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
8e061b
8e061b
* Fri Dec 09 2016 Charalampos Stratakis <cstratak@redhat.com> - 1.14-2
8e061b
- Rebuild for Python 3.6
8e061b
- Added upstream patch for fixing python3 tests failures
8e061b
8e061b
* Mon Sep  5 2016 Haïkel Guémar <hguemar@fedoraproject.org> - 1.14-1
8e061b
- Upstream 1.14
8e061b
- Update to latest python packaging guidelines
8e061b
8e061b
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-9
8e061b
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
8e061b
8e061b
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-8
8e061b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
8e061b
8e061b
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-7
8e061b
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
8e061b
8e061b
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-6
8e061b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
8e061b
8e061b
* Fri Aug 29 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 1.2-5
8e061b
- Introduce python3- subpackage.
8e061b
8e061b
* Thu Jul 31 2014 Tom Callaway <spot@fedoraproject.org> - 1.2-4
8e061b
- fix license handling
8e061b
8e061b
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-3
8e061b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
8e061b
8e061b
* Tue Oct 15 2013 Alan Pevec <apevec@gmail.com> - 1.2-2
8e061b
- add runtime dep on jsonpointer
8e061b
8e061b
* Fri Oct 11 2013 Alan Pevec <apevec@gmail.com> - 1.2-1
8e061b
- Update to 1.2
8e061b
8e061b
* Fri Sep 13 2013 Alan Pevec <apevec@gmail.com> - 1.1-2
8e061b
- review feedback: move %%check section, add missing build requirements
8e061b
8e061b
* Mon Jul 01 2013 Alan Pevec <apevec@gmail.com> - 1.1-1
8e061b
- Initial package.