File python-awscrt.spec of Package python-awscrt

#
# spec file for package python-awscrt
#
# Copyright (c) 2024 Dominik Wombacher <dominik@wombacher.cc>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%{?sle15_python_module_pythons}
Name:           python-awscrt
Version:        0.23.1
Release:        0
Summary:        A common runtime for AWS Python projects
# All files are licensed under Apache-2.0, except:
# - crt/aws-c-common/include/aws/common/external/cJSON.h is MIT
# - crt/aws-c-common/source/external/cJSON.c is MIT
# - crt/s2n/pq-crypto/kyber_r3/KeccakP-brg_endian_avx2.h is BSD-3-Clause
License:        Apache-2.0 AND MIT AND BSD-3-Clause
URL:            https://github.com/awslabs/aws-crt-python
Source:         https://files.pythonhosted.org/packages/source/a/awscrt/awscrt-%{version}.tar.gz

# PATCH-FIX-OPENSUSE skip-test-requiring-network.patch nforro@redhat.com -- one test requires internet connection, skip it
Patch:          skip-test-requiring-network.patch

# AWS C libs does not build on s390x
ExcludeArch:    s390x

BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module wheel}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module websockets}
BuildRequires:  fdupes
BuildRequires:  cmake
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  openssl-devel
BuildRequires:  ca-certificates-mozilla
# Resolves "have choice for pkgconfig(zlib) needed by libopenssl-1_1-devel: zlib-devel zlib-ng-compat-devel" error
%if 0%{?suse_version} < 1600
BuildRequires:  zlib-devel
%else
BuildRequires:  zlib-ng-compat-devel
%endif

%python_subpackages

%description
A common runtime for AWS Python projects


%prep
%autosetup -p1 -n awscrt-%{version}


%build
%ifarch %{ix86}
# disable SSE2 instructions to prevent a crash in aws-c-common thread handling
# probably caused by a compiler bug
export CFLAGS="%{optflags} -mno-sse2 -s"
%else
# strip debug symbols to avoid 'unstripped-binary-or-object' warnings
export CFLAGS="%{optflags} -s"
%endif

export AWS_CRT_BUILD_USE_SYSTEM_LIBCRYPTO=1

%pyproject_wheel


%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}


%check
%pyunittest_arch -v


%files %{python_files}
%doc README.md
%license LICENSE NOTICE
%{python_sitearch}/_awscrt*
%{python_sitearch}/awscrt
%{python_sitearch}/awscrt-%{version}*-info


%changelog

openSUSE Build Service is sponsored by