Conditionalize the Python 2 subpackage and don't build it on EL > 7
Some SPEC modernizations.
This commit is contained in:
parent
76f4d42e9e
commit
12d96e9ae5
@ -2,12 +2,22 @@
|
||||
%global github_name python-json-pointer
|
||||
|
||||
%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
|
||||
|
||||
Name: python-%{pypi_name}
|
||||
Version: 1.10
|
||||
Release: 10%{?dist}
|
||||
Release: 11%{?dist}
|
||||
Summary: Resolve JSON Pointers in Python
|
||||
|
||||
License: BSD
|
||||
@ -20,6 +30,7 @@ BuildArch: noarch
|
||||
%description
|
||||
Library to resolve JSON Pointers according to RFC 6901.
|
||||
|
||||
%if %{with python2}
|
||||
%package -n python2-%{pypi_name}
|
||||
Summary: Resolve JSON Pointers in Python
|
||||
|
||||
@ -30,9 +41,9 @@ BuildRequires: python2-setuptools
|
||||
|
||||
%description -n python2-%{pypi_name}
|
||||
Library to resolve JSON Pointers according to RFC 6901.
|
||||
%endif # with python2
|
||||
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%if %{with python3}
|
||||
%package -n python3-%{pypi_name}
|
||||
Summary: Resolve JSON Pointers in Python
|
||||
|
||||
@ -43,50 +54,58 @@ BuildRequires: python3-setuptools
|
||||
|
||||
%description -n python3-%{pypi_name}
|
||||
Library to resolve JSON Pointers according to RFC 6901.
|
||||
%endif
|
||||
%endif # with python3
|
||||
|
||||
%prep
|
||||
%setup -q -n %{pypi_name}-%{version}
|
||||
|
||||
%build
|
||||
%if %{with python2}
|
||||
%py2_build
|
||||
%if 0%{?with_python3}
|
||||
%endif # with python2
|
||||
%if %{with python3}
|
||||
LC_ALL=en_US.UTF-8 %py3_build
|
||||
%endif
|
||||
%endif # with python3
|
||||
|
||||
%install
|
||||
%if %{with python2}
|
||||
%py2_install
|
||||
mv %{buildroot}%{_bindir}/jsonpointer %{buildroot}%{_bindir}/jsonpointer-%{python2_version}
|
||||
ln -s ./jsonpointer-%{python2_version} %{buildroot}%{_bindir}/jsonpointer-2
|
||||
%if !0%{?with_python3}
|
||||
%if %{without python3}
|
||||
ln -s ./jsonpointer-%{python2_version} %{buildroot}%{_bindir}/jsonpointer
|
||||
%endif
|
||||
%endif # without python3
|
||||
%endif # with python2
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%if %{with python3}
|
||||
LC_ALL=en_US.UTF-8 %py3_install
|
||||
mv %{buildroot}%{_bindir}/jsonpointer %{buildroot}%{_bindir}/jsonpointer-%{python3_version}
|
||||
ln -s ./jsonpointer-%{python3_version} %{buildroot}%{_bindir}/jsonpointer-3
|
||||
ln -s ./jsonpointer-%{python3_version} %{buildroot}%{_bindir}/jsonpointer
|
||||
%endif
|
||||
%endif # with python3
|
||||
|
||||
|
||||
%check
|
||||
%if 0%{?with_python3}
|
||||
%if %{with python3}
|
||||
%{__python3} tests.py
|
||||
%endif
|
||||
%{__python} tests.py
|
||||
%endif # with python3
|
||||
%if %{with python2}
|
||||
%{__python2} tests.py
|
||||
%endif # with python2
|
||||
|
||||
%if %{with python2}
|
||||
%files -n python2-%{pypi_name}
|
||||
%doc README.md AUTHORS
|
||||
%license COPYING
|
||||
%if !0%{?with_python3}
|
||||
%if %{without python3}
|
||||
%{_bindir}/jsonpointer
|
||||
%endif
|
||||
%endif # without python3
|
||||
%{_bindir}/jsonpointer-2*
|
||||
%{python_sitelib}/%{pypi_name}.py*
|
||||
%{python_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
|
||||
%{python2_sitelib}/%{pypi_name}.py*
|
||||
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
|
||||
%endif # with python2
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%if %{with python3}
|
||||
%files -n python3-%{pypi_name}
|
||||
%doc README.md AUTHORS
|
||||
%license COPYING
|
||||
@ -95,9 +114,12 @@ ln -s ./jsonpointer-%{python3_version} %{buildroot}%{_bindir}/jsonpointer
|
||||
%{python3_sitelib}/__pycache__/*
|
||||
%{python3_sitelib}/%{pypi_name}.py*
|
||||
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
|
||||
%endif
|
||||
%endif # with python3
|
||||
|
||||
%changelog
|
||||
* Tue Apr 03 2018 Charalampos Stratakis <cstratak@redhat.com> - 1.10-11
|
||||
- Conditionalize the Python 2 subpackage and don't build it on EL > 7
|
||||
|
||||
* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.10-10
|
||||
- Update Python 2 dependency declarations to new packaging standards
|
||||
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
|
||||
|
Loading…
Reference in New Issue
Block a user