Compare commits

3 Commits

3 changed files with 100 additions and 9 deletions

80
no-six.patch Normal file
View File

@@ -0,0 +1,80 @@
Index: gsm0338-1.0.0/gsm0338/codec.py
===================================================================
--- gsm0338-1.0.0.orig/gsm0338/codec.py
+++ gsm0338-1.0.0/gsm0338/codec.py
@@ -1,5 +1,4 @@
import codecs
-from six import byte2int, int2byte, unichr
from .charset import BASIC_CHARACTER_SET, BASIC_CHARACTER_SET_EXTENSION
# Codec APIs
@@ -50,8 +49,8 @@ class Codec(codecs.Codec):
(self.NAME, character, consumed - 1))
if num is not None:
if num & 0xff00:
- encode_buffer += int2byte(self._ESCAPE)
- encode_buffer += int2byte(num & 0xff)
+ encode_buffer += bytes((self._ESCAPE,))
+ encode_buffer += bytes((num & 0xff,))
return encode_buffer, consumed
def decode(self, input, errors='strict'):
@@ -67,12 +66,12 @@ class Codec(codecs.Codec):
num = 0
for value in input:
consumed += 1
- num |= byte2int([value])
+ num |= [value][0]
if num == self._ESCAPE:
num <<= 8
continue
try:
- decode_buffer += unichr(self._decode_map[num])
+ decode_buffer += chr(self._decode_map[num])
except KeyError as ex:
if errors == 'replace':
decode_buffer += u'\ufffd'
Index: gsm0338-1.0.0/requirements.txt
===================================================================
--- gsm0338-1.0.0.orig/requirements.txt
+++ gsm0338-1.0.0/requirements.txt
@@ -1,3 +1,2 @@
-six
pytest
pytest-flake8
Index: gsm0338-1.0.0/setup.py
===================================================================
--- gsm0338-1.0.0.orig/setup.py
+++ gsm0338-1.0.0/setup.py
@@ -34,7 +34,7 @@ setup(
long_description=long_description,
packages=find_packages(),
- install_requires=['six'],
+ install_requires=[],
package_data={
'': ['*.txt', '*.rst'],
},
Index: gsm0338-1.0.0/test/test_codec.py
===================================================================
--- gsm0338-1.0.0.orig/test/test_codec.py
+++ gsm0338-1.0.0/test/test_codec.py
@@ -2,7 +2,6 @@
import gsm0338
import pytest
-from six import int2byte
@pytest.fixture
@@ -10,8 +9,8 @@ def codec():
return gsm0338.Codec()
-GSM_BASIC_CHARACTER_SET = b"".join([int2byte(x) for x in range(27)]) +\
- b"".join([int2byte(x) for x in range(28, 128)]) +\
+GSM_BASIC_CHARACTER_SET = b"".join([bytes(range(27))]) +\
+ b"".join([bytes(range(28, 128))]) +\
b"\x1B\x0A\x1B\x14\x1B\x28\x1B\x29\x1B\x2F"\
b"\x1B\x3C\x1B\x3D\x1B\x3E\x1B\x40\x1B\x65"
UNICODE_BASIC_CHARACTER_SET = u"@£$¥èéùìòÇ\nØø\rÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ" \

View File

@@ -1,3 +1,13 @@
-------------------------------------------------------------------
Tue May 27 15:03:09 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Add no-six.patch to remove the dependency on six
-------------------------------------------------------------------
Tue May 27 14:32:40 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Convert to pip-based build
-------------------------------------------------------------------
Wed Aug 24 18:26:24 UTC 2022 - Ben Greiner <code@bnavigator.de>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-gsm0338
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2021, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
@@ -17,7 +17,6 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-gsm0338
Version: 1.0.0
Release: 0
@@ -26,15 +25,17 @@ License: MIT
URL: https://github.com/dsch/gsm0338
#GIT-Clone: https://github.com/dsch/gsm0338.git
Source: https://github.com/dsch/gsm0338/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM parts of https://github.com/dsch/gsm0338/commit/94bcadca630d498ce8b33295c617acb1a75b39da Remove support for Python 2.7
Patch: no-six.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module six}
BuildRequires: %{python_module pytest}
# /SECTION
BuildRequires: fdupes
Requires: python-six
BuildArch: noarch
%python_subpackages
%description
@@ -44,13 +45,13 @@ stateless codecs.Codec class. With loading the module the
codec get's automatically registered.
%prep
%setup -q -n gsm0338-%{version}
%autosetup -p1 -n gsm0338-%{version}
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_expand rm -rf %{buildroot}%{$python_sitelib}/test
%python_expand %fdupes %{buildroot}%{$python_sitelib}