62ce9b
%global pypi_name jsonpatch
62ce9b
62ce9b
%if 0%{?fedora} || 0%{?rhel} > 7
62ce9b
# Enable python3 build by default
62ce9b
%bcond_without python3
62ce9b
%else
62ce9b
%bcond_with python3
62ce9b
%endif
62ce9b
62ce9b
%if 0%{?rhel} > 7
62ce9b
# Disable python2 build by default
62ce9b
%bcond_with python2
62ce9b
%else
62ce9b
%bcond_without python2
62ce9b
%endif
62ce9b
62ce9b
Name:           python-%{pypi_name}
62ce9b
Version:        1.21
62ce9b
Release:        2%{?dist}
62ce9b
Summary:        Applying JSON Patches in Python
62ce9b
62ce9b
License:        BSD
62ce9b
URL:            https://github.com/stefankoegl/%{github_name}
62ce9b
Source0:        https://pypi.io/packages/source/j/jsonpatch/%{pypi_name}-%{version}.tar.gz
62ce9b
# tarball from pypi does not include file tests.js required for a specific test.
62ce9b
# upstream issue https://github.com/stefankoegl/python-json-patch/issues/82
62ce9b
Patch0:         0001-Skip-unit-test-in-packaging.patch
62ce9b
62ce9b
BuildArch:      noarch
62ce9b
62ce9b
%description
62ce9b
Library to apply JSON Patches according to RFC 6902 - Python 2 build.
62ce9b
62ce9b
%if %{with python2}
62ce9b
%package -n python2-%{pypi_name}
62ce9b
Summary:        Applying JSON Patches in Python 2
62ce9b
62ce9b
BuildRequires:  python2-devel
62ce9b
BuildRequires:  python2-setuptools
62ce9b
BuildRequires:  python2-jsonpointer
62ce9b
Requires:       python2-jsonpointer
62ce9b
62ce9b
%{?python_provide:%python_provide python2-%{pypi_name}}
62ce9b
62ce9b
%description -n python2-%{pypi_name}
62ce9b
Library to apply JSON Patches according to RFC 6902 - Python 2 build.
62ce9b
%endif # with python2
62ce9b
62ce9b
%if %{with python3}
62ce9b
%package -n python3-%{pypi_name}
62ce9b
Summary:        Applying JSON Patches in Python 3
62ce9b
62ce9b
BuildRequires:  python3-devel
62ce9b
BuildRequires:  python3-setuptools
62ce9b
BuildRequires:  python3-jsonpointer
62ce9b
Requires:       python3-jsonpointer
62ce9b
62ce9b
%{?python_provide:%python_provide python3-%{pypi_name}}
62ce9b
62ce9b
%description -n python3-%{pypi_name}
62ce9b
Library to apply JSON Patches according to RFC 6902 - Python 3 build.
62ce9b
%endif # with python3
62ce9b
62ce9b
%prep
62ce9b
%setup -qn %{pypi_name}-%{version}
62ce9b
%patch0 -p1
62ce9b
62ce9b
62ce9b
%build
62ce9b
%if %{with python2}
62ce9b
%py2_build
62ce9b
%endif # with python2
62ce9b
62ce9b
%if %{with python3}
62ce9b
LANG=en_US.utf8 %py3_build
62ce9b
%endif # with python3
62ce9b
62ce9b
%install
62ce9b
%if %{with python2}
62ce9b
%py2_install
62ce9b
for bin in jsondiff jsonpatch; do
62ce9b
mv %{buildroot}%{_bindir}/$bin %{buildroot}%{_bindir}/$bin-%{python2_version}
62ce9b
ln -s ./$bin-%{python2_version} %{buildroot}%{_bindir}/$bin-2
62ce9b
%if !0%{?with_python3}
62ce9b
ln -s ./$bin-%{python2_version} %{buildroot}%{_bindir}/$bin
62ce9b
%endif
62ce9b
done;
62ce9b
%endif # with python2
62ce9b
62ce9b
%if %{with python3}
62ce9b
LANG=en_US.utf8 %py3_install
62ce9b
for bin in jsondiff jsonpatch; do
62ce9b
mv %{buildroot}%{_bindir}/$bin %{buildroot}%{_bindir}/$bin-%{python3_version}
62ce9b
ln -s ./$bin-%{python3_version} %{buildroot}%{_bindir}/$bin-3
62ce9b
ln -s ./$bin-%{python3_version} %{buildroot}%{_bindir}/$bin
62ce9b
done;
62ce9b
%endif # with python3
62ce9b
62ce9b
%check
62ce9b
%if %{with python2}
62ce9b
%{__python2} tests.py
62ce9b
%endif # with python2
62ce9b
62ce9b
%if %{with python3}
62ce9b
%{__python3} tests.py
62ce9b
%endif # with python3
62ce9b
62ce9b
%if %{with python2}
62ce9b
%files -n python2-%{pypi_name}
62ce9b
%doc README.md
62ce9b
%license COPYING
62ce9b
%if !0%{?with_python3}
62ce9b
%{_bindir}/jsondiff
62ce9b
%{_bindir}/jsonpatch
62ce9b
%endif
62ce9b
%{_bindir}/jsondiff-2*
62ce9b
%{_bindir}/jsonpatch-2*
62ce9b
%{python2_sitelib}/%{pypi_name}.py*
62ce9b
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
62ce9b
%endif # with python2
62ce9b
62ce9b
%if %{with python3}
62ce9b
%files -n python3-%{pypi_name}
62ce9b
%doc README.md
62ce9b
%license COPYING
62ce9b
%{_bindir}/jsondiff
62ce9b
%{_bindir}/jsonpatch
62ce9b
%{_bindir}/jsondiff-3*
62ce9b
%{_bindir}/jsonpatch-3*
62ce9b
%{python3_sitelib}/%{pypi_name}.py*
62ce9b
%{python3_sitelib}/__pycache__/*
62ce9b
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
62ce9b
%endif # with python3
62ce9b
62ce9b
%changelog
62ce9b
* Thu Mar 15 2018 Charalampos Stratakis <cstratak@redhat.com> - 1.21-2
62ce9b
- Don't build Python 2 subpackage on EL > 7
62ce9b
62ce9b
* Tue Feb 6 2018 Alfredo Moralejo <amoralej@redhat.com> - 1.21-1
62ce9b
- Update to 1.21
62ce9b
62ce9b
* Fri Sep 29 2017 Troy Dawson <tdawson@redhat.com> - 1.14-5
62ce9b
- Cleanup spec file conditionals
62ce9b
62ce9b
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.14-4
62ce9b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
62ce9b
62ce9b
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.14-3
62ce9b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
62ce9b
62ce9b
* Fri Dec 09 2016 Charalampos Stratakis <cstratak@redhat.com> - 1.14-2
62ce9b
- Rebuild for Python 3.6
62ce9b
- Added upstream patch for fixing python3 tests failures
62ce9b
62ce9b
* Mon Sep  5 2016 Haïkel Guémar <hguemar@fedoraproject.org> - 1.14-1
62ce9b
- Upstream 1.14
62ce9b
- Update to latest python packaging guidelines
62ce9b
62ce9b
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-9
62ce9b
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
62ce9b
62ce9b
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-8
62ce9b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
62ce9b
62ce9b
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-7
62ce9b
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
62ce9b
62ce9b
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-6
62ce9b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
62ce9b
62ce9b
* Fri Aug 29 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 1.2-5
62ce9b
- Introduce python3- subpackage.
62ce9b
62ce9b
* Thu Jul 31 2014 Tom Callaway <spot@fedoraproject.org> - 1.2-4
62ce9b
- fix license handling
62ce9b
62ce9b
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-3
62ce9b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
62ce9b
62ce9b
* Tue Oct 15 2013 Alan Pevec <apevec@gmail.com> - 1.2-2
62ce9b
- add runtime dep on jsonpointer
62ce9b
62ce9b
* Fri Oct 11 2013 Alan Pevec <apevec@gmail.com> - 1.2-1
62ce9b
- Update to 1.2
62ce9b
62ce9b
* Fri Sep 13 2013 Alan Pevec <apevec@gmail.com> - 1.1-2
62ce9b
- review feedback: move %%check section, add missing build requirements
62ce9b
62ce9b
* Mon Jul 01 2013 Alan Pevec <apevec@gmail.com> - 1.1-1
62ce9b
- Initial package.