python-jmespath: install jp as a non-byte-compiled command
authorAlexandru Ardelean <redacted>
Sun, 7 Jun 2026 11:37:59 +0000 (14:37 +0300)
committerAlexandru Ardelean <redacted>
Tue, 9 Jun 2026 06:27:30 +0000 (09:27 +0300)
Upstream ships its jp command-line tool as a plain "jp.py" script. Under
that name OpenWrt byte-compiles it into a non-executable /usr/bin/jp.pyc
(and the -src package keeps a "#!/usr/bin/env python" jp.py, which has no
interpreter on OpenWrt), so it fails the CI generic executable check.

Install it as /usr/bin/jp instead: the missing .py extension stops it from
being byte-compiled and Python3/FixShebang rewrites the shebang to
/usr/bin/python3. Add a test-version.sh override since jp takes a required
expression argument and has no version flag for the generic check to probe.

Signed-off-by: Alexandru Ardelean <redacted>
lang/python/python-jmespath/Makefile
lang/python/python-jmespath/test-version.sh [new file with mode: 0644]
lang/python/python-jmespath/test.sh

index 81fb9e11a6499a5e25456a471dc21f708916b7d4..59a5e15d6b4ce763cec5c10d2c52bcdd38439aa0 100644 (file)
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=python-jmespath
 PKG_VERSION:=1.1.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PYPI_NAME:=jmespath
 PKG_HASH:=472c87d80f36026ae83c6ddd0f1d05d4e510134ed462851fd5f754c8c3cbb88d
@@ -29,6 +29,11 @@ JMESPath (pronounced “james path”) allows you to declaratively specify
 how to extract elements from a JSON document.
 endef
 
+define Py3Package/python3-jmespath/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/jp.py $(1)/usr/bin/jp
+endef
+
 $(eval $(call Py3Package,python3-jmespath))
 $(eval $(call BuildPackage,python3-jmespath))
 $(eval $(call BuildPackage,python3-jmespath-src))
diff --git a/lang/python/python-jmespath/test-version.sh b/lang/python/python-jmespath/test-version.sh
new file mode 100644 (file)
index 0000000..a71961a
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# shellcheck shell=busybox
+
+# The jp command-line tool takes a required expression argument and has no
+# version flag, so the generic version check cannot detect the version from it.
+# The version is covered by the import check in test.sh instead.
+case "$PKG_NAME" in
+python3-jmespath | python3-jmespath-src)
+       exit 0
+       ;;
+*)
+       echo "Untested package: $PKG_NAME" >&2
+       exit 1
+       ;;
+esac
index 128cd0bbbabff8f0ab4779c2e5298e897cf518c8..56346bacc73bc18ab2d8963a219ed8eecc7107c3 100755 (executable)
@@ -37,3 +37,11 @@ assert expr.search({"a": {"b": 99}}) == 99
 
 sys.exit(0)
 EOF
+[ $? -eq 0 ] || exit 1
+
+# Verify the jp command-line tool
+result=$(echo '{"a": {"b": 42}}' | jp 'a.b')
+[ "$result" = "42" ] || {
+       echo "jp returned '$result', expected 42"
+       exit 1
+}
git clone https://git.99rst.org/PROJECT