From f418a91c5087c65d340f2633f6130939df58d0008c29bd614b1a2cdaae441bf9 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 11 May 2022 16:26:07 +0000 Subject: [PATCH] Fix SPEC OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cheroot?expand=0&rev=46 --- no-relative-imports.patch | 88 +++++++++++++++++++++++++++++++++++++++ python-cheroot.spec | 9 ++-- 2 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 no-relative-imports.patch diff --git a/no-relative-imports.patch b/no-relative-imports.patch new file mode 100644 index 0000000..a7734c3 --- /dev/null +++ b/no-relative-imports.patch @@ -0,0 +1,88 @@ +--- + cheroot/ssl/builtin.py | 10 +++++----- + cheroot/test/conftest.py | 6 +++--- + cheroot/test/test_server.py | 8 ++++---- + cheroot/test/test_ssl.py | 12 ++++++------ + 4 files changed, 18 insertions(+), 18 deletions(-) + +--- a/cheroot/ssl/builtin.py ++++ b/cheroot/ssl/builtin.py +@@ -29,11 +29,11 @@ except ImportError: + + import six + +-from . import Adapter +-from .. import errors +-from .._compat import IS_ABOVE_OPENSSL10, suppress +-from ..makefile import StreamReader, StreamWriter +-from ..server import HTTPServer ++from cheroot.ssl import Adapter ++from cheroot import errors ++from cheroot._compat import IS_ABOVE_OPENSSL10, suppress ++from cheroot.makefile import StreamReader, StreamWriter ++from cheroot.server import HTTPServer + + if six.PY2: + generic_socket_error = socket.error +--- a/cheroot/test/conftest.py ++++ b/cheroot/test/conftest.py +@@ -12,11 +12,11 @@ import time + + import pytest + +-from ..server import Gateway, HTTPServer +-from ..testing import ( # noqa: F401 # pylint: disable=unused-import ++from cheroot.server import Gateway, HTTPServer ++from cheroot.testing import ( # noqa: F401 # pylint: disable=unused-import + native_server, wsgi_server, + ) +-from ..testing import get_server_client ++from cheroot.testing import get_server_client + + + @pytest.fixture +--- a/cheroot/test/test_server.py ++++ b/cheroot/test/test_server.py +@@ -18,10 +18,10 @@ import six + + from six.moves import queue, urllib + +-from .._compat import bton, ntob +-from .._compat import IS_LINUX, IS_MACOS, IS_WINDOWS, SYS_PLATFORM +-from ..server import IS_UID_GID_RESOLVABLE, Gateway, HTTPServer +-from ..testing import ( ++from cheroot._compat import bton, ntob ++from cheroot._compat import IS_LINUX, IS_MACOS, IS_WINDOWS, SYS_PLATFORM ++from cheroot.server import IS_UID_GID_RESOLVABLE, Gateway, HTTPServer ++from cheroot.testing import ( + ANY_INTERFACE_IPV4, + ANY_INTERFACE_IPV6, + EPHEMERAL_PORT, +--- a/cheroot/test/test_ssl.py ++++ b/cheroot/test/test_ssl.py +@@ -21,11 +21,11 @@ import requests + import six + import trustme + +-from .._compat import bton, ntob, ntou +-from .._compat import IS_ABOVE_OPENSSL10, IS_CI, IS_PYPY +-from .._compat import IS_LINUX, IS_MACOS, IS_WINDOWS +-from ..server import HTTPServer, get_ssl_adapter_class +-from ..testing import ( ++from cheroot._compat import bton, ntob, ntou ++from cheroot._compat import IS_ABOVE_OPENSSL10, IS_CI, IS_PYPY ++from cheroot._compat import IS_LINUX, IS_MACOS, IS_WINDOWS ++from cheroot.server import HTTPServer, get_ssl_adapter_class ++from cheroot.testing import ( + ANY_INTERFACE_IPV4, + ANY_INTERFACE_IPV6, + EPHEMERAL_PORT, +@@ -33,7 +33,7 @@ from ..testing import ( + _get_conn_data, + _probe_ipv6_sock, + ) +-from ..wsgi import Gateway_10 ++from cheroot.wsgi import Gateway_10 + + + IS_GITHUB_ACTIONS_WORKFLOW = bool(os.getenv('GITHUB_WORKFLOW')) diff --git a/python-cheroot.spec b/python-cheroot.spec index b49a649..025737e 100644 --- a/python-cheroot.spec +++ b/python-cheroot.spec @@ -36,6 +36,8 @@ Source: https://files.pythonhosted.org/packages/source/c/%{pypi_name}/%{ # PATCH-FIX-OPENSUSE no-pypytools.patch mcepl@suse.com # We don't have PyPy at all, so no need support for it Patch0: no-pypytools.patch +# PATCH-FIX-UPSTREAM no-relative-imports.patch bsc#[0-9]+ mcepl@suse.com +Patch1: no-relative-imports.patch BuildRequires: %{python_module jaraco.functools} BuildRequires: %{python_module more-itertools >= 2.6} BuildRequires: %{python_module setuptools >= 34.4} @@ -93,7 +95,7 @@ Cheroot is the pure-Python HTTP server used by CherryPy. %prep %autosetup -p1 -n cheroot-%{version} -p1 # do not check coverage -sed -i '/--cov/ d' pytest.ini +sed -i -e '/--cov/ d' pytest.ini %build %python_build @@ -112,10 +114,7 @@ pushd testclean %python_expand pytest_opts+=" --ignore %{buildroot}%{$python_sitelib}/cheroot/test/test_wsgi.py" %endif # test_tls_client_auth[...-False-localhost-builtin] fails ocassionally on server-side OBS -donttest="(test_tls_client_auth and False-localhost-builtin)" -# https://github.com/cherrypy/cheroot/issues/502 -donttest="$donttest or test_high_number_of_file_descriptors" -%pytest --pyargs cheroot $pytest_opts -k "not ($donttest)" +%pytest --pyargs cheroot $pytest_opts -k "not (test_tls_client_auth and False-localhost-builtin)" popd %pre