File saltbundlepy-pycurl.spec of Package saltbundlepy-pycurl

# spec file for package saltbundlepy-pycurl
# Copyright (c) 2021 SUSE LLC
# 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

%{?!saltbundlepy_module:%define saltbundlepy_module() saltbundlepy-%{**}}
%define pythons saltbundlepy

# Disable python bytecompile for all distros
# It's called explicitly in the spec
%global __brp_python_bytecompile %{nil}

%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
ExclusiveArch:  do-not-build
%define psuffix %{nil}
%bcond_with test

Name:           saltbundlepy-pycurl%{psuffix}
Version:        7.45.2
Release:        0
Summary:        PycURL -- cURL library module
License:        LGPL-2.1-or-later AND MIT
Group:          Development/Languages/Python
# PATCH-FIX-OPENSUSE increase_test_timeout.diff -- Increase the timeout in a test so it doesn't fail when obs is overloaded
Patch0:         increase_test_timeout.diff
# PATCH-FIX-UPSTREAM handle difference between libssh and libssh2
Patch1:         pycurl-libssh.patch
Patch2:         disable_randomly_failing_tests.patch
# PATCH-FIX-OPENSUSE make-leap15-compat.patch
# Make tests passing with Leap 15.2
Patch3:         make-leap15-compat.patch
BuildRequires:  %{saltbundlepy_module devel >= 3.10}
BuildRequires:  %{saltbundlepy_module setuptools}
BuildRequires:  fdupes
BuildRequires:  libcurl-devel >= 7.19.0
%if 0%{?suse_version} == 1315
BuildRequires:  saltbundle-openssl-devel
BuildRequires:  openssl-devel
BuildRequires:  saltbundlepy-rpm-macros
%if %{with test}
BuildRequires:  %{saltbundlepy_module bottle}
BuildRequires:  %{saltbundlepy_module flaky}
BuildRequires:  %{saltbundlepy_module nose}
Requires:       saltbundlepy-base

This module provides bindings for the cURL library.

%package -n %{name}-doc
Summary:        Documentation for python-curl
Group:          Development/Libraries/Python
Requires:       %{name} = %{version}
Provides:       %{python_module pycurl-doc = %{version}}
BuildArch:      noarch

%description -n %{name}-doc
This module provides bindings for the cURL library.

This package contains documentation and examples.

%autosetup -p1 -n pycurl-%{version}

# temporarily remove a failing test-case until the issue is
# fixed in curl:
rm -f tests/

export CFLAGS="%{optflags} -fno-strict-aliasing"
export PYCURL_SSL_LIBRARY=openssl
%python_build --with-openssl

export PYCURL_SSL_LIBRARY=openssl
%python_install --with-openssl

rm -rf %{buildroot}%{_datadir}/doc # Remove wrongly installed junk

%{python_expand \
$python -m compileall -d %{$python_sitearch} %{buildroot}%{$python_sitearch}
$python -O -m compileall -d %{$python_sitearch} %{buildroot}%{$python_sitearch}
%fdupes %{buildroot}%{$python_sitearch}

%if %{with test}
export LANG=en_US.UTF-8
export PYCURL_SSL_LIBRARY=openssl
# taken from "make test" because we only need to run nosetests,
# not the rest of the mess in the upstream runner
pushd tests/fake-curl/libcurl
rm -f *.so
make %{?_smp_mflags}
# exclude certain tests
test_flags='online or occasionally_failing'
if ! pkg-config --variable=supported_features libcurl|grep -qw HTTP2; then
    test_flags="$test_flags or http2"
if ! pkg-config --variable=supported_protocols libcurl|grep -qw SCP; then
    test_flags="$test_flags or ssh"
# test_getinfo are failing with new bottle
%pytest_arch -s -k "not ($test_flags or test_getinfo)"
rm -rf %{buildroot}%{_prefix}/lib/debug %{buildroot}%{_libdir}/python*
# test

%if ! %{with test}
%files %{python_files}
%doc AUTHORS ChangeLog README.rst

%files -n %{name}-doc
%doc examples doc/*.rst

openSUSE Build Service is sponsored by