14
0

Accepting request 924948 from home:bnavigator:branches:devel:languages:python

- Add disable-RustExtension.patch in order to avoid a build
  requirement setuptools_rust
- Next version (35.0) needs a full Rust toolchain.
- Clean runtime, build and test requirements
- Disable python2 build: Not supported anymore

OBS-URL: https://build.opensuse.org/request/show/924948
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cryptography?expand=0&rev=139
This commit is contained in:
2021-10-13 00:59:08 +00:00
committed by Git OBS Bridge
parent 235e4ac2e6
commit f943f3caf8
3 changed files with 87 additions and 38 deletions

View File

@@ -16,8 +16,10 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without python2
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
# disabled in order to avoid pulling dependencies -- adrian@suse.de
%bcond_with rust
Name: python-cryptography
Version: 3.4.8
Release: 0
@@ -31,47 +33,32 @@ Source2: %{name}.keyring
# PATCH-FIX-SLE disable-uneven-sizes-tests.patch bnc#944204
Patch1: disable-uneven-sizes-tests.patch
Patch2: skip_openssl_memleak_test.patch
BuildRequires: %{python_module asn1crypto >= 0.21.0}
BuildRequires: %{python_module cffi >= 1.7}
BuildRequires: %{python_module cryptography-vectors = %{version}}
# PATCH-FEATURE-OPENSUSE disable-RustExtension.patch -- disable setuptools_rust requirement if not building with rust
Patch3: disable-RustExtension.patch
BuildRequires: %{python_module cffi >= 1.12}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module idna >= 2.1}
BuildRequires: %{python_module pyasn1-modules}
BuildRequires: %{python_module pytz}
BuildRequires: %{python_module setuptools >= 11.3}
BuildRequires: %{python_module setuptools}
%if %{with rust}
BuildRequires: %{python_module setuptools_rust}
BuildRequires: %{python_module six >= 1.4.1}
%endif
BuildRequires: fdupes
BuildRequires: libopenssl-devel
BuildRequires: pkgconfig
BuildRequires: python-rpm-macros
BuildRequires: pkgconfig(libffi)
Requires: python-asn1crypto >= 0.21.0
Recommends: python-idna >= 2.1
Requires: python-packaging
Requires: python-pyasn1 >= 0.1.8
Requires: python-setuptools >= 11.3
Requires: python-six >= 1.4.1
%requires_eq python-cffi
%if %{with python2}
BuildRequires: python2-enum34
BuildRequires: python2-ipaddress
%endif
# SECTION Test requirements
BuildRequires: %{python_module hypothesis >= 1.11.4}
BuildRequires: %{python_module iso8601}
BuildRequires: %{python_module packaging}
BuildRequires: %{python_module pretend}
BuildRequires: %{python_module pyasn1 >= 0.1.8}
BuildRequires: %{python_module pytest > 3.3.0}
BuildRequires: %{python_module pytest-subtests}
# /SECTION
# python-base is not enough, we need the _ssl module
Requires: python
%ifpython2
Requires: python-enum34
Requires: python-ipaddress
%endif
# SECTION Test requirements
BuildRequires: %{python_module cryptography-vectors = %{version}}
BuildRequires: %{python_module hypothesis >= 1.11.4}
BuildRequires: %{python_module iso8601}
BuildRequires: %{python_module pretend}
BuildRequires: %{python_module pytest > 6.0}
BuildRequires: %{python_module pytest-subtests}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytz}
# /SECTION
%python_subpackages
%description
@@ -86,12 +73,12 @@ symmetric ciphers, message digests and key derivation
functions.
%prep
%setup -q -n cryptography-%{version}
%patch1 -p1
%patch2 -p1
%autosetup -p1 -n cryptography-%{version}
%build
%if ! %{with rust}
export CRYPTOGRAPHY_DONT_BUILD_RUST=1
%endif
export CFLAGS="%{optflags} -fno-strict-aliasing"
%python_build
@@ -100,15 +87,19 @@ export CFLAGS="%{optflags} -fno-strict-aliasing"
# see https://github.com/pyca/cryptography/issues/1463
find . -name .keep -print -delete
%if ! %{with rust}
export CRYPTOGRAPHY_DONT_BUILD_RUST=1
%endif
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%check
%pytest_arch
%pytest_arch -n auto
%files %{python_files}
%license LICENSE LICENSE.APACHE LICENSE.BSD
%doc CONTRIBUTING.rst CHANGELOG.rst README.rst
%{python_sitearch}/*
%{python_sitearch}/cryptography
%{python_sitearch}/cryptography-%{version}*-info
%changelog