5bc286
%if 0%{?fedora} || 0%{?rhel} > 7
5bc286
# Enable python3 build by default
5bc286
%bcond_without python3
5bc286
%else
5bc286
%bcond_with python3
5bc286
%endif
5bc286
5bc286
%if 0%{?rhel} > 7
5bc286
# Disable python2 build by default
5bc286
%bcond_with python2
5bc286
%else
5bc286
%bcond_without python2
5bc286
%endif
5bc286
5bc286
%{!?python3_pkgversion:%global python3_pkgversion 3}
5bc286
5bc286
%global srcname cryptography
5bc286
5bc286
Name:           python-%{srcname}
5bc286
Version:        2.3
5bc286
Release:        2%{?dist}
5bc286
Summary:        PyCA's cryptography library
5bc286
5bc286
Group:          Development/Libraries
5bc286
License:        ASL 2.0 or BSD
5bc286
URL:            https://cryptography.io/en/latest/
5bc286
Source0:        https://pypi.io/packages/source/c/%{srcname}/%{srcname}-%{version}.tar.gz
5bc286
5bc286
Patch0001:      0001-Fixed-4380-do-not-assume-TLSv1-is-available-in-OpenS.patch
5bc286
5bc286
BuildRequires:  openssl-devel
5bc286
BuildRequires:  gcc
5bc286
5bc286
%if 0%{?with_python2}
5bc286
BuildRequires:  python2-devel
5bc286
BuildRequires:  python2-pytest >= 3.2.1
5bc286
BuildRequires:  python2-setuptools
5bc286
BuildRequires:  python2-pretend
5bc286
BuildRequires:  python2-iso8601
5bc286
BuildRequires:  python2-cryptography-vectors = %{version}
5bc286
BuildRequires:  python2-asn1crypto >= 0.21
5bc286
BuildRequires:  python2-hypothesis >= 1.11.4
5bc286
BuildRequires:  python2-pytz
5bc286
5bc286
BuildRequires:  python2-idna >= 2.1
5bc286
BuildRequires:  python2-six >= 1.4.1
5bc286
BuildRequires:  python2-cffi >= 1.7
5bc286
BuildRequires:  python2-enum34
5bc286
BuildRequires:  python2-ipaddress
5bc286
%endif
5bc286
5bc286
%if 0%{?with_python3}
5bc286
BuildRequires:  python%{python3_pkgversion}-devel
5bc286
BuildRequires:  python%{python3_pkgversion}-pytest >= 3.2.1
5bc286
BuildRequires:  python%{python3_pkgversion}-setuptools
5bc286
BuildRequires:  python%{python3_pkgversion}-pretend
5bc286
BuildRequires:  python%{python3_pkgversion}-iso8601
5bc286
BuildRequires:  python%{python3_pkgversion}-cryptography-vectors = %{version}
5bc286
BuildRequires:  python%{python3_pkgversion}-asn1crypto >= 0.21
5bc286
BuildRequires:  python%{python3_pkgversion}-hypothesis >= 1.11.4
5bc286
BuildRequires:  python%{python3_pkgversion}-pytz
5bc286
5bc286
BuildRequires:  python%{python3_pkgversion}-idna >= 2.1
5bc286
BuildRequires:  python%{python3_pkgversion}-six >= 1.4.1
5bc286
BuildRequires:  python%{python3_pkgversion}-cffi >= 1.7
5bc286
%endif
5bc286
5bc286
%description
5bc286
cryptography is a package designed to expose cryptographic primitives and
5bc286
recipes to Python developers.
5bc286
5bc286
%if 0%{?with_python2}
5bc286
%package -n  python2-%{srcname}
5bc286
Group:          Development/Libraries
5bc286
Summary:        PyCA's cryptography library
5bc286
5bc286
%if 0%{?with_python3}
5bc286
%{?python_provide:%python_provide python2-%{srcname}}
5bc286
%else
5bc286
Provides:       python-%{srcname}
5bc286
%endif
5bc286
5bc286
Requires:       openssl-libs
5bc286
Requires:       python2-idna >= 2.1
5bc286
Requires:       python2-asn1crypto >= 0.21
5bc286
Requires:       python2-six >= 1.4.1
5bc286
Requires:       python2-cffi >= 1.7
5bc286
Requires:       python2-enum34
5bc286
Requires:       python2-ipaddress
5bc286
5bc286
%description -n python2-%{srcname}
5bc286
cryptography is a package designed to expose cryptographic primitives and
5bc286
recipes to Python developers.
5bc286
%endif
5bc286
5bc286
%if 0%{?with_python3}
5bc286
%package -n  python%{python3_pkgversion}-%{srcname}
5bc286
Group:          Development/Libraries
5bc286
Summary:        PyCA's cryptography library
5bc286
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
5bc286
5bc286
Requires:       openssl-libs
5bc286
Requires:       python%{python3_pkgversion}-idna >= 2.1
5bc286
Requires:       python%{python3_pkgversion}-asn1crypto >= 0.21
5bc286
Requires:       python%{python3_pkgversion}-six >= 1.4.1
5bc286
Requires:       python%{python3_pkgversion}-cffi >= 1.7
5bc286
5bc286
%description -n python%{python3_pkgversion}-%{srcname}
5bc286
cryptography is a package designed to expose cryptographic primitives and
5bc286
recipes to Python developers.
5bc286
%endif
5bc286
5bc286
%prep
5bc286
%autosetup -p1 -n %{srcname}-%{version}
5bc286
5bc286
%build
5bc286
%if 0%{?with_python2}
5bc286
%py2_build
5bc286
%endif
5bc286
%if 0%{?with_python3}
5bc286
%py3_build
5bc286
%endif
5bc286
5bc286
%install
5bc286
# Actually other *.c and *.h are appropriate
5bc286
# see https://github.com/pyca/cryptography/issues/1463
5bc286
find . -name .keep -print -delete
5bc286
5bc286
%if 0%{?with_python2}
5bc286
%py2_install
5bc286
%endif
5bc286
%if 0%{?with_python3}
5bc286
%py3_install
5bc286
%endif
5bc286
5bc286
5bc286
%check
5bc286
# workaround for pytest 3.2.0 bug https://github.com/pytest-dev/pytest/issues/2644
5bc286
rm -f tests/hazmat/primitives/test_padding.py
5bc286
%if 0%{?with_python2}
5bc286
%{__python2} setup.py test
5bc286
%endif
5bc286
%if 0%{?with_python3}
5bc286
%{__python3} setup.py test
5bc286
%endif
5bc286
5bc286
%if 0%{?with_python2}
5bc286
%files -n python2-%{srcname}
5bc286
%doc LICENSE LICENSE.APACHE LICENSE.BSD README.rst docs
5bc286
%{python2_sitearch}/%{srcname}
5bc286
%{python2_sitearch}/%{srcname}-%{version}-py*.egg-info
5bc286
%endif
5bc286
5bc286
%if 0%{?with_python3}
5bc286
%files -n python%{python3_pkgversion}-%{srcname}
5bc286
%doc README.rst docs
5bc286
%license LICENSE LICENSE.APACHE LICENSE.BSD
5bc286
%{python3_sitearch}/%{srcname}
5bc286
%{python3_sitearch}/%{srcname}-%{version}-py*.egg-info
5bc286
%endif
5bc286
5bc286
5bc286
%changelog
5bc286
* Mon Aug 13 2018 Christian Heimes <cheimes@redhat.com> - 2.3-2
5bc286
- Use TLSv1.2 in test as workaround for RHBZ#1615099
5bc286
- Resolves: RHBZ#1611738
5bc286
5bc286
* Wed Jul 18 2018 Christian Heimes <cheimes@redhat.com> - 2.3-1
5bc286
- New upstream release 2.3
5bc286
- Fix AEAD tag truncation bug, CVE-2018-10903, RHBZ#1602755, RHBZ#1602932
5bc286
5bc286
* Tue Jun 19 2018 Christian Heimes <cheimes@redhat.com> - 2.2.1-2
5bc286
- Drop Python 2 subpackages from RHEL 8, fixes RHBZ#1589754
5bc286
- Remove unnecessary copy and shebang mangling
5bc286
5bc286
* Wed Mar 21 2018 Christian Heimes <cheimes@redhat.com> - 2.2.1-1
5bc286
- New upstream release 2.2.1
5bc286
5bc286
* Sun Feb 18 2018 Christian Heimes <cheimes@redhat.com> - 2.1.4-1
5bc286
- New upstream release 2.1.4
5bc286
5bc286
* Sun Feb 18 2018 Christian Heimes <cheimes@redhat.com> - 2.1.3-4
5bc286
- Build requires gcc
5bc286
5bc286
* Mon Feb 12 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.1.3-3
5bc286
- Update Python 2 dependency declarations to new packaging standards
5bc286
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
5bc286
5bc286
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-2
5bc286
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
5bc286
5bc286
* Thu Nov 23 2017 Haïkel Guémar <hguemar@fedoraproject.org> - 2.1.3-1
5bc286
- Upstream 2.1.3
5bc286
5bc286
* Tue Oct 24 2017 Christian Heimes <cheimes@redhat.com> - 2.1-2
5bc286
- Change Requires to openssl-libs
5bc286
5bc286
* Thu Oct 12 2017 Christian Heimes <cheimes@redhat.com> - 2.1-1
5bc286
- New upstream release 2.1
5bc286
5bc286
* Wed Sep 27 2017 Troy Dawson <tdawson@redhat.com> - 2.0.2-3
5bc286
- Cleanup spec file conditionals
5bc286
5bc286
* Thu Aug 03 2017 Christian Heimes <cheimes@redhat.com> - 2.0.2-2
5bc286
- Add workaround for pytest bug
5bc286
5bc286
* Thu Aug 03 2017 Christian Heimes <cheimes@redhat.com> - 2.0.2-1
5bc286
- New upstream release 2.0.2
5bc286
- Modernize spec
5bc286
5bc286
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.9-3
5bc286
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
5bc286
5bc286
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.9-2
5bc286
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
5bc286
5bc286
* Tue Jun 27 2017 Christian Heimes <cheimes@redhat.com> - 1.9-1
5bc286
- Upstream release 1.9
5bc286
5bc286
* Wed Feb 15 2017 Christian Heimes <cheimes@redhat.com> - 1.7.2-1
5bc286
- Update to latest upstream
5bc286
5bc286
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.1-2
5bc286
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
5bc286
5bc286
* Thu Jan 05 2017 Matěj Cepl <mcepl@redhat.com> - 1.7.1-1
5bc286
- Update to the latest upstream.
5bc286
- Add a patch from https://github.com/pyca/cryptography/pull/3328
5bc286
5bc286
* Tue Dec 13 2016 Charalampos Stratakis <cstratak@redhat.com> - 1.5.3-5
5bc286
- Enable tests
5bc286
5bc286
* Mon Dec 12 2016 Charalampos Stratakis <cstratak@redhat.com> - 1.5.3-4
5bc286
- Rebuild for Python 3.6
5bc286
- Disable python3 tests for now
5bc286
5bc286
* Thu Nov 10 2016 Nathaniel McCallum <npmccallum@redhat.com> - 1.5.3-3
5bc286
- Revert previous change
5bc286
5bc286
* Thu Nov 10 2016 Nathaniel McCallum <npmccallum@redhat.com> - 1.5.3-2
5bc286
- Disable tests on releases earlier than 24
5bc286
5bc286
* Mon Nov 07 2016 Nathaniel McCallum <npmccallum@redhat.com> - 1.5.3-1
5bc286
- Update to v1.5.3
5bc286
- Update source URL
5bc286
- Add BR for pytz
5bc286
5bc286
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-4
5bc286
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
5bc286
5bc286
* Tue May 10 2016 Nathaniel McCallum <npmccallum@redhat.com> - 1.3.1-3
5bc286
- Remove versioned setuptools dependency
5bc286
5bc286
* Tue May 10 2016 Nathaniel McCallum <npmccallum@redhat.com> - 1.3.1-2
5bc286
- Make it easier to build on EL7
5bc286
5bc286
* Tue May 03 2016 Nathaniel McCallum <npmccallum@redhat.com> - 1.3.1-1
5bc286
- Update to v1.3.1
5bc286
5bc286
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-3
5bc286
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
5bc286
5bc286
* Mon Jan 11 2016 Nathaniel McCallum <npmccallum@redhat.com> - 1.2.1-2
5bc286
- Move python-cryptograph => python2-cryptography
5bc286
5bc286
* Sat Jan 09 2016 Nathaniel McCallum <npmccallum@redhat.com> - 1.2.1-1
5bc286
- Update to v1.2.1
5bc286
5bc286
* Wed Nov 11 2015 Robert Kuska <rkuska@redhat.com> - 1.1-1
5bc286
- Update to v1.1
5bc286
5bc286
* Wed Nov 04 2015 Robert Kuska <rkuska@redhat.com> - 1.0.2-2
5bc286
- Rebuilt for Python3.5 rebuild
5bc286
5bc286
* Wed Sep 30 2015 Matěj Cepl <mcepl@redhat.com> - 1.0.2-1
5bc286
- New upstream release (fix #1267548)
5bc286
5bc286
* Wed Aug 12 2015 Nathaniel McCallum <npmccallum@redhat.com> - 1.0-1
5bc286
- New upstream release
5bc286
5bc286
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9-2
5bc286
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
5bc286
5bc286
* Thu May 14 2015 Nathaniel McCallum <npmccallum@redhat.com> - 0.9-1
5bc286
- New upstream release
5bc286
- Run tests on RHEL
5bc286
- New deps: python-idna, python-ipaddress
5bc286
5bc286
* Fri Apr 17 2015 Nathaniel McCallum <npmccallum@redhat.com> - 0.8.2-1
5bc286
- New upstream release
5bc286
- Add python3-pyasn1 Requires (#1211073)
5bc286
5bc286
* Tue Apr 14 2015 Matej Cepl <mcepl@redhat.com> - 0.8-2
5bc286
- Add python-pyasn1 Requires (#1211073)
5bc286
5bc286
* Fri Mar 13 2015 Nathaniel McCallum <npmccallum@redhat.com> - 0.8-1
5bc286
- New upstream release
5bc286
- Remove upstreamed patch
5bc286
5bc286
* Wed Mar 04 2015 Nathaniel McCallum <npmccallum@redhat.com> - 0.7.2-2
5bc286
- Add python3-cryptography-vectors build requires
5bc286
- Add python-enum34 requires
5bc286
5bc286
* Tue Feb 03 2015 Nathaniel McCallum <npmccallum@redhat.com> - 0.7.2-1
5bc286
- New upstream release. BSD is now an optional license.
5bc286
- Fix test running on python3
5bc286
- Add upstream patch to fix test paths
5bc286
5bc286
* Fri Nov 07 2014 Matej Cepl <mcepl@redhat.com> - 0.6.1-2
5bc286
- Fix requires, for reasons why other development files were not
5bc286
  eliminated see https://github.com/pyca/cryptography/issues/1463.
5bc286
5bc286
* Wed Nov 05 2014 Matej Cepl <mcepl@redhat.com> - 0.6.1-1
5bc286
- New upstream release.
5bc286
5bc286
* Sun Jun 29 2014 Terry Chia <terrycwk1994@gmail.com> 0.4-1
5bc286
- initial version