Don't build Python 2 subpackage on EL > 7
This commit is contained in:
parent
760285efc4
commit
d9fcc4b666
@ -1,11 +1,22 @@
|
|||||||
%global pypi_name jsonpatch
|
%global pypi_name jsonpatch
|
||||||
|
|
||||||
%if 0%{?fedora} || 0%{?rhel} > 7
|
%if 0%{?fedora} || 0%{?rhel} > 7
|
||||||
%global with_python3 1
|
# Enable python3 build by default
|
||||||
|
%bcond_without python3
|
||||||
|
%else
|
||||||
|
%bcond_with python3
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?rhel} > 7
|
||||||
|
# Disable python2 build by default
|
||||||
|
%bcond_with python2
|
||||||
|
%else
|
||||||
|
%bcond_without python2
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
Name: python-%{pypi_name}
|
Name: python-%{pypi_name}
|
||||||
Version: 1.21
|
Version: 1.21
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: Applying JSON Patches in Python
|
Summary: Applying JSON Patches in Python
|
||||||
|
|
||||||
License: BSD
|
License: BSD
|
||||||
@ -20,6 +31,7 @@ BuildArch: noarch
|
|||||||
%description
|
%description
|
||||||
Library to apply JSON Patches according to RFC 6902 - Python 2 build.
|
Library to apply JSON Patches according to RFC 6902 - Python 2 build.
|
||||||
|
|
||||||
|
%if %{with python2}
|
||||||
%package -n python2-%{pypi_name}
|
%package -n python2-%{pypi_name}
|
||||||
Summary: Applying JSON Patches in Python 2
|
Summary: Applying JSON Patches in Python 2
|
||||||
|
|
||||||
@ -32,9 +44,9 @@ Requires: python2-jsonpointer
|
|||||||
|
|
||||||
%description -n python2-%{pypi_name}
|
%description -n python2-%{pypi_name}
|
||||||
Library to apply JSON Patches according to RFC 6902 - Python 2 build.
|
Library to apply JSON Patches according to RFC 6902 - Python 2 build.
|
||||||
|
%endif # with python2
|
||||||
|
|
||||||
|
%if %{with python3}
|
||||||
%if 0%{?with_python3}
|
|
||||||
%package -n python3-%{pypi_name}
|
%package -n python3-%{pypi_name}
|
||||||
Summary: Applying JSON Patches in Python 3
|
Summary: Applying JSON Patches in Python 3
|
||||||
|
|
||||||
@ -47,7 +59,7 @@ Requires: python3-jsonpointer
|
|||||||
|
|
||||||
%description -n python3-%{pypi_name}
|
%description -n python3-%{pypi_name}
|
||||||
Library to apply JSON Patches according to RFC 6902 - Python 3 build.
|
Library to apply JSON Patches according to RFC 6902 - Python 3 build.
|
||||||
%endif
|
%endif # with python3
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -qn %{pypi_name}-%{version}
|
%setup -qn %{pypi_name}-%{version}
|
||||||
@ -55,13 +67,16 @@ Library to apply JSON Patches according to RFC 6902 - Python 3 build.
|
|||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
%if %{with python2}
|
||||||
%py2_build
|
%py2_build
|
||||||
|
%endif # with python2
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
%if %{with python3}
|
||||||
LANG=en_US.utf8 %py3_build
|
LANG=en_US.utf8 %py3_build
|
||||||
%endif
|
%endif # with python3
|
||||||
|
|
||||||
%install
|
%install
|
||||||
|
%if %{with python2}
|
||||||
%py2_install
|
%py2_install
|
||||||
for bin in jsondiff jsonpatch; do
|
for bin in jsondiff jsonpatch; do
|
||||||
mv %{buildroot}%{_bindir}/$bin %{buildroot}%{_bindir}/$bin-%{python2_version}
|
mv %{buildroot}%{_bindir}/$bin %{buildroot}%{_bindir}/$bin-%{python2_version}
|
||||||
@ -70,23 +85,27 @@ ln -s ./$bin-%{python2_version} %{buildroot}%{_bindir}/$bin-2
|
|||||||
ln -s ./$bin-%{python2_version} %{buildroot}%{_bindir}/$bin
|
ln -s ./$bin-%{python2_version} %{buildroot}%{_bindir}/$bin
|
||||||
%endif
|
%endif
|
||||||
done;
|
done;
|
||||||
|
%endif # with python2
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
%if %{with python3}
|
||||||
LANG=en_US.utf8 %py3_install
|
LANG=en_US.utf8 %py3_install
|
||||||
for bin in jsondiff jsonpatch; do
|
for bin in jsondiff jsonpatch; do
|
||||||
mv %{buildroot}%{_bindir}/$bin %{buildroot}%{_bindir}/$bin-%{python3_version}
|
mv %{buildroot}%{_bindir}/$bin %{buildroot}%{_bindir}/$bin-%{python3_version}
|
||||||
ln -s ./$bin-%{python3_version} %{buildroot}%{_bindir}/$bin-3
|
ln -s ./$bin-%{python3_version} %{buildroot}%{_bindir}/$bin-3
|
||||||
ln -s ./$bin-%{python3_version} %{buildroot}%{_bindir}/$bin
|
ln -s ./$bin-%{python3_version} %{buildroot}%{_bindir}/$bin
|
||||||
done;
|
done;
|
||||||
%endif
|
%endif # with python3
|
||||||
|
|
||||||
%check
|
%check
|
||||||
|
%if %{with python2}
|
||||||
%{__python2} tests.py
|
%{__python2} tests.py
|
||||||
|
%endif # with python2
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
%if %{with python3}
|
||||||
%{__python3} tests.py
|
%{__python3} tests.py
|
||||||
%endif
|
%endif # with python3
|
||||||
|
|
||||||
|
%if %{with python2}
|
||||||
%files -n python2-%{pypi_name}
|
%files -n python2-%{pypi_name}
|
||||||
%doc README.md
|
%doc README.md
|
||||||
%license COPYING
|
%license COPYING
|
||||||
@ -98,8 +117,9 @@ done;
|
|||||||
%{_bindir}/jsonpatch-2*
|
%{_bindir}/jsonpatch-2*
|
||||||
%{python2_sitelib}/%{pypi_name}.py*
|
%{python2_sitelib}/%{pypi_name}.py*
|
||||||
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
|
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
|
||||||
|
%endif # with python2
|
||||||
|
|
||||||
%if 0%{?with_python3}
|
%if %{with python3}
|
||||||
%files -n python3-%{pypi_name}
|
%files -n python3-%{pypi_name}
|
||||||
%doc README.md
|
%doc README.md
|
||||||
%license COPYING
|
%license COPYING
|
||||||
@ -110,9 +130,12 @@ done;
|
|||||||
%{python3_sitelib}/%{pypi_name}.py*
|
%{python3_sitelib}/%{pypi_name}.py*
|
||||||
%{python3_sitelib}/__pycache__/*
|
%{python3_sitelib}/__pycache__/*
|
||||||
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
|
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
|
||||||
%endif
|
%endif # with python3
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Mar 15 2018 Charalampos Stratakis <cstratak@redhat.com> - 1.21-2
|
||||||
|
- Don't build Python 2 subpackage on EL > 7
|
||||||
|
|
||||||
* Tue Feb 6 2018 Alfredo Moralejo <amoralej@redhat.com> - 1.21-1
|
* Tue Feb 6 2018 Alfredo Moralejo <amoralej@redhat.com> - 1.21-1
|
||||||
- Update to 1.21
|
- Update to 1.21
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user