ASR_BASE

Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/external/subpack/lang/python/python-twisted/Makefile b/external/subpack/lang/python/python-twisted/Makefile
new file mode 100644
index 0000000..79f2f2a
--- /dev/null
+++ b/external/subpack/lang/python/python-twisted/Makefile
@@ -0,0 +1,77 @@
+#
+# Copyright (C) 2006-2011 OpenWrt.org
+# Copyright (C) 2015-2016, 2018-2023 Jeffery To
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=python-twisted
+PKG_VERSION:=23.10.0
+PKG_RELEASE:=1
+
+PYPI_NAME:=Twisted
+PYPI_SOURCE_NAME:=twisted
+PKG_HASH:=987847a0790a2c597197613686e2784fd54167df3a55d0fb17c8412305d76ce5
+
+PKG_BUILD_DEPENDS:=libtirpc
+
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=LICENSE
+PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
+PKG_CPE_ID:=cpe:/a:twistedmatrix:twisted
+
+PKG_BUILD_DEPENDS:=python-hatchling/host python-hatch-fancy-pypi-readme/host python-incremental/host
+
+include ../pypi.mk
+include $(INCLUDE_DIR)/package.mk
+include ../python3-package.mk
+
+define Package/python3-twisted
+  SECTION:=lang
+  CATEGORY:=Languages
+  SUBMENU:=Python
+  TITLE:=Asynchronous networking framework
+  URL:=https://twistedmatrix.com/
+  DEPENDS:= \
+      +python3 \
+      +python3-appdirs \
+      +python3-attrs \
+      +python3-automat \
+      +python3-bcrypt \
+      +python3-constantly \
+      +python3-cryptography \
+      +python3-hyperlink \
+      +python3-idna \
+      +python3-incremental \
+      +python3-pyopenssl \
+      +python3-service-identity \
+      +python3-typing-extensions \
+      +python3-zope-interface
+endef
+
+define Package/python3-twisted/description
+Twisted is a networking engine written in Python, supporting numerous
+protocols. It contains a web server, numerous chat clients, chat
+servers, mail servers, and more.
+endef
+
+define Py3Package/python3-twisted/filespec
++|$(PYTHON3_PKG_DIR)
+-|$(PYTHON3_PKG_DIR)/twisted/conch/scripts/tkconch.py
+endef
+
+define Py3Package/python3-twisted/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+	for bin in $(1)/usr/bin/*; do \
+		mv $$$$bin $$$${bin}3 ; \
+		$(LN) $$$${bin##*/}3 $$$$bin ; \
+	done
+endef
+
+$(eval $(call Py3Package,python3-twisted))
+$(eval $(call BuildPackage,python3-twisted))
+$(eval $(call BuildPackage,python3-twisted-src))
diff --git a/external/subpack/lang/python/python-twisted/patches/001-omit-tkconch.patch b/external/subpack/lang/python/python-twisted/patches/001-omit-tkconch.patch
new file mode 100644
index 0000000..d9ad0d5
--- /dev/null
+++ b/external/subpack/lang/python/python-twisted/patches/001-omit-tkconch.patch
@@ -0,0 +1,18 @@
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -138,7 +138,6 @@ ckeygen = "twisted.conch.scripts.ckeygen
+ conch = "twisted.conch.scripts.conch:run"
+ mailmail = "twisted.mail.scripts.mailmail:run"
+ pyhtmlizer = "twisted.scripts.htmlizer:run"
+-tkconch = "twisted.conch.scripts.tkconch:run"
+ trial = "twisted.scripts.trial:run"
+ twist = "twisted.application.twist._twist:Twist.main"
+ twistd = "twisted.scripts.twistd:run"
+--- a/src/twisted/python/twisted-completion.zsh
++++ b/src/twisted/python/twisted-completion.zsh
+@@ -1,4 +1,4 @@
+-#compdef twist twistd trial conch cftp ckeygen pyhtmlizer tkconch
++#compdef twist twistd trial conch cftp ckeygen pyhtmlizer
+ #
+ # This is the ZSH completion file for Twisted commands. It calls the current
+ # command-line with the special "--_shell-completion" option which is handled
diff --git a/external/subpack/lang/python/python-twisted/patches/002-omit-tests.patch b/external/subpack/lang/python/python-twisted/patches/002-omit-tests.patch
new file mode 100644
index 0000000..ddf8f9e
--- /dev/null
+++ b/external/subpack/lang/python/python-twisted/patches/002-omit-tests.patch
@@ -0,0 +1,10 @@
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -182,6 +182,7 @@ exclude = [
+     "*.pxi",
+     "*.pyx",
+     "build.bat",
++    "test",
+ ]
+ 
+ [tool.hatch.build.targets.sdist]
diff --git a/external/subpack/lang/python/python-twisted/test.sh b/external/subpack/lang/python/python-twisted/test.sh
new file mode 100644
index 0000000..3b93107
--- /dev/null
+++ b/external/subpack/lang/python/python-twisted/test.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+[ "$1" = python3-twisted ] || exit 0
+
+python3 -c 'from twisted.internet import reactor'