5c743a
%if 0%{?fedora} || 0%{?rhel} > 7
5c743a
# Enable python3 build by default
5c743a
%bcond_without python3
5c743a
%else
5c743a
%bcond_with python3
5c743a
%endif
5c743a
5c743a
%if 0%{?fedora} > 31 || 0%{?rhel} > 7
5c743a
# Disable python2 build by default
5c743a
%bcond_with python2
5c743a
%else
5c743a
%bcond_without python2
5c743a
%endif
5c743a
5c743a
%bcond_with tests
5c743a
5c743a
%{!?python3_pkgversion:%global python3_pkgversion 3}
5c743a
5c743a
%global srcname cryptography
5c743a
5c743a
Name:           python-%{srcname}
5c743a
Version:        2.8
5c743a
Release:        3%{?dist}
5c743a
Summary:        PyCA's cryptography library
5c743a
5c743a
License:        ASL 2.0 or BSD
5c743a
URL:            https://cryptography.io/en/latest/
5c743a
Source0:        https://pypi.io/packages/source/c/%{srcname}/%{srcname}-%{version}.tar.gz
5c743a
5c743a
# Exclude i686 arch. Due to a modularity issue it's being added to the
5c743a
# x86_64 compose of CRB, but we don't want to ship it at all.
5c743a
# See: https://projects.engineering.redhat.com/browse/RCM-72605
5c743a
ExcludeArch: i686
5c743a
5c743a
BuildRequires:  openssl-devel
5c743a
BuildRequires:  gcc
5c743a
5c743a
%if 0%{?with_python2}
5c743a
BuildRequires:  python2-asn1crypto >= 0.21
5c743a
BuildRequires:  python2-cffi >= 1.7
5c743a
BuildRequires:  python2-cryptography-vectors = %{version}
5c743a
BuildRequires:  python2-devel
5c743a
BuildRequires:  python2-enum34
5c743a
BuildRequires:  python2-idna >= 2.1
5c743a
BuildRequires:  python2-ipaddress
5c743a
BuildRequires:  python2-setuptools
5c743a
BuildRequires:  python2-six >= 1.4.1
5c743a
5c743a
%if %{with tests}
5c743a
BuildRequires:  python2-hypothesis >= 1.11.4
5c743a
BuildRequires:  python2-iso8601
5c743a
BuildRequires:  python2-pretend
5c743a
BuildRequires:  python2-pytest >= 3.2.1
5c743a
BuildRequires:  python2-pytz
5c743a
%endif
5c743a
%endif
5c743a
5c743a
%if 0%{?with_python3}
5c743a
BuildRequires:  python%{python3_pkgversion}-asn1crypto >= 0.21
5c743a
BuildRequires:  python%{python3_pkgversion}-cffi >= 1.7
5c743a
BuildRequires:  python%{python3_pkgversion}-devel
5c743a
BuildRequires:  python%{python3_pkgversion}-idna >= 2.1
5c743a
BuildRequires:  python%{python3_pkgversion}-setuptools
5c743a
BuildRequires:  python%{python3_pkgversion}-six >= 1.4.1
5c743a
BuildRequires:  python%{python3_pkgversion}-rpm-macros
5c743a
5c743a
%if %{with tests}
5c743a
BuildRequires:  python%{python3_pkgversion}-cryptography-vectors = %{version}
5c743a
BuildRequires:  python%{python3_pkgversion}-hypothesis >= 1.11.4
5c743a
BuildRequires:  python%{python3_pkgversion}-iso8601
5c743a
BuildRequires:  python%{python3_pkgversion}-pretend
5c743a
BuildRequires:  python%{python3_pkgversion}-pytest >= 3.2.1
5c743a
BuildRequires:  python%{python3_pkgversion}-pytz
5c743a
%endif
5c743a
%endif
5c743a
5c743a
%description
5c743a
cryptography is a package designed to expose cryptographic primitives and
5c743a
recipes to Python developers.
5c743a
5c743a
%if 0%{?with_python2}
5c743a
%package -n  python2-%{srcname}
5c743a
Summary:        PyCA's cryptography library
5c743a
5c743a
%if 0%{?with_python3}
5c743a
%{?python_provide:%python_provide python2-%{srcname}}
5c743a
%else
5c743a
Provides:       python-%{srcname}
5c743a
%endif
5c743a
5c743a
Requires:       openssl-libs
5c743a
Requires:       python2-idna >= 2.1
5c743a
Requires:       python2-asn1crypto >= 0.21
5c743a
Requires:       python2-six >= 1.4.1
5c743a
Requires:       python2-cffi >= 1.7
5c743a
Requires:       python2-enum34
5c743a
Requires:       python2-ipaddress
5c743a
5c743a
%description -n python2-%{srcname}
5c743a
cryptography is a package designed to expose cryptographic primitives and
5c743a
recipes to Python developers.
5c743a
%endif
5c743a
5c743a
%if 0%{?with_python3}
5c743a
%package -n  python%{python3_pkgversion}-%{srcname}
5c743a
Summary:        PyCA's cryptography library
5c743a
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
5c743a
5c743a
Requires:       openssl-libs
5c743a
Requires:       python%{python3_pkgversion}-idna >= 2.1
5c743a
Requires:       python%{python3_pkgversion}-asn1crypto >= 0.21
5c743a
Requires:       python%{python3_pkgversion}-six >= 1.4.1
5c743a
Requires:       python%{python3_pkgversion}-cffi >= 1.7
5c743a
5c743a
%description -n python%{python3_pkgversion}-%{srcname}
5c743a
cryptography is a package designed to expose cryptographic primitives and
5c743a
recipes to Python developers.
5c743a
%endif
5c743a
5c743a
%prep
5c743a
%autosetup -p1 -n %{srcname}-%{version}
5c743a
5c743a
%build
5c743a
%if 0%{?with_python2}
5c743a
%py2_build
5c743a
%endif
5c743a
%if 0%{?with_python3}
5c743a
%py3_build
5c743a
%endif
5c743a
5c743a
%install
5c743a
# Actually other *.c and *.h are appropriate
5c743a
# see https://github.com/pyca/cryptography/issues/1463
5c743a
find . -name .keep -print -delete
5c743a
5c743a
%if 0%{?with_python2}
5c743a
%py2_install
5c743a
%endif
5c743a
%if 0%{?with_python3}
5c743a
%py3_install
5c743a
%endif
5c743a
5c743a
%check
5c743a
%if %{with tests}
5c743a
%if 0%{?with_python2}
5c743a
# see https://github.com/pyca/cryptography/issues/4885 and
5c743a
# see https://bugzilla.redhat.com/show_bug.cgi?id=1761194 for deselected tests
5c743a
PYTHONPATH=%{buildroot}%{python2_sitearch} %{__python2} -m pytest -k "not (test_buffer_protocol_alternate_modes or test_dh_parameters_supported or test_load_ecdsa_no_named_curve)"
5c743a
%endif
5c743a
5c743a
%if 0%{?with_python3}
5c743a
PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -m pytest -k "not (test_buffer_protocol_alternate_modes or test_dh_parameters_supported or test_load_ecdsa_no_named_curve)"
5c743a
%endif
5c743a
%endif
5c743a
5c743a
5c743a
%if 0%{?with_python2}
5c743a
%files -n python2-%{srcname}
5c743a
%doc LICENSE LICENSE.APACHE LICENSE.BSD README.rst docs
5c743a
%{python2_sitearch}/%{srcname}
5c743a
%{python2_sitearch}/%{srcname}-%{version}-py*.egg-info
5c743a
%endif
5c743a
5c743a
5c743a
%if 0%{?with_python3}
5c743a
%files -n python%{python3_pkgversion}-%{srcname}
5c743a
%doc README.rst docs
5c743a
%license LICENSE LICENSE.APACHE LICENSE.BSD
5c743a
%{python3_sitearch}/%{srcname}
5c743a
%{python3_sitearch}/%{srcname}-%{version}-py*.egg-info
5c743a
%endif
5c743a
5c743a
5c743a
%changelog
5c743a
* Fri Dec 13 2019 Tomas Orsava <torsava@redhat.com> - 2.8-3
5c743a
- Exclude unsupported i686 arch
5c743a
5c743a
* Thu Nov 21 2019 Lumír Balhar <lbalhar@redhat.com> - 2.8-2
5c743a
- Adjusted for Python 3.8 module in RHEL 8
5c743a
5c743a
* Thu Oct 17 2019 Christian Heimes <cheimes@redhat.com> - 2.8-1
5c743a
- Update to 2.8
5c743a
- Resolves: rhbz#1762779
5c743a
5c743a
* Sun Oct 13 2019 Christian Heimes <cheimes@redhat.com> - 2.7-3
5c743a
- Skip unit tests that fail with OpenSSL 1.1.1.d
5c743a
- Resolves: rhbz#1761194
5c743a
- Fix and simplify Python 3 packaging
5c743a
5c743a
* Sat Oct 12 2019 Christian Heimes <cheimes@redhat.com> - 2.7-2
5c743a
- Drop Python 2 package
5c743a
- Resolves: rhbz#1761081
5c743a
5c743a
* Tue Sep 03 2019 Randy Barlow <bowlofeggs@fedoraproject.org> - 2.7-1
5c743a
- Update to 2.7 (#1715680).
5c743a
5c743a
* Fri Aug 16 2019 Miro Hrončok <mhroncok@redhat.com> - 2.6.1-3
5c743a
- Rebuilt for Python 3.8
5c743a
5c743a
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-2
5c743a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
5c743a
5c743a
* Thu Feb 28 2019 Christian Heimes <cheimes@redhat.com> - 2.6.1-1
5c743a
- New upstream release 2.6.1, resolves RHBZ#1683691
5c743a
5c743a
* Wed Feb 13 2019 Alfredo Moralejo <amoralej@redhat.com> - 2.5-1
5c743a
- Updated to 2.5.
5c743a
5c743a
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.3-3
5c743a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
5c743a
5c743a
* Mon Aug 13 2018 Christian Heimes <cheimes@redhat.com> - 2.3-2
5c743a
- Use TLSv1.2 in test as workaround for RHBZ#1615143
5c743a
5c743a
* Wed Jul 18 2018 Christian Heimes <cheimes@redhat.com> - 2.3-1
5c743a
- New upstream release 2.3
5c743a
- Fix AEAD tag truncation bug, RHBZ#1602752
5c743a
5c743a
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-3
5c743a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
5c743a
5c743a
* Fri Jun 15 2018 Miro Hrončok <mhroncok@redhat.com> - 2.2.1-2
5c743a
- Rebuilt for Python 3.7
5c743a
5c743a
* Wed Mar 21 2018 Christian Heimes <cheimes@redhat.com> - 2.2.1-1
5c743a
- New upstream release 2.2.1
5c743a
5c743a
* Sun Feb 18 2018 Christian Heimes <cheimes@redhat.com> - 2.1.4-1
5c743a
- New upstream release 2.1.4
5c743a
5c743a
* Sun Feb 18 2018 Christian Heimes <cheimes@redhat.com> - 2.1.3-4
5c743a
- Build requires gcc
5c743a
5c743a
* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.1.3-3
5c743a
- Update Python 2 dependency declarations to new packaging standards
5c743a
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
5c743a
5c743a
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-2
5c743a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild