1ba330
%if 0%{?fedora} || 0%{?rhel} > 7
1ba330
# Enable python3 build by default
1ba330
%bcond_without python3
5eac1c
%else
1ba330
%bcond_with python3
1ba330
%endif
1ba330
1ba330
%if 0%{?fedora} > 31 || 0%{?rhel} > 7
1ba330
# Disable python2 build by default
1ba330
%bcond_with python2
1ba330
%else
1ba330
%bcond_without python2
5eac1c
%endif
5eac1c
c3f035
%bcond_without tests
c3f035
0e5020
%{!?python3_pkgversion:%global python3_pkgversion 3}
0e5020
f23f1e
%global srcname cryptography
f23f1e
f23f1e
Name:           python-%{srcname}
6417bb
Version:        3.2.1
181189
Release:        1%{?dist}
5eac1c
Summary:        PyCA's cryptography library
5eac1c
2b9cc1
License:        ASL 2.0 or BSD
5eac1c
URL:            https://cryptography.io/en/latest/
18a3ed
Source0:        %{pypi_source}
18a3ed
Source1:        %{pypi_source}.asc
18a3ed
# key ids of upstream authors are published in the AUTHORS file:
18a3ed
#    https://github.com/pyca/cryptography/blob/master/AUTHORS.rst
18a3ed
# gpg2 --recv-keys "05FD 9FA1 6CF7 5735 0D91 A560 235A E5F1 29F9 ED98"
18a3ed
# gpg2 --export --export-options export-minimal "05FD 9FA1 6CF7 5735 0D91 A560 235A E5F1 29F9 ED98" > gpgkey-05FD_9FA1_6CF7_5735_0D91_A560_235A_E5F1_29F9_ED98.gpg
18a3ed
Source2:        gpgkey-05FD_9FA1_6CF7_5735_0D91_A560_235A_E5F1_29F9_ED98.gpg
5eac1c
5eac1c
BuildRequires:  openssl-devel
985a0e
BuildRequires:  gcc
18a3ed
BuildRequires:  gnupg2
27ec70
1ba330
%if 0%{?with_python2}
f23f1e
BuildRequires:  python2-cffi >= 1.7
c3f035
BuildRequires:  python2-cryptography-vectors = %{version}
c3f035
BuildRequires:  python2-devel
229133
BuildRequires:  python2-enum34
c3f035
BuildRequires:  python2-idna >= 2.1
229133
BuildRequires:  python2-ipaddress
c3f035
BuildRequires:  python2-setuptools
c3f035
BuildRequires:  python2-six >= 1.4.1
c3f035
c3f035
%if %{with tests}
c3f035
BuildRequires:  python2-hypothesis >= 1.11.4
c3f035
BuildRequires:  python2-iso8601
c3f035
BuildRequires:  python2-pretend
c3f035
BuildRequires:  python2-pytest >= 3.2.1
c3f035
BuildRequires:  python2-pytz
c3f035
%endif
1ba330
%endif
27ec70
5eac1c
%if 0%{?with_python3}
c3f035
BuildRequires:  python%{python3_pkgversion}-cffi >= 1.7
f23f1e
BuildRequires:  python%{python3_pkgversion}-devel
c3f035
BuildRequires:  python%{python3_pkgversion}-idna >= 2.1
f23f1e
BuildRequires:  python%{python3_pkgversion}-setuptools
c3f035
BuildRequires:  python%{python3_pkgversion}-six >= 1.4.1
c3f035
c3f035
%if %{with tests}
f23f1e
BuildRequires:  python%{python3_pkgversion}-cryptography-vectors = %{version}
f23f1e
BuildRequires:  python%{python3_pkgversion}-hypothesis >= 1.11.4
c3f035
BuildRequires:  python%{python3_pkgversion}-iso8601
c3f035
BuildRequires:  python%{python3_pkgversion}-pretend
c3f035
BuildRequires:  python%{python3_pkgversion}-pytest >= 3.2.1
f23f1e
BuildRequires:  python%{python3_pkgversion}-pytz
c3f035
%endif
5eac1c
%endif
5eac1c
5eac1c
%description
5eac1c
cryptography is a package designed to expose cryptographic primitives and
5eac1c
recipes to Python developers.
5eac1c
1ba330
%if 0%{?with_python2}
f23f1e
%package -n  python2-%{srcname}
777ef8
Summary:        PyCA's cryptography library
b27a5f
9e5219
%if 0%{?with_python3}
f23f1e
%{?python_provide:%python_provide python2-%{srcname}}
b27a5f
%else
f23f1e
Provides:       python-%{srcname}
b27a5f
%endif
777ef8
Colin Walters bd2b6c
Requires:       openssl-libs
f23f1e
Requires:       python2-idna >= 2.1
f23f1e
Requires:       python2-six >= 1.4.1
f23f1e
Requires:       python2-cffi >= 1.7
229133
Requires:       python2-enum34
229133
Requires:       python2-ipaddress
777ef8
f23f1e
%description -n python2-%{srcname}
777ef8
cryptography is a package designed to expose cryptographic primitives and
777ef8
recipes to Python developers.
1ba330
%endif
777ef8
5eac1c
%if 0%{?with_python3}
f23f1e
%package -n  python%{python3_pkgversion}-%{srcname}
5eac1c
Summary:        PyCA's cryptography library
f23f1e
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
5eac1c
Colin Walters bd2b6c
Requires:       openssl-libs
f23f1e
Requires:       python%{python3_pkgversion}-idna >= 2.1
f23f1e
Requires:       python%{python3_pkgversion}-six >= 1.4.1
f23f1e
Requires:       python%{python3_pkgversion}-cffi >= 1.7
5eac1c
f23f1e
%description -n python%{python3_pkgversion}-%{srcname}
5eac1c
cryptography is a package designed to expose cryptographic primitives and
5eac1c
recipes to Python developers.
5eac1c
%endif
5eac1c
5eac1c
%prep
18a3ed
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
f23f1e
%autosetup -p1 -n %{srcname}-%{version}
5eac1c
5eac1c
%build
1ba330
%if 0%{?with_python2}
9e5219
%py2_build
1ba330
%endif
1ba330
%if 0%{?with_python3}
f23f1e
%py3_build
1ba330
%endif
5eac1c
5eac1c
%install
5eac1c
# Actually other *.c and *.h are appropriate
5eac1c
# see https://github.com/pyca/cryptography/issues/1463
5eac1c
find . -name .keep -print -delete
5eac1c
1ba330
%if 0%{?with_python2}
9e5219
%py2_install
1ba330
%endif
1ba330
%if 0%{?with_python3}
f23f1e
%py3_install
1ba330
%endif
5eac1c
5eac1c
%check
c3f035
%if %{with tests}
1ba330
%if 0%{?with_python2}
16edeb
# see https://github.com/pyca/cryptography/issues/4885 and
16edeb
# see https://bugzilla.redhat.com/show_bug.cgi?id=1761194 for deselected tests
16edeb
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)"
1ba330
%endif
5eac1c
5eac1c
%if 0%{?with_python3}
16edeb
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)"
5eac1c
%endif
c3f035
%endif
5eac1c
5eac1c
1ba330
%if 0%{?with_python2}
f23f1e
%files -n python2-%{srcname}
2b9cc1
%doc LICENSE LICENSE.APACHE LICENSE.BSD README.rst docs
0e5020
%{python2_sitearch}/%{srcname}
0e5020
%{python2_sitearch}/%{srcname}-%{version}-py*.egg-info
1ba330
%endif
5eac1c
5eac1c
5eac1c
%if 0%{?with_python3}
f23f1e
%files -n python%{python3_pkgversion}-%{srcname}
f23f1e
%doc README.rst docs
f23f1e
%license LICENSE LICENSE.APACHE LICENSE.BSD
16edeb
%{python3_sitearch}/%{srcname}
f23f1e
%{python3_sitearch}/%{srcname}-%{version}-py*.egg-info
5eac1c
%endif
5eac1c
5eac1c
5eac1c
%changelog
6417bb
* Wed Oct 28 2020 Christian Heimes <cheimes@redhat.com> - 3.2.1-1
6417bb
- Update to 3.2.1 (#1892153)
6417bb
2abb98
* Mon Oct 26 2020 Christian Heimes <cheimes@redhat.com> - 3.2-1
2abb98
- Update to 3.2 (#1891378)
2abb98
181189
* Mon Sep 07 2020 Christian Heimes <cheimes@redhat.com> - 3.1-1
181189
- Update to 3.1 (#1872978)
181189
0656b7
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-2
0656b7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
0656b7
799485
* Tue Jul 21 2020 Christian Heimes <cheimes@redhat.com> - 3.0-1
799485
- Update to 3.0 (#185897)
799485
a2b3c4
* Sat May 23 2020 Miro Hrončok <mhroncok@redhat.com> - 2.9-3
a2b3c4
- Rebuilt for Python 3.9
a2b3c4
18a3ed
* Tue May 12 2020 Felix Schwarz <fschwarz@fedoraproject.org> - 2.9-2
18a3ed
- add source file verification
18a3ed
4d9082
* Fri Apr 03 2020 Christian Heimes <cheimes@redhat.com> - 2.9-1
4d9082
- Update to 2.9 (#1820348)
4d9082
71ca0a
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.8-3
71ca0a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
71ca0a
52a293
* Mon Jan 13 2020 Christian Heimes <cheimes@redhat.com> - 2.8-2
52a293
- cryptography 2.8+ no longer depends on python-asn1crypto
52a293
004fe0
* Thu Oct 17 2019 Christian Heimes <cheimes@redhat.com> - 2.8-1
004fe0
- Update to 2.8
004fe0
- Resolves: rhbz#1762779
004fe0
16edeb
* Sun Oct 13 2019 Christian Heimes <cheimes@redhat.com> - 2.7-3
16edeb
- Skip unit tests that fail with OpenSSL 1.1.1.d
16edeb
- Resolves: rhbz#1761194
16edeb
- Fix and simplify Python 3 packaging
16edeb
1ba330
* Sat Oct 12 2019 Christian Heimes <cheimes@redhat.com> - 2.7-2
1ba330
- Drop Python 2 package
1ba330
- Resolves: rhbz#1761081
1ba330
0deb0e
* Tue Sep 03 2019 Randy Barlow <bowlofeggs@fedoraproject.org> - 2.7-1
0deb0e
- Update to 2.7 (#1715680).
0deb0e
3f9ce0
* Fri Aug 16 2019 Miro Hrončok <mhroncok@redhat.com> - 2.6.1-3
3f9ce0
- Rebuilt for Python 3.8
3f9ce0
7395bb
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-2
7395bb
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
7395bb
080edf
* Thu Feb 28 2019 Christian Heimes <cheimes@redhat.com> - 2.6.1-1
080edf
- New upstream release 2.6.1, resolves RHBZ#1683691
080edf
437c09
* Wed Feb 13 2019 Alfredo Moralejo <amoralej@redhat.com> - 2.5-1
437c09
- Updated to 2.5.
437c09
3b9421
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.3-3
3b9421
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
3b9421
f0e48c
* Mon Aug 13 2018 Christian Heimes <cheimes@redhat.com> - 2.3-2
f0e48c
- Use TLSv1.2 in test as workaround for RHBZ#1615143
f0e48c
aa2212
* Wed Jul 18 2018 Christian Heimes <cheimes@redhat.com> - 2.3-1
aa2212
- New upstream release 2.3
aa2212
- Fix AEAD tag truncation bug, RHBZ#1602752
aa2212
ee5c33
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-3
ee5c33
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
ee5c33
8390e4
* Fri Jun 15 2018 Miro Hrončok <mhroncok@redhat.com> - 2.2.1-2
8390e4
- Rebuilt for Python 3.7
8390e4
0bfc45
* Wed Mar 21 2018 Christian Heimes <cheimes@redhat.com> - 2.2.1-1
0bfc45
- New upstream release 2.2.1
0bfc45
e6b5d1
* Sun Feb 18 2018 Christian Heimes <cheimes@redhat.com> - 2.1.4-1
e6b5d1
- New upstream release 2.1.4
e6b5d1
985a0e
* Sun Feb 18 2018 Christian Heimes <cheimes@redhat.com> - 2.1.3-4
985a0e
- Build requires gcc
985a0e
229133
* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.1.3-3
229133
- Update Python 2 dependency declarations to new packaging standards
229133
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
229133
7739c4
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-2
7739c4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild