File python-pycurl.spec of Package python-pycurl

# spec file for package python-pycurl
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# 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

%define oldpython python
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-pycurl
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
# PATCH-FIX-OPENSUSE python-pycurl-7.43.0-tls-backend.patch -- do not run runtime tests to compare linked libs
Patch2:         python-pycurl-7.43.0-tls-backend.patch
BuildRequires:  %{python_module bottle}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module flaky}
BuildRequires:  %{python_module nose}
BuildRequires:  fdupes
BuildRequires:  libcurl-devel >= 7.19.0
BuildRequires:  openssl-devel
BuildRequires:  python-rpm-macros
Provides:       %{oldpython}-curl = %{version}
Obsoletes:      %{oldpython}-curl < %{version}

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.

%setup -q -n pycurl-%{version}
%autopatch -p1

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

export PYCURL_SSL_LIBRARY=openssl
%python_install --with-openssl

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

%python_expand %fdupes %{buildroot}%{$python_sitelib}

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
if ! pkg-config --variable=supported_features libcurl|grep -qw HTTP2; then
if ! pkg-config --variable=supported_protocols libcurl|grep -qw SCP; then
%{python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} \
nosetests-%$python_bin_suffix -v --with-flaky -a "$test_flags"

%files %{python_files}
%doc AUTHORS ChangeLog README.rst

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