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