From: Philip A. Prindeville Date: Sun, 12 Jul 2026 03:09:05 +0000 (-0600) Subject: python-pexpect: add package X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=5544edf33aa7d422bf66340d0b9c88c107874e47;p=openwrt-packages.git python-pexpect: add package Useful for provisioning devices like modems that present themselves via a serial device. Signed-off-by: Philip A. Prindeville --- diff --git a/lang/python/python-pexpect/Makefile b/lang/python/python-pexpect/Makefile new file mode 100644 index 000000000..22c9deb33 --- /dev/null +++ b/lang/python/python-pexpect/Makefile @@ -0,0 +1,40 @@ +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=python-pexpect +PKG_VERSION:=4.9.0 +PKG_RELEASE:=1 + +PYPI_NAME:=pexpect +PKG_HASH:=ee7d41123f3c9911050ea2c2dac107568dc43b2d3b0c7557a33212c398ead30f + +PKG_LICENSE:=ISC +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Philip Prindeville , Alexandru Ardelean + +PKG_BUILD_DEPENDS:=python-setuptools/host + +include ../pypi.mk +include $(INCLUDE_DIR)/package.mk +include ../python3-package.mk + +define Package/python3-pexpect + SECTION:=lang + CATEGORY:=Languages + SUBMENU:=Python + TITLE:=Pexpect is a Pure Python Expect-like module + URL:=https://github.com/pexpect/pexpect + DEPENDS:=+python3-light +python3-ptyprocess +endef + +define Package/python3-pexpect/description + Pexpect is a Pure Python Expect-like module + + Pexpect makes Python a better tool for controlling other applications. +endef + +$(eval $(call Py3Package,python3-pexpect)) +$(eval $(call BuildPackage,python3-pexpect)) +$(eval $(call BuildPackage,python3-pexpect-src)) diff --git a/lang/python/python-pexpect/test.sh b/lang/python/python-pexpect/test.sh new file mode 100644 index 000000000..35cb3a3ac --- /dev/null +++ b/lang/python/python-pexpect/test.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +[ "$1" = "python3-pexpect" ] || exit 0 + +# current installed version from python metadata +installed_version="$(python3 -c 'import pexpect; print(pexpect.__version__)')" + +# use expected version from package metadata/environment +expected_version="${PKG_VERSION}" + +if [ "$installed_version" != "$expected_version" ]; then + echo "Wrong version: $installed_version (expected $expected_version)" + exit 1 +fi + +python3 - << 'EOF' +import pexpect + +pattern = "pexpect-test" +child = pexpect.spawn('sh', ['-c', 'printf "%s\\n" "pexpect-test"'], encoding='utf-8') +child.expect_exact(pattern) +child.expect(pexpect.EOF) +child.close() +assert child.exitstatus == 0, f"child exited {child.exitstatus}" + +print("python3-pexpect OK") +EOF