2019-11-18 13:16:21 +00:00
|
|
|
%bcond_without tests
|
|
|
|
|
2017-08-03 14:31:52 +00:00
|
|
|
%{!?python3_pkgversion:%global python3_pkgversion 3}
|
|
|
|
|
2017-08-03 11:33:04 +00:00
|
|
|
%global srcname cryptography
|
|
|
|
|
|
|
|
Name: python-%{srcname}
|
2024-08-21 15:49:56 +00:00
|
|
|
Version: 43.0.0
|
|
|
|
Release: %autorelease
|
2014-11-21 05:21:59 +00:00
|
|
|
Summary: PyCA's cryptography library
|
|
|
|
|
2022-12-13 17:30:42 +00:00
|
|
|
# cryptography is dual licensed under the Apache-2.0 and BSD-3-Clause,
|
|
|
|
# as well as the Python Software Foundation license for the OS random
|
|
|
|
# engine derived by CPython.
|
|
|
|
License: (Apache-2.0 OR BSD-3-Clause) AND PSF-2.0
|
2014-11-21 05:21:59 +00:00
|
|
|
URL: https://cryptography.io/en/latest/
|
2021-04-21 11:39:53 +00:00
|
|
|
Source0: https://github.com/pyca/cryptography/archive/%{version}/%{srcname}-%{version}.tar.gz
|
2021-02-12 09:53:26 +00:00
|
|
|
# created by ./vendor_rust.py helper script
|
2021-04-21 11:39:53 +00:00
|
|
|
Source1: cryptography-%{version}-vendor.tar.bz2
|
|
|
|
Source2: conftest-skipper.py
|
2014-11-21 05:21:59 +00:00
|
|
|
|
2024-08-21 15:49:56 +00:00
|
|
|
Patch: 11328.patch
|
2024-09-12 15:22:54 +00:00
|
|
|
Patch: 11536.patch
|
2023-08-09 12:07:18 +00:00
|
|
|
|
2021-03-10 12:18:44 +00:00
|
|
|
ExclusiveArch: %{rust_arches}
|
|
|
|
|
2014-11-21 05:21:59 +00:00
|
|
|
BuildRequires: openssl-devel
|
2018-02-18 21:39:10 +00:00
|
|
|
BuildRequires: gcc
|
2020-05-12 08:39:43 +00:00
|
|
|
BuildRequires: gnupg2
|
2021-02-12 09:53:26 +00:00
|
|
|
%if 0%{?fedora}
|
2021-02-07 19:36:07 +00:00
|
|
|
BuildRequires: rust-packaging
|
2021-02-12 09:53:26 +00:00
|
|
|
%else
|
|
|
|
BuildRequires: rust-toolset
|
|
|
|
%endif
|
2015-03-04 18:03:20 +00:00
|
|
|
|
2023-03-09 07:19:18 +00:00
|
|
|
BuildRequires: python%{python3_pkgversion}-cffi >= 1.12
|
2017-08-03 11:33:04 +00:00
|
|
|
BuildRequires: python%{python3_pkgversion}-devel
|
|
|
|
BuildRequires: python%{python3_pkgversion}-setuptools
|
2023-03-09 07:19:18 +00:00
|
|
|
BuildRequires: python%{python3_pkgversion}-setuptools-rust >= 0.11.4
|
2019-11-18 13:16:21 +00:00
|
|
|
|
|
|
|
%if %{with tests}
|
2021-02-12 09:53:26 +00:00
|
|
|
%if 0%{?fedora}
|
2024-08-21 15:49:56 +00:00
|
|
|
BuildRequires: python%{python3_pkgversion}-certifi
|
2017-08-03 11:33:04 +00:00
|
|
|
BuildRequires: python%{python3_pkgversion}-hypothesis >= 1.11.4
|
2019-11-18 13:16:21 +00:00
|
|
|
BuildRequires: python%{python3_pkgversion}-iso8601
|
|
|
|
BuildRequires: python%{python3_pkgversion}-pretend
|
2024-08-21 15:49:56 +00:00
|
|
|
BuildRequires: python%{python3_pkgversion}-pytest-benchmark
|
2021-02-12 15:47:08 +00:00
|
|
|
BuildRequires: python%{python3_pkgversion}-pytest-xdist
|
2023-03-09 11:55:39 +00:00
|
|
|
BuildRequires: python%{python3_pkgversion}-pytz
|
2021-02-12 15:47:08 +00:00
|
|
|
%endif
|
2023-03-09 07:19:18 +00:00
|
|
|
BuildRequires: python%{python3_pkgversion}-pytest >= 6.2.0
|
2019-11-18 13:16:21 +00:00
|
|
|
%endif
|
2014-11-21 05:21:59 +00:00
|
|
|
|
|
|
|
%description
|
|
|
|
cryptography is a package designed to expose cryptographic primitives and
|
|
|
|
recipes to Python developers.
|
|
|
|
|
2017-08-03 11:33:04 +00:00
|
|
|
%package -n python%{python3_pkgversion}-%{srcname}
|
2014-11-21 05:21:59 +00:00
|
|
|
Summary: PyCA's cryptography library
|
2017-08-03 11:33:04 +00:00
|
|
|
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
|
2014-11-21 05:21:59 +00:00
|
|
|
|
2017-10-23 17:37:50 +00:00
|
|
|
Requires: openssl-libs
|
2021-04-21 11:39:53 +00:00
|
|
|
%if 0%{?fedora} >= 35 || 0%{?rhel} >= 9
|
|
|
|
# Can be safely removed in Fedora 37
|
|
|
|
Obsoletes: python%{python3_pkgversion}-cryptography-vectors < 3.4.7
|
|
|
|
%endif
|
2014-11-21 05:21:59 +00:00
|
|
|
|
2017-08-03 11:33:04 +00:00
|
|
|
%description -n python%{python3_pkgversion}-%{srcname}
|
2014-11-21 05:21:59 +00:00
|
|
|
cryptography is a package designed to expose cryptographic primitives and
|
|
|
|
recipes to Python developers.
|
|
|
|
|
|
|
|
%prep
|
2024-08-21 15:49:56 +00:00
|
|
|
%autosetup -p1 -n %{srcname}-%{version}
|
2021-02-12 09:53:26 +00:00
|
|
|
%if 0%{?fedora}
|
|
|
|
%cargo_prep
|
2024-08-21 15:49:56 +00:00
|
|
|
sed -i 's/locked = true//g' pyproject.toml
|
2023-01-26 20:53:08 +00:00
|
|
|
rm src/rust/Cargo.lock
|
2021-02-12 09:53:26 +00:00
|
|
|
%else
|
|
|
|
# RHEL: use vendored Rust crates
|
2021-04-21 11:39:53 +00:00
|
|
|
%cargo_prep -V 1
|
2021-02-12 09:53:26 +00:00
|
|
|
%endif
|
2021-02-08 12:51:48 +00:00
|
|
|
|
2024-08-21 15:49:56 +00:00
|
|
|
%if ! 0%{?fedora}
|
|
|
|
sed -i 's,--benchmark-disable,,' pyproject.toml
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
2023-01-26 20:53:08 +00:00
|
|
|
%generate_buildrequires
|
2024-08-21 15:49:56 +00:00
|
|
|
%pyproject_buildrequires
|
|
|
|
%if 0%{?fedora}
|
2023-01-26 20:53:08 +00:00
|
|
|
# Fedora: use RPMified crates
|
|
|
|
cd src/rust
|
|
|
|
%cargo_generate_buildrequires
|
|
|
|
cd ../..
|
|
|
|
%endif
|
|
|
|
|
2023-03-28 06:45:39 +00:00
|
|
|
|
2014-11-21 05:21:59 +00:00
|
|
|
%build
|
2023-01-26 20:53:08 +00:00
|
|
|
export RUSTFLAGS="%build_rustflags"
|
2023-03-28 06:45:39 +00:00
|
|
|
export OPENSSL_NO_VENDOR=1
|
2024-08-21 15:49:56 +00:00
|
|
|
export CFLAGS="${CFLAGS} -DOPENSSL_NO_ENGINE=1 "
|
|
|
|
%pyproject_wheel
|
|
|
|
|
2014-11-21 05:21:59 +00:00
|
|
|
|
|
|
|
%install
|
|
|
|
# Actually other *.c and *.h are appropriate
|
|
|
|
# see https://github.com/pyca/cryptography/issues/1463
|
|
|
|
find . -name .keep -print -delete
|
2024-08-21 15:49:56 +00:00
|
|
|
%pyproject_install
|
|
|
|
%pyproject_save_files %{srcname}
|
|
|
|
|
2014-11-21 05:21:59 +00:00
|
|
|
|
|
|
|
%check
|
2019-11-18 13:16:21 +00:00
|
|
|
%if %{with tests}
|
2021-02-12 09:53:26 +00:00
|
|
|
%if 0%{?rhel}
|
2024-08-21 15:49:56 +00:00
|
|
|
# skip benchmark, hypothesis, and pytz tests on RHEL
|
|
|
|
rm -rf tests/bench tests/hypothesis tests/x509
|
2021-02-12 15:47:08 +00:00
|
|
|
# append skipper to skip iso8601 and pretend tests
|
2021-04-21 11:39:53 +00:00
|
|
|
cat < %{SOURCE2} >> tests/conftest.py
|
2021-02-12 09:53:26 +00:00
|
|
|
%endif
|
|
|
|
|
2022-12-09 11:09:43 +00:00
|
|
|
# enable SHA-1 signatures for RSA tests
|
|
|
|
# also see https://github.com/pyca/cryptography/pull/6931 and rhbz#2060343
|
|
|
|
export OPENSSL_ENABLE_SHA1_SIGNATURES=yes
|
|
|
|
|
2019-10-13 12:26:19 +00:00
|
|
|
# see https://github.com/pyca/cryptography/issues/4885 and
|
|
|
|
# see https://bugzilla.redhat.com/show_bug.cgi?id=1761194 for deselected tests
|
2022-01-27 13:43:41 +00:00
|
|
|
# see rhbz#2042413 for memleak. It's unstable under Python 3.11 and makes
|
|
|
|
# not much sense for downstream testing.
|
2023-02-22 08:57:34 +00:00
|
|
|
# see rhbz#2171661 for test_load_invalid_ec_key_from_pem: error:030000CD:digital envelope routines::keymgmt export failure
|
2021-04-21 11:39:53 +00:00
|
|
|
PYTHONPATH=${PWD}/vectors:%{buildroot}%{python3_sitearch} \
|
|
|
|
%{__python3} -m pytest \
|
2023-03-09 12:28:58 +00:00
|
|
|
--ignore vendor \
|
2023-02-22 08:57:34 +00:00
|
|
|
-k "not (test_buffer_protocol_alternate_modes or test_dh_parameters_supported or test_load_ecdsa_no_named_curve or test_decrypt_invalid_decrypt or test_openssl_memleak or test_load_invalid_ec_key_from_pem)"
|
2014-11-21 05:21:59 +00:00
|
|
|
%endif
|
|
|
|
|
2024-08-21 15:49:56 +00:00
|
|
|
|
|
|
|
%files -n python%{python3_pkgversion}-%{srcname} -f %{pyproject_files}
|
2017-08-03 11:33:04 +00:00
|
|
|
%doc README.rst docs
|
|
|
|
%license LICENSE LICENSE.APACHE LICENSE.BSD
|
2021-06-10 18:27:29 +00:00
|
|
|
|
2021-06-02 23:05:02 +00:00
|
|
|
|
2024-08-21 15:49:56 +00:00
|
|
|
%changelog
|
|
|
|
%autochangelog
|