mirror of
https://github.com/openwrt/packages.git
synced 2026-05-31 23:12:02 +08:00
python-ubus: backport patch for newer Python
Build is failing for a while now with error:
```
14.3.0_musl/usr/include -I/builder/shared-workdir/build/sdk/staging_dir/toolchain-mipsel_24kc_gcc-14.3.0_musl/include -I/builder/shared-workdir/build/sdk/staging_dir/toolchain-mipsel_24kc_gcc-14.3.0_musl/include/fortify -I/builder/shared-workdir/build/sdk/staging_dir/target-mipsel_24kc_musl/usr/include/python3.14 -fPIC -I/builder/shared-workdir/build/sdk/staging_dir/target-mipsel_24kc_musl/usr/include/python3.14 -c ./ubus_python.c -o build/temp.linux-mipsel-cpython-314/ubus_python.o
./ubus_python.c: In function 'ubus_python_add':
./ubus_python.c:1081:17: error: implicit declaration of function 'PyEval_CallMethod'; did you mean 'PyObject_CallMethod'? [-Wimplicit-function-declaration]
1081 | PyEval_CallMethod(python_alloc_list, "pop", "");
| ^~~~~~~~~~~~~~~~~
| PyObject_CallMethod
error: command '/builder/shared-workdir/build/sdk/staging_dir/toolc
```
This has been fixed on version 0.1.3, but that hasn't been
published to pypi yet.
Also add test.sh
Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
(cherry picked from commit 29e685e1f8)
This commit is contained in:
committed by
Josef Schlehofer
parent
c9b004abf2
commit
e0331d82fe
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$1" = python3-ubus ] || exit 0
|
||||
|
||||
python3 - << 'EOF'
|
||||
import ubus
|
||||
|
||||
# Constants must be present
|
||||
assert hasattr(ubus, "BLOBMSG_TYPE_STRING"), "missing BLOBMSG_TYPE_STRING"
|
||||
assert hasattr(ubus, "BLOBMSG_TYPE_BOOL"), "missing BLOBMSG_TYPE_BOOL"
|
||||
assert hasattr(ubus, "BLOBMSG_TYPE_INT32"), "missing BLOBMSG_TYPE_INT32"
|
||||
|
||||
# Not connected by default
|
||||
assert ubus.get_connected() is False, "should not be connected on import"
|
||||
assert ubus.get_socket_path() is None, "socket path should be None when not connected"
|
||||
|
||||
# Connecting to a non-existent socket must raise IOError
|
||||
try:
|
||||
ubus.connect(socket_path="/non/existing/ubus.sock")
|
||||
raise AssertionError("expected IOError for missing socket")
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
# Operations that require a connection must raise RuntimeError when disconnected
|
||||
for fn, args in [
|
||||
(ubus.disconnect, ()),
|
||||
(ubus.send, ("event", {})),
|
||||
(ubus.loop, (1,)),
|
||||
(ubus.objects, ()),
|
||||
]:
|
||||
try:
|
||||
fn(*args)
|
||||
raise AssertionError(f"{fn.__name__} should raise RuntimeError when not connected")
|
||||
except RuntimeError:
|
||||
pass
|
||||
EOF
|
||||
Reference in New Issue
Block a user