From 86ff753a204c084cf29a34e4541cf659b7b6367b Mon Sep 17 00:00:00 2001 From: JinWang An Date: Mon, 21 Aug 2023 17:02:43 +0900 Subject: [PATCH] Bump to python3-pycurl-7.45.2 Change-Id: Ie7b20c76cfe33c879cf49ce801ca64f2da7f8374 Signed-off-by: JinWang An --- .../disable_randomly_failing_tests.patch | 67 ++++++++++++++++++ packaging/increase_test_timeout.diff | 17 +++++ packaging/make-leap15-compat.patch | 22 ++++++ packaging/pycurl-libssh.patch | 62 ++++++++++++++++ packaging/python-pycurl.spec | 70 +++++++++++++++++++ 5 files changed, 238 insertions(+) create mode 100644 packaging/disable_randomly_failing_tests.patch create mode 100644 packaging/increase_test_timeout.diff create mode 100644 packaging/make-leap15-compat.patch create mode 100644 packaging/pycurl-libssh.patch create mode 100644 packaging/python-pycurl.spec diff --git a/packaging/disable_randomly_failing_tests.patch b/packaging/disable_randomly_failing_tests.patch new file mode 100644 index 0000000..c67c3a7 --- /dev/null +++ b/packaging/disable_randomly_failing_tests.patch @@ -0,0 +1,67 @@ +Index: pycurl-7.45.1/tests/memory_mgmt_test.py +=================================================================== +--- pycurl-7.45.1.orig/tests/memory_mgmt_test.py ++++ pycurl-7.45.1/tests/memory_mgmt_test.py +@@ -9,6 +9,7 @@ import unittest + import gc + import flaky + from . import util ++import pytest + + debug = False + +@@ -17,6 +18,7 @@ if sys.platform == 'win32': + else: + devnull = '/dev/null' + ++@pytest.mark.occasionally_failing + @flaky.flaky(max_runs=3) + class MemoryMgmtTest(unittest.TestCase): + def maybe_enable_debug(self): +Index: pycurl-7.45.1/tests/multi_memory_mgmt_test.py +=================================================================== +--- pycurl-7.45.1.orig/tests/multi_memory_mgmt_test.py ++++ pycurl-7.45.1/tests/multi_memory_mgmt_test.py +@@ -7,11 +7,13 @@ import unittest + import gc + import flaky + import weakref ++import pytest + + from . import util + + debug = False + ++@pytest.mark.occasionally_failing + @flaky.flaky(max_runs=3) + class MultiMemoryMgmtTest(unittest.TestCase): + def test_opensocketfunction_collection(self): +Index: pycurl-7.45.1/tests/multi_timer_test.py +=================================================================== +--- pycurl-7.45.1.orig/tests/multi_timer_test.py ++++ pycurl-7.45.1/tests/multi_timer_test.py +@@ -5,6 +5,7 @@ + from . import localhost + import pycurl + import unittest ++import pytest + + from . import appmanager + from . import util +@@ -23,6 +24,7 @@ def teardown_module(mod): + teardown_module_2(mod) + teardown_module_1(mod) + ++@pytest.mark.occasionally_failing + class MultiSocketTest(unittest.TestCase): + def test_multi_timer(self): + urls = [ +Index: pycurl-7.45.1/pytest.ini +=================================================================== +--- pycurl-7.45.1.orig/pytest.ini ++++ pycurl-7.45.1/pytest.ini +@@ -7,3 +7,4 @@ markers = + gssapi: mark a test as requiring GSSAPI + http2: mark a test as requiring HTTP/2 + standalone: mark a test as being standalone ++ occasionally_failing: mark a test as occasionally failing diff --git a/packaging/increase_test_timeout.diff b/packaging/increase_test_timeout.diff new file mode 100644 index 0000000..e1d7202 --- /dev/null +++ b/packaging/increase_test_timeout.diff @@ -0,0 +1,17 @@ +Index: pycurl-7.43.0/tests/runwsgi.py +=================================================================== +--- pycurl-7.43.0.orig/tests/runwsgi.py ++++ pycurl-7.43.0/tests/runwsgi.py +@@ -48,10 +48,10 @@ def start_bottle_server(app, port, serve + server_thread.daemon = True + server_thread.start() + +- ok = util.wait_for_network_service(('127.0.0.1', port), 0.1, 10) ++ ok = util.wait_for_network_service(('127.0.0.1', port), 0.1, 30) + if not ok: + import warnings +- warnings.warn('Server did not start after 1 second') ++ warnings.warn('Server did not start after 3 seconds') + + return server_thread.server + diff --git a/packaging/make-leap15-compat.patch b/packaging/make-leap15-compat.patch new file mode 100644 index 0000000..0b69af3 --- /dev/null +++ b/packaging/make-leap15-compat.patch @@ -0,0 +1,22 @@ +--- + tests/curl_object_test.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/tests/curl_object_test.py ++++ b/tests/curl_object_test.py +@@ -143,11 +143,11 @@ class CurlObjectTest(unittest.TestCase): + # change does not affect objects created later + obj3 = cls() + self.assertEqual(old_value, getattr(obj3, name)) +- ++ + def test_bogus_attribute_access(self): +- with pytest.raises(AttributeError, match='trying to obtain.*'): +- self.curl.foo +- ++ with pytest.raises(AttributeError): ++ self.curl.foo ++ + def test_bogus_attribute_delete(self): + with pytest.raises(AttributeError, match='trying to delete.*'): + del self.curl.foo diff --git a/packaging/pycurl-libssh.patch b/packaging/pycurl-libssh.patch new file mode 100644 index 0000000..b526ce8 --- /dev/null +++ b/packaging/pycurl-libssh.patch @@ -0,0 +1,62 @@ +--- a/tests/ssh_key_cb_test.py ++++ b/tests/ssh_key_cb_test.py +@@ -33,8 +33,11 @@ class SshKeyCbTest(unittest.TestCase): + def keyfunction(known_key, found_key, match): + return pycurl.KHSTAT_FINE + +- self.curl.setopt(pycurl.SSH_KNOWNHOSTS, '.known_hosts') +- self.curl.setopt(pycurl.SSH_KEYFUNCTION, keyfunction) ++ try: ++ self.curl.setopt(pycurl.SSH_KNOWNHOSTS, '.known_hosts') ++ self.curl.setopt(pycurl.SSH_KEYFUNCTION, keyfunction) ++ except pycurl.error as e: ++ self.assertEqual(pycurl.E_UNKNOWN_OPTION, e.args[0]) + + try: + self.curl.perform() +@@ -47,8 +50,11 @@ class SshKeyCbTest(unittest.TestCase): + def keyfunction(known_key, found_key, match): + return pycurl.KHSTAT_REJECT + +- self.curl.setopt(pycurl.SSH_KNOWNHOSTS, '.known_hosts') +- self.curl.setopt(pycurl.SSH_KEYFUNCTION, keyfunction) ++ try: ++ self.curl.setopt(pycurl.SSH_KNOWNHOSTS, '.known_hosts') ++ self.curl.setopt(pycurl.SSH_KEYFUNCTION, keyfunction) ++ except pycurl.error as e: ++ self.assertEqual(pycurl.E_UNKNOWN_OPTION, e.args[0]) + + try: + self.curl.perform() +@@ -62,8 +68,11 @@ class SshKeyCbTest(unittest.TestCase): + def keyfunction(known_key, found_key, match): + return 'bogus' + +- self.curl.setopt(pycurl.SSH_KNOWNHOSTS, '.known_hosts') +- self.curl.setopt(pycurl.SSH_KEYFUNCTION, keyfunction) ++ try: ++ self.curl.setopt(pycurl.SSH_KNOWNHOSTS, '.known_hosts') ++ self.curl.setopt(pycurl.SSH_KEYFUNCTION, keyfunction) ++ except pycurl.error as e: ++ self.assertEqual(pycurl.E_UNKNOWN_OPTION, e.args[0]) + + try: + self.curl.perform() +@@ -82,9 +91,15 @@ class SshKeyCbUnsetTest(unittest.TestCas + @util.min_libcurl(7, 19, 6) + @util.guard_unknown_libcurl_option + def test_keyfunction_none(self): +- self.curl.setopt(pycurl.SSH_KEYFUNCTION, None) ++ try: ++ self.curl.setopt(pycurl.SSH_KEYFUNCTION, None) ++ except pycurl.error as e: ++ self.assertEqual(pycurl.E_UNKNOWN_OPTION, e.args[0]) + + @util.min_libcurl(7, 19, 6) + @util.guard_unknown_libcurl_option + def test_keyfunction_unset(self): +- self.curl.unsetopt(pycurl.SSH_KEYFUNCTION) ++ try: ++ self.curl.unsetopt(pycurl.SSH_KEYFUNCTION) ++ except pycurl.error as e: ++ self.assertEqual(pycurl.E_UNKNOWN_OPTION, e.args[0]) diff --git a/packaging/python-pycurl.spec b/packaging/python-pycurl.spec new file mode 100644 index 0000000..c47995b --- /dev/null +++ b/packaging/python-pycurl.spec @@ -0,0 +1,70 @@ +# +# spec file +# +# Copyright (c) 2023 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 https://bugs.opensuse.org/ +# + + + +Name: python3-pycurl +Version: 7.45.2 +Release: 0 +Summary: PycURL -- cURL library module +License: LGPL-2.1-or-later AND MIT +URL: http://pycurl.io/ +Source: https://files.pythonhosted.org/packages/source/p/pycurl/pycurl-%{version}.tar.gz +# 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 mcepl@suse.com +# Make tests passing with Leap 15.2 +Patch3: make-leap15-compat.patch +BuildRequires: python3 +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: pkgconfig +BuildRequires: pkgconfig(libcurl) >= 7.19.0 +BuildRequires: pkgconfig(openssl1.1) + + +%description +This module provides bindings for the cURL library. + + +%prep +%autosetup -p1 -n pycurl-%{version} + +# temporarily remove a failing test-case until the issue is +# fixed in curl: https://github.com/curl/curl/issues/6615 +rm -f tests/failonerror_test.py + +%build +export CFLAGS="%{optflags} -fno-strict-aliasing" +export PYCURL_SSL_LIBRARY=openssl +python3 setup.py build --with-openssl + +%install +export PYCURL_SSL_LIBRARY=openssl +python3 setup.py install -O1 --skip-build --root=%{buildroot} --prefix=%{_prefix} --with-openssl + +rm -rf %{buildroot}%{_datadir}/doc # Remove wrongly installed junk + + + +%files +%license COPYING-LGPL COPYING-MIT +%doc AUTHORS ChangeLog README.rst +%{python3_sitearch}/* -- 2.34.1