Remove Python 2 subpackages from F32+

Resolves: RHBZ #1746760
This commit is contained in:
Christian Heimes 2019-08-29 10:48:06 +02:00
parent 4622076ac8
commit ce2224ea4f

View File

@ -1,12 +1,22 @@
%if 0%{?fedora} %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%{?fedora} > 31 || 0%{?rhel} > 7
# Disable python2 build by default
%bcond_with python2
%else
%bcond_without python2
%endif %endif
%global srcname jwcrypto %global srcname jwcrypto
Name: python-%{srcname} Name: python-%{srcname}
Version: 0.6.0 Version: 0.6.0
Release: 4%{?dist} Release: 5%{?dist}
Summary: Implements JWK, JWS, JWE specifications using python-cryptography Summary: Implements JWK, JWS, JWE specifications using python-cryptography
License: LGPLv3+ License: LGPLv3+
@ -14,10 +24,12 @@ URL: https://github.com/latchset/%{srcname}
Source0: https://github.com/latchset/%{srcname}/releases/download/v%{version}/%{srcname}-%{version}.tar.gz Source0: https://github.com/latchset/%{srcname}/releases/download/v%{version}/%{srcname}-%{version}.tar.gz
BuildArch: noarch BuildArch: noarch
%if 0%{?with_python2}
BuildRequires: python2-devel BuildRequires: python2-devel
BuildRequires: python2-setuptools BuildRequires: python2-setuptools
BuildRequires: python2-cryptography >= 1.5 BuildRequires: python2-cryptography >= 1.5
BuildRequires: python2-pytest BuildRequires: python2-pytest
%endif
%if 0%{?with_python3} %if 0%{?with_python3}
BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-devel
@ -30,6 +42,7 @@ BuildRequires: python%{python3_pkgversion}-pytest
Implements JWK, JWS, JWE specifications using python-cryptography Implements JWK, JWS, JWE specifications using python-cryptography
%if 0%{?with_python2}
%package -n python2-%{srcname} %package -n python2-%{srcname}
Summary: Implements JWK,JWS,JWE specifications using python-cryptography Summary: Implements JWK,JWS,JWE specifications using python-cryptography
Requires: python2-cryptography >= 1.5 Requires: python2-cryptography >= 1.5
@ -37,6 +50,7 @@ Requires: python2-cryptography >= 1.5
%description -n python2-%{srcname} %description -n python2-%{srcname}
Implements JWK, JWS, JWE specifications using python-cryptography Implements JWK, JWS, JWE specifications using python-cryptography
%endif
%if 0%{?with_python3} %if 0%{?with_python3}
@ -55,38 +69,48 @@ Implements JWK, JWS, JWE specifications using python-cryptography
%build %build
%if 0%{?with_python2}
%py2_build %py2_build
%endif
%if 0%{?with_python3} %if 0%{?with_python3}
%py3_build %py3_build
%endif %endif
%check %check
%if 0%{?with_python2}
%{__python2} -bb -m pytest %{srcname}/test*.py %{__python2} -bb -m pytest %{srcname}/test*.py
%endif
%if 0%{?with_python3} %if 0%{?with_python3}
%{__python3} -bb -m pytest %{srcname}/test*.py %{__python3} -bb -m pytest %{srcname}/test*.py
%endif %endif
%install %install
%if 0%{?with_python2}
%py2_install %py2_install
%endif
%if 0%{?with_python3} %if 0%{?with_python3}
%py3_install %py3_install
%endif %endif
rm -rf %{buildroot}%{_docdir}/%{srcname} rm -rf %{buildroot}%{_docdir}/%{srcname}
%if 0%{?with_python2}
rm -rf %{buildroot}%{python2_sitelib}/%{srcname}/tests{,-cookbook}.py* rm -rf %{buildroot}%{python2_sitelib}/%{srcname}/tests{,-cookbook}.py*
%endif
%if 0%{?with_python3} %if 0%{?with_python3}
rm -rf %{buildroot}%{python3_sitelib}/%{srcname}/tests{,-cookbook}.py* rm -rf %{buildroot}%{python3_sitelib}/%{srcname}/tests{,-cookbook}.py*
rm -rf %{buildroot}%{python3_sitelib}/%{srcname}/__pycache__/tests{,-cookbook}.*.py* rm -rf %{buildroot}%{python3_sitelib}/%{srcname}/__pycache__/tests{,-cookbook}.*.py*
%endif %endif
%if 0%{?with_python2}
%files -n python2-%{srcname} %files -n python2-%{srcname}
%doc README.md %doc README.md
%license LICENSE %license LICENSE
%{python2_sitelib}/%{srcname} %{python2_sitelib}/%{srcname}
%{python2_sitelib}/%{srcname}-%{version}-py%{python2_version}.egg-info %{python2_sitelib}/%{srcname}-%{version}-py%{python2_version}.egg-info
%endif
%if 0%{?with_python3} %if 0%{?with_python3}
%files -n python%{python3_pkgversion}-%{srcname} %files -n python%{python3_pkgversion}-%{srcname}
@ -98,6 +122,10 @@ rm -rf %{buildroot}%{python3_sitelib}/%{srcname}/__pycache__/tests{,-cookbook}.*
%changelog %changelog
* Thu Aug 29 2019 Christian Heimes <cheimes@redhat.com> - 0.6.0-5
- Remove Python 2 subpackages from F32+
- Resolves: RHBZ #1746760
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.6.0-4 * Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.6.0-4
- Rebuilt for Python 3.8 - Rebuilt for Python 3.8