forked from pool/python-kafka-python
- Add patch slightly-patch-out-six.patch:
* Remove some uses of six, to avoid circular imports. - Also edit fixutres.py directly for the same reason. - Switch to pyproject macros. - Less globs in %files. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-kafka-python?expand=0&rev=28
This commit is contained in:
parent
61054451df
commit
c3cdce0a0d
@ -7,11 +7,10 @@ import os.path
|
|||||||
import socket
|
import socket
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
import urllib
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import py
|
import py
|
||||||
from kafka.vendor.six.moves import urllib, range
|
|
||||||
from kafka.vendor.six.moves.urllib.parse import urlparse # pylint: disable=E0611,F0401
|
|
||||||
|
|
||||||
from kafka import errors, KafkaAdminClient, KafkaClient, KafkaConsumer, KafkaProducer
|
from kafka import errors, KafkaAdminClient, KafkaClient, KafkaConsumer, KafkaProducer
|
||||||
from kafka.errors import InvalidReplicationFactorError
|
from kafka.errors import InvalidReplicationFactorError
|
||||||
@ -160,7 +159,7 @@ class ZookeeperFixture(Fixture):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def instance(cls):
|
def instance(cls):
|
||||||
if "ZOOKEEPER_URI" in os.environ:
|
if "ZOOKEEPER_URI" in os.environ:
|
||||||
parse = urlparse(os.environ["ZOOKEEPER_URI"])
|
parse = urllib.parse.urlparse(os.environ["ZOOKEEPER_URI"])
|
||||||
(host, port) = (parse.hostname, parse.port)
|
(host, port) = (parse.hostname, parse.port)
|
||||||
fixture = ExternalService(host, port)
|
fixture = ExternalService(host, port)
|
||||||
else:
|
else:
|
||||||
@ -256,7 +255,7 @@ class KafkaFixture(Fixture):
|
|||||||
if zk_chroot is None:
|
if zk_chroot is None:
|
||||||
zk_chroot = "kafka-python_" + str(uuid.uuid4()).replace("-", "_")
|
zk_chroot = "kafka-python_" + str(uuid.uuid4()).replace("-", "_")
|
||||||
if "KAFKA_URI" in os.environ:
|
if "KAFKA_URI" in os.environ:
|
||||||
parse = urlparse(os.environ["KAFKA_URI"])
|
parse = urllib.parse.urlparse(os.environ["KAFKA_URI"])
|
||||||
(host, port) = (parse.hostname, parse.port)
|
(host, port) = (parse.hostname, parse.port)
|
||||||
fixture = ExternalService(host, port)
|
fixture = ExternalService(host, port)
|
||||||
else:
|
else:
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Mar 19 04:01:27 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Add patch slightly-patch-out-six.patch:
|
||||||
|
* Remove some uses of six, to avoid circular imports.
|
||||||
|
- Also edit fixutres.py directly for the same reason.
|
||||||
|
- Switch to pyproject macros.
|
||||||
|
- Less globs in %files.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Apr 10 11:36:09 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
|
Mon Apr 10 11:36:09 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-kafka-python
|
# spec file for package python-kafka-python
|
||||||
#
|
#
|
||||||
# Copyright (c) 2023 SUSE LLC
|
# Copyright (c) 2024 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -21,18 +21,21 @@ Version: 2.0.2
|
|||||||
Release: 0
|
Release: 0
|
||||||
Summary: Pure Python client for Apache Kafka
|
Summary: Pure Python client for Apache Kafka
|
||||||
License: Apache-2.0
|
License: Apache-2.0
|
||||||
Group: Development/Languages/Python
|
|
||||||
URL: https://github.com/mumrah/kafka-python
|
URL: https://github.com/mumrah/kafka-python
|
||||||
Source: https://files.pythonhosted.org/packages/source/k/kafka-python/kafka-python-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/k/kafka-python/kafka-python-%{version}.tar.gz
|
||||||
Source1: https://raw.githubusercontent.com/dpkp/kafka-python/master/servers/0.11.0.3/resources/zookeeper.properties
|
Source1: https://raw.githubusercontent.com/dpkp/kafka-python/master/servers/0.11.0.3/resources/zookeeper.properties
|
||||||
Source2: https://raw.githubusercontent.com/dpkp/kafka-python/master/test/conftest.py
|
Source2: https://raw.githubusercontent.com/dpkp/kafka-python/master/test/conftest.py
|
||||||
Source3: https://raw.githubusercontent.com/dpkp/kafka-python/master/test/fixtures.py
|
Source3: fixtures.py
|
||||||
Source4: https://raw.githubusercontent.com/dpkp/kafka-python/master/test/service.py
|
Source4: https://raw.githubusercontent.com/dpkp/kafka-python/master/test/service.py
|
||||||
# PATCH-FIX-OPENSUSE Remove use of mock module
|
# PATCH-FIX-OPENSUSE Remove use of mock module
|
||||||
Patch0: remove-mock.patch
|
Patch0: remove-mock.patch
|
||||||
# PATCH-FIX-UPSTREAM fix tests for py3.11 gh#dpkp/kafka-python#2358
|
# PATCH-FIX-UPSTREAM fix tests for py3.11 gh#dpkp/kafka-python#2358
|
||||||
Patch1: python-311.patch
|
Patch1: python-311.patch
|
||||||
|
# PATCH-FIX-OPENSUSE Remove circular imports involving vendored modules
|
||||||
|
Patch2: slightly-patch-out-six.patch
|
||||||
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
# Recommends: python-crc32c # Not packaged
|
# Recommends: python-crc32c # Not packaged
|
||||||
@ -62,23 +65,24 @@ mkdir -p servers/0.11.0.2/resources/
|
|||||||
cp %{SOURCE1} servers/0.11.0.2/resources/
|
cp %{SOURCE1} servers/0.11.0.2/resources/
|
||||||
|
|
||||||
cp %{SOURCE2} %{SOURCE3} %{SOURCE4} test/
|
cp %{SOURCE2} %{SOURCE3} %{SOURCE4} test/
|
||||||
|
|
||||||
touch test/__init__.py
|
touch test/__init__.py
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%pyproject_wheel
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%python_install
|
%pyproject_install
|
||||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
# test_kafka_producer_gc_cleanup is sometimes off by 1
|
# test_kafka_producer_gc_cleanup is sometimes off by 1
|
||||||
%pytest -rs -k 'not (test_kafka_consumer_offsets_for_time_old or test_kafka_producer_gc_cleanup)'
|
# test_send broken with Python 3.12
|
||||||
|
%pytest -rs -k 'not (test_kafka_consumer_offsets_for_time_old or test_kafka_producer_gc_cleanup or test_send)'
|
||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%doc README.rst
|
%doc README.rst
|
||||||
%{python_sitelib}/kafka*/
|
%{python_sitelib}/kafka
|
||||||
|
%{python_sitelib}/kafka_python-%{version}.dist-info
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
49
slightly-patch-out-six.patch
Normal file
49
slightly-patch-out-six.patch
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
Index: kafka-python-2.0.2/kafka/codec.py
|
||||||
|
===================================================================
|
||||||
|
--- kafka-python-2.0.2.orig/kafka/codec.py
|
||||||
|
+++ kafka-python-2.0.2/kafka/codec.py
|
||||||
|
@@ -5,9 +5,6 @@ import io
|
||||||
|
import platform
|
||||||
|
import struct
|
||||||
|
|
||||||
|
-from kafka.vendor import six
|
||||||
|
-from kafka.vendor.six.moves import range
|
||||||
|
-
|
||||||
|
_XERIAL_V1_HEADER = (-126, b'S', b'N', b'A', b'P', b'P', b'Y', 0, 1, 1)
|
||||||
|
_XERIAL_V1_FORMAT = 'bccccccBii'
|
||||||
|
ZSTD_MAX_OUTPUT_SIZE = 1024 * 1024
|
||||||
|
@@ -149,10 +146,6 @@ def snappy_encode(payload, xerial_compat
|
||||||
|
# buffer... likely a python-snappy bug, so just use a slice copy
|
||||||
|
chunker = lambda payload, i, size: payload[i:size+i]
|
||||||
|
|
||||||
|
- elif six.PY2:
|
||||||
|
- # Sliced buffer avoids additional copies
|
||||||
|
- # pylint: disable-msg=undefined-variable
|
||||||
|
- chunker = lambda payload, i, size: buffer(payload, i, size)
|
||||||
|
else:
|
||||||
|
# snappy.compress does not like raw memoryviews, so we have to convert
|
||||||
|
# tobytes, which is a copy... oh well. it's the thought that counts.
|
||||||
|
Index: kafka-python-2.0.2/test/test_codec.py
|
||||||
|
===================================================================
|
||||||
|
--- kafka-python-2.0.2.orig/test/test_codec.py
|
||||||
|
+++ kafka-python-2.0.2/test/test_codec.py
|
||||||
|
@@ -4,7 +4,6 @@ import platform
|
||||||
|
import struct
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
-from kafka.vendor.six.moves import range
|
||||||
|
|
||||||
|
from kafka.codec import (
|
||||||
|
has_snappy, has_lz4, has_zstd,
|
||||||
|
Index: kafka-python-2.0.2/test/test_consumer_integration.py
|
||||||
|
===================================================================
|
||||||
|
--- kafka-python-2.0.2.orig/test/test_consumer_integration.py
|
||||||
|
+++ kafka-python-2.0.2/test/test_consumer_integration.py
|
||||||
|
@@ -6,7 +6,6 @@ try:
|
||||||
|
except ImportError:
|
||||||
|
from mock import patch
|
||||||
|
import pytest
|
||||||
|
-from kafka.vendor.six.moves import range
|
||||||
|
|
||||||
|
import kafka.codec
|
||||||
|
from kafka.errors import UnsupportedCodecError, UnsupportedVersionError
|
Loading…
Reference in New Issue
Block a user