From patchwork Mon Sep 21 11:54:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Volk X-Patchwork-Id: 98818 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CC88C98301 for ; Mon, 21 Sep 2026 11:56:12 +0000 (UTC) Received: from mailout01.t-online.de (mailout01.t-online.de [194.25.134.80]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.47402.1789991769404963068 for ; Mon, 21 Sep 2026 04:56:09 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=f_l_k@t-online.de header.s=20260216 header.b=BttvI8lO; spf=pass (domain: t-online.de, ip: 194.25.134.80, mailfrom: f_l_k@t-online.de) Received: from fwd91.aul.t-online.de (fwd91.aul.t-online.de [10.223.144.117]) by mailout01.t-online.de (Postfix) with SMTP id 5A9C01C456 for ; Mon, 21 Sep 2026 13:55:22 +0200 (CEST) Received: from intel-corei7-64.fritz.box ([84.163.35.133]) by fwd91.t-online.de with (TLSv1.3:TLS_AES_256_GCM_SHA384 encrypted) esmtp id 1x8ccB-04X1zJ0; Mon, 21 Sep 2026 13:55:19 +0200 From: Markus Volk To: openembedded-devel@lists.openembedded.org Subject: [meta-python][PATCH 22/24] python3-txws: drop the six dependency Date: Mon, 21 Sep 2026 13:54:58 +0200 Message-ID: <20260921115500.53770-22-f_l_k@t-online.de> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260921115500.53770-1-f_l_k@t-online.de> References: <20260921115500.53770-1-f_l_k@t-online.de> MIME-Version: 1.0 X-TOI-EXPURGATEID: 150726::1789991719-8F7FDA93-F056B4E6/0/0 CLEAN NORMAL X-TOI-MSGID: 3fd4569d-c9f3-4571-a3fe-285229758f0a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=t-online.de; s=20260216; t=1789991722; i=f_l_k@t-online.de; bh=e3nfsst7ddKXmGzgOvM5rLX+8xRuglwxgGPcweXEurU=; h=From:To:Subject:Date:In-Reply-To:References; b=BttvI8lOqI+PAMpl0AUHSx2yRGXQgbkEu6QcGUa77mMpNAxZKNpxYZBRWj4Zs1CKR j6RgDKYXWOe8XXWxuDMhcq0aad3kwH2bFhOgm8TGh13ePh7u0iuCqMrI7l5SfoULuQ D0KREUmNa7YGVbfc3LR6q3/Fdzymyk4ci1bhKoPWB8nTEa2jZhB+4TlQU6ElDCI8ZW TFctvcho7MjVZd5u84rsju+re0CK9/bVfM8GY2kH0svgINLaUHcnu5nTvlDQgkD4qF qz6vwLZyzBjXPl5Zl8h8TcXU/3zon6s23PsKVc5jXR3i9WSZZpImbtEzx9ma5suyfq Cl00FLtrpqQwA== List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 21 Sep 2026 11:56:12 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/130153 Patch txWS to use bytes literals, str and bytes instead of six.b and the six type aliases, and remove the six.PY2 ord() fixups since indexing a bytes object already yields an int. Built for intel-corei7-64. AI-Generated: Uses Claude Code (Claude Opus 5) Signed-off-by: Markus Volk --- .../0001-drop-the-six-dependency.patch | 191 ++++++++++++++++++ .../python-txws/python3-txws_0.9.1.bb | 4 +- 2 files changed, 193 insertions(+), 2 deletions(-) create mode 100644 meta-python/recipes-connectivity/python-txws/python3-txws/0001-drop-the-six-dependency.patch diff --git a/meta-python/recipes-connectivity/python-txws/python3-txws/0001-drop-the-six-dependency.patch b/meta-python/recipes-connectivity/python-txws/python3-txws/0001-drop-the-six-dependency.patch new file mode 100644 index 0000000000..8718d28b02 --- /dev/null +++ b/meta-python/recipes-connectivity/python-txws/python3-txws/0001-drop-the-six-dependency.patch @@ -0,0 +1,191 @@ +From 9f33d0d87503cd6215e92b204f7d89d7caac82c2 Mon Sep 17 00:00:00 2001 +From: Markus Volk +Date: Mon, 21 Sep 2026 13:25:17 +0200 +Subject: [PATCH] drop the six dependency + +six is a Python 2 compatibility shim and txWS does not need it on +Python 3: six.b is a bytes literal or a latin-1 encode, text_type, +binary_type and string_types are str and bytes, and indexing a bytes +object already yields an int so the six.PY2 ord() fixups can go. + +Upstream-Status: Pending + +AI-Generated: Uses Claude Code (Claude Opus 5) +--- + setup.py | 2 +- + txws.py | 40 ++++++++++++++++------------------------ + 2 files changed, 17 insertions(+), 25 deletions(-) + +diff --git a/setup.py b/setup.py +index e4b3372..1564f1f 100755 +--- a/setup.py ++++ b/setup.py +@@ -5,7 +5,7 @@ from setuptools import setup + setup( + name="txWS", + py_modules=["txws"], +- setup_requires=["vcversioner", "six"], ++ setup_requires=["vcversioner"], + vcversioner={}, + author="Corbin Simpson", + author_email="simpsoco@osuosl.org", +diff --git a/txws.py b/txws.py +index 7de92a4..1da7cba 100644 +--- a/txws.py ++++ b/txws.py +@@ -27,8 +27,6 @@ from __future__ import division + + __version__ = "0.7.1" + +-import six +- + import array + + from base64 import b64encode, b64decode +@@ -139,7 +137,7 @@ def complete_hybi00(headers, challenge): + first = int("".join(i for i in key1 if i in digits)) // key1.count(" ") + second = int("".join(i for i in key2 if i in digits)) // key2.count(" ") + +- nonce = pack(">II8s", first, second, six.b(challenge)) ++ nonce = pack(">II8s", first, second, challenge.encode("latin-1")) + + return md5(nonce).digest() + +@@ -169,10 +167,10 @@ def make_hybi00_frame(buf): + and valid text without any 0xff bytes. + """ + +- if isinstance(buf, six.text_type): ++ if isinstance(buf, str): + buf = buf.encode('utf-8') + +- return six.b("\x00") + buf + six.b("\xff") ++ return b"\x00" + buf + b"\xff" + + def parse_hybi00_frames(buf): + """ +@@ -182,12 +180,12 @@ def parse_hybi00_frames(buf): + and will actively ignore it. + """ + +- start = buf.find(six.b("\x00")) ++ start = buf.find(b"\x00") + tail = 0 + frames = [] + + while start != -1: +- end = buf.find(six.b("\xff"), start + 1) ++ end = buf.find(b"\xff", start + 1) + if end == -1: + # Incomplete frame, try again later. + break +@@ -196,7 +194,7 @@ def parse_hybi00_frames(buf): + frame = buf[start + 1:end] + frames.append((NORMAL, frame)) + tail = end + 1 +- start = buf.find(six.b("\x00"), end + 1) ++ start = buf.find(b"\x00", end + 1) + + # Adjust the buffer and return. + buf = buf[tail:] +@@ -231,12 +229,12 @@ def make_hybi07_frame(buf, opcode=0x1): + else: + length = chr(len(buf)) + +- if isinstance(buf, six.text_type): ++ if isinstance(buf, str): + buf = buf.encode('utf-8') + + # Always make a normal packet. + header = chr(0x80 | opcode) +- return six.b(header + length) + buf ++ return (header + length).encode("latin-1") + buf + + def make_hybi07_frame_dwim(buf): + """ +@@ -244,9 +242,9 @@ def make_hybi07_frame_dwim(buf): + """ + + # TODO: eliminate magic numbers. +- if isinstance(buf, six.binary_type): ++ if isinstance(buf, bytes): + return make_hybi07_frame(buf, opcode=0x2) +- elif isinstance(buf, six.text_type): ++ elif isinstance(buf, str): + return make_hybi07_frame(buf.encode("utf-8"), opcode=0x1) + else: + raise TypeError("In binary support mode, frame data must be either str or unicode") +@@ -268,9 +266,6 @@ def parse_hybi07_frames(buf): + # about, and an opcode which nobody cares about. + header = buf[start] + +- if six.PY2: +- header = ord(header) +- + if header & 0x70: + # At least one of the reserved flags is set. Pork chop sandwiches! + raise WSException("Reserved flag in HyBi-07 frame (%d)" % header) +@@ -289,9 +284,6 @@ def parse_hybi07_frames(buf): + # extra length. + length = buf[start + 1] + +- if six.PY2: +- length = ord(length) +- + masked = length & 0x80 + length &= 0x7f + +@@ -342,7 +334,7 @@ def parse_hybi07_frames(buf): + data = unpack(">H", data[:2])[0], data[2:] + else: + # No reason given; use generic data. +- data = 1000, six.b("No reason given") ++ data = 1000, b"No reason given" + + frames.append((opcode, data)) + start += offset + length +@@ -355,7 +347,7 @@ class WebSocketProtocol(ProtocolWrapper): + layer. + """ + +- buf = six.b("") ++ buf = b"" + codec = None + location = "/" + host = "example.com" +@@ -385,7 +377,7 @@ class WebSocketProtocol(ProtocolWrapper): + return ISSLTransport(self.transport, None) is not None + + def writeEncoded(self, data): +- if isinstance(data, six.text_type): ++ if isinstance(data, str): + data = data.encode('utf-8') + self.transport.write(data) + +@@ -528,7 +520,7 @@ class WebSocketProtocol(ProtocolWrapper): + elif "Sec-WebSocket-Protocol" in self.headers: + protocols = self.headers["Sec-WebSocket-Protocol"] + +- if isinstance(protocols, six.string_types): ++ if isinstance(protocols, str): + protocols = [p.strip() for p in protocols.split(',')] + + for protocol in protocols: +@@ -587,7 +579,7 @@ class WebSocketProtocol(ProtocolWrapper): + # These lines look like: + # GET /some/path/to/a/websocket/resource HTTP/1.1 + if self.state == REQUEST: +- separator = six.b("\r\n") ++ separator = b"\r\n" + if separator in self.buf: + request, chaff, self.buf = self.buf.partition(separator) + request = request.decode('utf-8') +@@ -601,7 +593,7 @@ class WebSocketProtocol(ProtocolWrapper): + + elif self.state == NEGOTIATING: + # Check to see if we've got a complete set of headers yet. +- separator = six.b("\r\n\r\n") ++ separator = b"\r\n\r\n" + if separator in self.buf: + head, chaff, self.buf = self.buf.partition(separator) + head = head.decode('utf-8') diff --git a/meta-python/recipes-connectivity/python-txws/python3-txws_0.9.1.bb b/meta-python/recipes-connectivity/python-txws/python3-txws_0.9.1.bb index 9299539cef..11ce8610fd 100644 --- a/meta-python/recipes-connectivity/python-txws/python3-txws_0.9.1.bb +++ b/meta-python/recipes-connectivity/python-txws/python3-txws_0.9.1.bb @@ -4,10 +4,9 @@ HOMEPAGE = "https://github.com/MostAwesomeDude/txWS" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=76699830db7fa9e897f6a1ad05f98ec8" -DEPENDS = "python3-twisted python3-six python3-vcversioner python3-six-native python3-vcversioner-native" +DEPENDS = "python3-twisted python3-vcversioner python3-vcversioner-native" RDEPENDS:${PN} += " \ - python3-six \ python3-twisted \ " @@ -15,4 +14,5 @@ inherit setuptools3 pypi PYPI_PACKAGE = "txWS" +SRC_URI += "file://0001-drop-the-six-dependency.patch" SRC_URI[sha256sum] = "cb93086095d04a5d70f53a75053f7df478ff37e972c3637fb55ca4a9e6b94679"