Accepting request 1155351 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/1155351
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sseclient?expand=0&rev=2
This commit is contained in:
2024-03-06 22:04:51 +00:00
committed by Git OBS Bridge
3 changed files with 91 additions and 3 deletions

82
no-six.patch Normal file
View File

@@ -0,0 +1,82 @@
Index: sseclient-0.0.27/sseclient.py
===================================================================
--- sseclient-0.0.27.orig/sseclient.py
+++ sseclient-0.0.27/sseclient.py
@@ -9,8 +9,7 @@ import codecs
import re
import time
import warnings
-
-import six
+import http.client
import requests
@@ -94,7 +93,7 @@ class SSEClient(object):
raise EOFError()
self.buf += self.decoder.decode(next_chunk)
- except (StopIteration, requests.RequestException, EOFError, six.moves.http_client.IncompleteRead) as e:
+ except (StopIteration, requests.RequestException, EOFError, http.client.IncompleteRead) as e:
print(e)
time.sleep(self.retry / 1000.0)
self._connect()
@@ -122,16 +121,13 @@ class SSEClient(object):
return msg
- if six.PY2:
- next = __next__
-
class Event(object):
sse_line_pattern = re.compile('(?P<name>[^:]*):?( ?(?P<value>.*))?')
def __init__(self, data='', event='message', id=None, retry=None):
- assert isinstance(data, six.string_types), "Data must be text"
+ assert isinstance(data, str), "Data must be text"
self.data = data
self.event = event
self.id = id
Index: sseclient-0.0.27/test_sseclient.py
===================================================================
--- sseclient-0.0.27.orig/test_sseclient.py
+++ sseclient-0.0.27/test_sseclient.py
@@ -15,7 +15,6 @@ except ImportError:
import pytest
import requests
-import six
from requests.cookies import RequestsCookieJar
import sseclient
@@ -77,7 +76,7 @@ class FakeResponse(object):
self.status_code = status_code
self.encoding = encoding
self.apparent_encoding = "utf-8"
- if not isinstance(content, six.text_type):
+ if not isinstance(content, str):
content = content.decode("utf-8")
self.stream = content
self.headers = headers or None
Index: sseclient-0.0.27/setup.py
===================================================================
--- sseclient-0.0.27.orig/setup.py
+++ sseclient-0.0.27/setup.py
@@ -17,7 +17,7 @@ setup(
author='Brent Tubbs',
author_email='brent.tubbs@gmail.com',
py_modules=['sseclient'],
- install_requires=['requests>=2.9', 'six'],
+ install_requires=['requests>=2.9'],
tests_require=['pytest', 'backports.unittest_mock'],
setup_requires=[] + pytest_runner,
description=(
Index: sseclient-0.0.27/sseclient.egg-info/requires.txt
===================================================================
--- sseclient-0.0.27.orig/sseclient.egg-info/requires.txt
+++ sseclient-0.0.27/sseclient.egg-info/requires.txt
@@ -1,2 +1 @@
requests>=2.9
-six

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Mar 5 12:54:32 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Add patch no-six.patch to get rid of six dependency
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Mar 5 10:00:59 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com> Tue Mar 5 10:00:59 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>

View File

@@ -26,10 +26,11 @@ Source: https://files.pythonhosted.org/packages/source/s/sseclient/ssecl
BuildRequires: %{python_module pip} BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel} BuildRequires: %{python_module wheel}
BuildRequires: python-rpm-macros
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros
# PATCH-FIX-UPSTREAM https://github.com/btubbs/sseclient/pull/64 drop six
Patch: no-six.patch
Requires: python-requests >= 2.9 Requires: python-requests >= 2.9
Requires: python-six
BuildArch: noarch BuildArch: noarch
%python_subpackages %python_subpackages
@@ -41,7 +42,7 @@ iterator over messages coming from the server.
%prep %prep
%autosetup -p1 -n sseclient-%{version} %autosetup -p1 -n sseclient-%{version}
sed -i 's|#!/usr/bin/env python|#!/usr/bin/python|g' sseclient.py sed -i 's|#!/usr/bin/env python|#!/usr/bin/python3|g' sseclient.py
%build %build
%pyproject_wheel %pyproject_wheel