Drop Python 2 package

Resolves: rhbz#1761081
This commit is contained in:
Christian Heimes 2019-10-12 21:11:54 +02:00
parent 81f93220de
commit 1ba330ec74

View File

@ -1,8 +1,15 @@
%if 0%{?fedora} || 0%{?rhel} >= 8
%global with_python3 1
%if 0%{?fedora} || 0%{?rhel} > 7
# Enable python3 build by default
%bcond_without python3
%else
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%bcond_with python3
%endif
%if 0%{?fedora} > 31 || 0%{?rhel} > 7
# Disable python2 build by default
%bcond_with python2
%else
%bcond_without python2
%endif
%{!?python3_pkgversion:%global python3_pkgversion 3}
@ -11,7 +18,7 @@
Name: python-%{srcname}
Version: 2.7
Release: 1%{?dist}
Release: 2%{?dist}
Summary: PyCA's cryptography library
License: ASL 2.0 or BSD
@ -21,6 +28,7 @@ Source0: https://pypi.io/packages/source/c/%{srcname}/%{srcname}-%{versio
BuildRequires: openssl-devel
BuildRequires: gcc
%if 0%{?with_python2}
BuildRequires: python2-devel
BuildRequires: python2-pytest >= 3.2.1
BuildRequires: python2-setuptools
@ -36,6 +44,7 @@ BuildRequires: python2-six >= 1.4.1
BuildRequires: python2-cffi >= 1.7
BuildRequires: python2-enum34
BuildRequires: python2-ipaddress
%endif
%if 0%{?with_python3}
BuildRequires: python%{python3_pkgversion}-devel
@ -57,6 +66,7 @@ BuildRequires: python%{python3_pkgversion}-cffi >= 1.7
cryptography is a package designed to expose cryptographic primitives and
recipes to Python developers.
%if 0%{?with_python2}
%package -n python2-%{srcname}
Summary: PyCA's cryptography library
@ -77,6 +87,7 @@ Requires: python2-ipaddress
%description -n python2-%{srcname}
cryptography is a package designed to expose cryptographic primitives and
recipes to Python developers.
%endif
%if 0%{?with_python3}
%package -n python%{python3_pkgversion}-%{srcname}
@ -104,33 +115,33 @@ find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}
%endif
%build
%if 0%{?with_python3}
%if 0%{?with_python2}
%py2_build
%endif
%if 0%{?with_python3}
pushd %{py3dir}
%py3_build
popd
%else
%{__python2} setup.py build
%endif # with_python3
%endif
%install
# Actually other *.c and *.h are appropriate
# see https://github.com/pyca/cryptography/issues/1463
find . -name .keep -print -delete
%if 0%{?with_python3}
%if 0%{?with_python2}
%py2_install
%endif
%if 0%{?with_python3}
pushd %{py3dir}
%py3_install
popd
%else
%{__python2} setup.py install --skip-build --prefix=%{_prefix} --root %{buildroot}
%endif # with_python3
%endif
%check
%if 0%{?with_python2}
# see https://github.com/pyca/cryptography/issues/4885 for the deselected test
PYTHONPATH=%{buildroot}%{python2_sitearch} %{__python2} -m pytest -k "not test_buffer_protocol_alternate_modes[mode5]"
%endif
%if 0%{?with_python3}
pushd %{py3dir}
@ -139,10 +150,12 @@ popd
%endif
%if 0%{?with_python2}
%files -n python2-%{srcname}
%doc LICENSE LICENSE.APACHE LICENSE.BSD README.rst docs
%{python2_sitearch}/%{srcname}
%{python2_sitearch}/%{srcname}-%{version}-py*.egg-info
%endif
%if 0%{?with_python3}
@ -155,6 +168,10 @@ popd
%changelog
* Sat Oct 12 2019 Christian Heimes <cheimes@redhat.com> - 2.7-2
- Drop Python 2 package
- Resolves: rhbz#1761081
* Tue Sep 03 2019 Randy Barlow <bowlofeggs@fedoraproject.org> - 2.7-1
- Update to 2.7 (#1715680).