mirror of
https://github.com/openwrt/packages.git
synced 2026-04-15 19:02:09 +00:00
Update package to 2.1.0. This is a major version bump with API changes including new callback signatures. Add PYPI_SOURCE_NAME since PyPI switched sdist filename to use underscores (paho_mqtt-2.1.0.tar.gz). Add PKG_BUILD_DEPENDS for python-hatchling since upstream switched build backend from setuptools to hatchling. Add test.sh to verify basic client functionality. Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
28 lines
737 B
Bash
28 lines
737 B
Bash
#!/bin/sh
|
|
[ "$1" = python3-paho-mqtt ] || exit 0
|
|
|
|
python3 - << 'EOF'
|
|
import paho.mqtt.client as mqtt
|
|
|
|
# Verify version
|
|
assert hasattr(mqtt, '__version__') or hasattr(mqtt.Client, '__module__')
|
|
|
|
# Test basic client instantiation
|
|
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
|
|
assert client is not None
|
|
|
|
# Test that the client has expected methods
|
|
assert callable(getattr(client, 'connect', None))
|
|
assert callable(getattr(client, 'publish', None))
|
|
assert callable(getattr(client, 'subscribe', None))
|
|
assert callable(getattr(client, 'disconnect', None))
|
|
|
|
# Test MQTTMessage
|
|
msg = mqtt.MQTTMessage(topic=b'test/topic')
|
|
msg.payload = b'hello'
|
|
assert msg.topic == 'test/topic'
|
|
assert msg.payload == b'hello'
|
|
|
|
print("paho-mqtt OK")
|
|
EOF
|