Skip to contentSkip to conversation

package/python-paho-mqtt: bump to 1.6.1 to fix running on python 3.10

PATCH Superseded Marcus Hoffmann 2 participants 7 messages Aug 23, 2022 – Aug 25, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/python-paho-mqtt: bump to 1.6.1 to fix running on python 3.10

Fixes the following error on calling mqtt.publish():

File "/usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 222, in single
multiple([msg], hostname, port, client_id, keepalive, will, auth, tls,
File "/usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 126, in multiple
if not isinstance(msgs, collections.Iterable):
AttributeError: module 'collections' has no attribute 'Iterable'

This was actually changed in release 1.5.0 but 1.6.1 is alaready out for almost a year, so we just update to that version.

Changelog:
https://github.com/eclipse/paho.mqtt.python/blob/master/ChangeLog.txt

---
 package/python-paho-mqtt/python-paho-mqtt.hash | 6 +++---
 package/python-paho-mqtt/python-paho-mqtt.mk   | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
package/python-paho-mqtt/python-paho-mqtt.hash +3 -3
index bf3993e9195..56783e3fc08 100644
@@ -1,6 +1,6 @@
-# md5 from https://pypi.python.org/pypi/paho-mqtt/json, sha256 locally computed
-md5  e3ac29cd5dc247a01083a2a8f3fddd08  paho-mqtt-1.4.0.tar.gz
-sha256  e440a052b46d222e184be3be38676378722072fcd4dfd2c8f509fb861a7b0b79  paho-mqtt-1.4.0.tar.gz
+# package hashes from from https://pypi.org/project/paho-mqtt/#copy-hash-modal-e8e8e0de-1aec-462d-8ae0-d858d4f5a0d7
+md5  bdb20f88db291fdb4a0fe804c0f29316  paho-mqtt-1.6.1.tar.gz
+sha256  2a8291c81623aec00372b5a85558a372c747cbca8e9934dfe218638b8eefc26f  paho-mqtt-1.6.1.tar.gz
 sha256  76f13729e84e9222e543303df00f87d1b2c0995b6a505cd859a285667e44babb  LICENSE.txt
 sha256  e8cf7d54ea46c19aba793983889b7f7425e1ebfcaaccec764a7db091646e203c  edl-v10
 sha256  3b9be6b894d0769de796e653571ff6cef494913c0ce78c35a97db939e7d9087c  epl-v10
package/python-paho-mqtt/python-paho-mqtt.mk +2 -2
index d192749e1e1..892f5f33c74 100644
@@ -4,9 +4,9 @@
 #
 ################################################################################
 
-PYTHON_PAHO_MQTT_VERSION = 1.4.0
+PYTHON_PAHO_MQTT_VERSION = 1.6.1
 PYTHON_PAHO_MQTT_SOURCE = paho-mqtt-$(PYTHON_PAHO_MQTT_VERSION).tar.gz
-PYTHON_PAHO_MQTT_SITE = https://files.pythonhosted.org/packages/25/63/db25e62979c2a716a74950c9ed658dce431b5cb01fde29eb6cba9489a904
+PYTHON_PAHO_MQTT_SITE = https://files.pythonhosted.org/packages/f8/dd/4b75dcba025f8647bc9862ac17299e0d7d12d3beadbf026d8c8d74215c12
 PYTHON_PAHO_MQTT_LICENSE = EPL-1.0 or EDLv1.0
 PYTHON_PAHO_MQTT_LICENSE_FILES = LICENSE.txt edl-v10 epl-v10
 PYTHON_PAHO_MQTT_SETUP_TYPE = setuptools
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 support/testing/tests/package/test_python_paho_mqtt: new runtime test

---
 .../tests/package/sample_python_paho_mqtt.py  | 12 ++++++++
 .../tests/package/test_python_paho_mqtt.py    | 29 +++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 support/testing/tests/package/sample_python_paho_mqtt.py
 create mode 100644 support/testing/tests/package/test_python_paho_mqtt.py
support/testing/tests/package/sample_python_paho_mqtt.py new file +12 -0
new file mode 100644
index 00000000000..769ad6250fa
@@ -0,0 +1,12 @@
+from paho.mqtt import publish, subscribe
+
+publish.single(
+        'buildroot/test',
+        payload="Hello, World!",
+        qos=2,
+        retain=True,
+        hostname="localhost",
+        port=1883)
+
+message = subscribe.simple('buildroot/test')
+print(message.payload.decode())
support/testing/tests/package/test_python_paho_mqtt.py new file +29 -0
new file mode 100644
index 00000000000..b1e2b8fb422
@@ -0,0 +1,29 @@
+from tests.package.test_python import TestPythonPackageBase
+import os
+import time
+
+
+class TestPythonPahoMQTT(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_MOSQUITTO=y
+        BR2_PACKAGE_MOSQUITTO_BROKER=y
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_PAHO_MQTT=y
+        """
+    sample_scripts = ["tests/package/sample_python_paho_mqtt.py"]
+
+    def test_run(self):
+        self.login()
+        self.check_sample_scripts_exist()
+        cmd = "mosquitto > /dev/null 2>&1 &"
+        _, exit_code = self.emulator.run(cmd, timeout=self.timeout)
+
+        # Give some time for mosquitto broker to start up
+        time.sleep(1)
+
+        cmd = "%s %s" % (self.interpreter, os.path.basename(self.sample_scripts[0]))
+        output, exit_code = self.emulator.run(cmd, timeout=self.timeout)
+        self.assertEqual(exit_code, 0)
+        self.assertEqual(output[0], "Hello, World!")
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Tested-by on v1 2/2
#2 lore raw

Re: [Buildroot] [PATCH 2/2] support/testing/tests/package/test_python_paho_mqtt: new runtime test

Quoted 1 line · Marcus Hoffmann

Tested that without the first patch, the test indeed fails with

# python sample_python_paho_mqtt.py
Traceback (most recent call last):
  File "/root/sample_python_paho_mqtt.py", line 3, in <module>
    publish.single(
  File "usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 222, in single
  File "usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 126, in 
multiple
AttributeError: module 'collections' has no attribute 'Iterable'

Regards,
Arnout

Quoted 50 lines
---
  .../tests/package/sample_python_paho_mqtt.py  | 12 ++++++++
  .../tests/package/test_python_paho_mqtt.py    | 29 +++++++++++++++++++
  2 files changed, 41 insertions(+)

create mode 100644 support/testing/tests/package/sample_python_paho_mqtt.py create mode 100644 support/testing/tests/package/test_python_paho_mqtt.py

support/testing/tests/package/sample_python_paho_mqtt.py new file +12 -0
new file mode 100644
index 00000000000..769ad6250fa
@@ -0,0 +1,12 @@
+from paho.mqtt import publish, subscribe
+
+publish.single(
+        'buildroot/test',
+        payload="Hello, World!",
+        qos=2,
+        retain=True,
+        hostname="localhost",
+        port=1883)
+
+message = subscribe.simple('buildroot/test')
+print(message.payload.decode())
support/testing/tests/package/test_python_paho_mqtt.py new file +19 -0
new file mode 100644
index 00000000000..b1e2b8fb422
@@ -0,0 +1,29 @@
+from tests.package.test_python import TestPythonPackageBase
+import os
+import time
+
+
+class TestPythonPahoMQTT(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_MOSQUITTO=y
+        BR2_PACKAGE_MOSQUITTO_BROKER=y
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_PAHO_MQTT=y
+        """
+    sample_scripts = ["tests/package/sample_python_paho_mqtt.py"]
+
+    def test_run(self):
+        self.login()
+        self.check_sample_scripts_exist()

support/testing/tests/package/test_python_paho_mqtt.py line 29

Quoted 10 lines
support/testing/tests/package/test_python_paho_mqtt.py new file +10 -0
+        cmd = "mosquitto > /dev/null 2>&1 &"
+        _, exit_code = self.emulator.run(cmd, timeout=self.timeout)
+
+        # Give some time for mosquitto broker to start up
+        time.sleep(1)
+
+        cmd = "%s %s" % (self.interpreter, os.path.basename(self.sample_scripts[0]))
+        output, exit_code = self.emulator.run(cmd, timeout=self.timeout)
+        self.assertEqual(exit_code, 0)
+        self.assertEqual(output[0], "Hello, World!")

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
In reply to Marcus Hoffmann
Quoted 8 lines · Marcus Hoffmann

Fixes the following error on calling mqtt.publish():

File "/usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 222, in single
multiple([msg], hostname, port, client_id, keepalive, will, auth, tls,
File "/usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 126, in multiple
if not isinstance(msgs, collections.Iterable):
AttributeError: module 'collections' has no attribute 'Iterable'

Quoted 5 lines

This was actually changed in release 1.5.0 but 1.6.1 is alaready out for almost a year, so we just update to that version.

Changelog:
https://github.com/eclipse/paho.mqtt.python/blob/master/ChangeLog.txt

Jumping from 1.4.0 to 1.6.1 at this point in the stabilisation month is not
ideal...

Quoted 11 lines
---
  package/python-paho-mqtt/python-paho-mqtt.hash | 6 +++---
  package/python-paho-mqtt/python-paho-mqtt.mk   | 4 ++--
  2 files changed, 5 insertions(+), 5 deletions(-)
package/python-paho-mqtt/python-paho-mqtt.hash +0 -0
index bf3993e9195..56783e3fc08 100644

package/python-paho-mqtt/python-paho-mqtt.hash line 4

Quoted 7 lines
package/python-paho-mqtt/python-paho-mqtt.hash +3 -3
@@ -1,6 +1,6 @@
-# md5 from https://pypi.python.org/pypi/paho-mqtt/json, sha256 locally computed
-md5  e3ac29cd5dc247a01083a2a8f3fddd08  paho-mqtt-1.4.0.tar.gz
-sha256  e440a052b46d222e184be3be38676378722072fcd4dfd2c8f509fb861a7b0b79  paho-mqtt-1.4.0.tar.gz
+# package hashes from from https://pypi.org/project/paho-mqtt/#copy-hash-modal-e8e8e0de-1aec-462d-8ae0-d858d4f5a0d7
+md5  bdb20f88db291fdb4a0fe804c0f29316  paho-mqtt-1.6.1.tar.gz
+sha256  2a8291c81623aec00372b5a85558a372c747cbca8e9934dfe218638b8eefc26f  paho-mqtt-1.6.1.tar.gz
  sha256  76f13729e84e9222e543303df00f87d1b2c0995b6a505cd859a285667e44babb  LICENSE.txt

Unfortunately, the LICENSE hash changed, because in fact the license changed:
@@ -1,3 +1,3 @@
-This project is dual licensed under the Eclipse Public License 1.0 and the -Eclipse Distribution License 1.0 as described in the epl-v10 and edl-v10 files. +This project is dual licensed under the Eclipse Public License 2.0 and the +Eclipse Distribution License 1.0 as described in the epl-v20 and edl-v10 files.

And to top things up, epl-v20 is missing in the tarball...

Could you check if there is a version that does have the epl-v20 file? Perhaps
even from an upstream git repo?

Regards,
Arnout

Quoted 8 lines
package/python-paho-mqtt/python-paho-mqtt.hash +0 -0
  sha256  e8cf7d54ea46c19aba793983889b7f7425e1ebfcaaccec764a7db091646e203c  edl-v10
  sha256  3b9be6b894d0769de796e653571ff6cef494913c0ce78c35a97db939e7d9087c  epl-v10
package/python-paho-mqtt/python-paho-mqtt.mk +0 -0
index d192749e1e1..892f5f33c74 100644
@@ -4,9 +4,9 @@
  #

package/python-paho-mqtt/python-paho-mqtt.mk line 12

Quoted 10 lines
package/python-paho-mqtt/python-paho-mqtt.mk +2 -2
  ################################################################################
 
-PYTHON_PAHO_MQTT_VERSION = 1.4.0
+PYTHON_PAHO_MQTT_VERSION = 1.6.1
  PYTHON_PAHO_MQTT_SOURCE = paho-mqtt-$(PYTHON_PAHO_MQTT_VERSION).tar.gz
-PYTHON_PAHO_MQTT_SITE = https://files.pythonhosted.org/packages/25/63/db25e62979c2a716a74950c9ed658dce431b5cb01fde29eb6cba9489a904
+PYTHON_PAHO_MQTT_SITE = https://files.pythonhosted.org/packages/f8/dd/4b75dcba025f8647bc9862ac17299e0d7d12d3beadbf026d8c8d74215c12
  PYTHON_PAHO_MQTT_LICENSE = EPL-1.0 or EDLv1.0
  PYTHON_PAHO_MQTT_LICENSE_FILES = LICENSE.txt edl-v10 epl-v10
  PYTHON_PAHO_MQTT_SETUP_TYPE = setuptools

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Hi Arnout,
thanks for the review.

Quoted 11 lines · Arnout Vandecappelle
Quoted 8 lines · Marcus Hoffmann

Fixes the following error on calling mqtt.publish():

   File "/usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 222, in single multiple([msg], hostname, port, client_id, keepalive, will, auth, tls, File "/usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 126, in multiple if not isinstance(msgs, collections.Iterable):
AttributeError: module 'collections' has no attribute 'Iterable'

Quoted 8 lines
Quoted 5 lines

This was actually changed in release 1.5.0 but 1.6.1 is alaready out for almost a year, so we just update to that version.

Changelog:
https://github.com/eclipse/paho.mqtt.python/blob/master/ChangeLog.txt

 Jumping from 1.4.0 to 1.6.1 at this point in the stabilisation month
is not ideal...

There's two other options I can think of, I wasn't sure what's best here:

* backport https://github.com/eclipse/paho.mqtt.python/pull/497/files, that should be easy enough
* Update to 1.5.1 (not 1.5.0 as I claimed above) which is the first release that includes the fix for the problem

Do you have a preference for one of the two over updating to the latest release? (I.e. defer the 1.6.1 update to next)

Quoted 34 lines
Quoted 21 lines

---
  package/python-paho-mqtt/python-paho-mqtt.hash | 6 +++--- package/python-paho-mqtt/python-paho-mqtt.mk   | 4 ++--

  2 files changed, 5 insertions(+), 5 deletions(-)
package/python-paho-mqtt/python-paho-mqtt.hash +0 -1
index bf3993e9195..56783e3fc08 100644
@@ -1,6 +1,6 @@
-# md5 from https://pypi.python.org/pypi/paho-mqtt/json, sha256 

locally computed

package/python-paho-mqtt/python-paho-mqtt.hash +0 -2
-md5  e3ac29cd5dc247a01083a2a8f3fddd08  paho-mqtt-1.4.0.tar.gz
-sha256  

e440a052b46d222e184be3be38676378722072fcd4dfd2c8f509fb861a7b0b79 paho-mqtt-1.4.0.tar.gz +# package hashes from from
https://pypi.org/project/paho-mqtt/#copy-hash-modal-e8e8e0de-1aec-462d-8ae0-d858d4f5a0d7

package/python-paho-mqtt/python-paho-mqtt.hash +2 -0
+md5  bdb20f88db291fdb4a0fe804c0f29316  paho-mqtt-1.6.1.tar.gz
+sha256  
Quoted 2 lines

2a8291c81623aec00372b5a85558a372c747cbca8e9934dfe218638b8eefc26f paho-mqtt-1.6.1.tar.gz sha256 76f13729e84e9222e543303df00f87d1b2c0995b6a505cd859a285667e44babb LICENSE.txt

 Unfortunately, the LICENSE hash changed, because in fact the license
changed:

(quoted diff) +0 -2
@@ -1,3 +1,3 @@
-This project is dual licensed under the Eclipse Public License 1.0 and the
-Eclipse Distribution License 1.0 as described in the epl-v10 and 

edl-v10 files.

(quoted diff) +2 -0
+This project is dual licensed under the Eclipse Public License 2.0 and the
+Eclipse Distribution License 1.0 as described in the epl-v20 and 

edl-v10 files.

Quoted 4 lines

 And to top things up, epl-v20 is missing in the tarball...

 Could you check if there is a version that does have the epl-v20 file?
Perhaps even from an upstream git repo?

Ah, I suppose those hashes are only checked on legal-info and not a normal build of the package?

https://www.eclipse.org/paho/index.php?page=clients/python/index.php suggests installation via pypi/pip is the canonical way but offers from source installation as an alternative.

https://github.com/eclipse/paho.mqtt.python and the github auto-generated tarball contain the epl-20 license file, should I change the source download to that? (I remember github auto-generated tarballs being problematic in the past because they might silently change. Does the buildroot project have a policy here?)

Quoted 4 lines

 Regards,
 Arnout

[...]

Best,
Marcus
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw
Quoted 21 lines · Marcus Hoffmann

Hi Arnout,
thanks for the review.

Quoted 17 lines · Arnout Vandecappelle
Quoted 13 lines · Marcus Hoffmann

Fixes the following error on calling mqtt.publish():

   File "/usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 222, in single multiple([msg], hostname, port, client_id, keepalive, will, auth, tls, File "/usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 126, in multiple if not isinstance(msgs, collections.Iterable):
AttributeError: module 'collections' has no attribute 'Iterable'

This was actually changed in release 1.5.0 but 1.6.1 is alaready out for almost a year, so we just update to that version.

Changelog:
https://github.com/eclipse/paho.mqtt.python/blob/master/ChangeLog.txt

Quoted 8 lines
Quoted 1 line

  Jumping from 1.4.0 to 1.6.1 at this point in the stabilisation month is not ideal...

There's two other options I can think of, I wasn't sure what's best here:

* backport https://github.com/eclipse/paho.mqtt.python/pull/497/files, that should be easy enough
* Update to 1.5.1 (not 1.5.0 as I claimed above) which is the first release that includes the fix for the problem

Do you have a preference for one of the two over updating to the latest release? (I.e. defer the 1.6.1 update to next)

If you feel up to it, both is ideal: backport the fix for master and
2022.02.x, and do the bump for next.

Quoted 30 lines
Quoted 30 lines
Quoted 20 lines

---
  package/python-paho-mqtt/python-paho-mqtt.hash | 6 +++--- package/python-paho-mqtt/python-paho-mqtt.mk   | 4 ++--

  2 files changed, 5 insertions(+), 5 deletions(-)
package/python-paho-mqtt/python-paho-mqtt.hash +0 -3
index bf3993e9195..56783e3fc08 100644
@@ -1,6 +1,6 @@
-# md5 from https://pypi.python.org/pypi/paho-mqtt/json, sha256 locally computed
-md5  e3ac29cd5dc247a01083a2a8f3fddd08  paho-mqtt-1.4.0.tar.gz
-sha256 e440a052b46d222e184be3be38676378722072fcd4dfd2c8f509fb861a7b0b79 

paho-mqtt-1.4.0.tar.gz
+# package hashes from from
https://pypi.org/project/paho-mqtt/#copy-hash-modal-e8e8e0de-1aec-462d-8ae0-d858d4f5a0d7

package/python-paho-mqtt/python-paho-mqtt.hash +2 -0
+md5  bdb20f88db291fdb4a0fe804c0f29316  paho-mqtt-1.6.1.tar.gz
+sha256 2a8291c81623aec00372b5a85558a372c747cbca8e9934dfe218638b8eefc26f 
Quoted 2 lines

paho-mqtt-1.6.1.tar.gz
  sha256 76f13729e84e9222e543303df00f87d1b2c0995b6a505cd859a285667e44babb LICENSE.txt

  Unfortunately, the LICENSE hash changed, because in fact the license changed:

(quoted diff) +2 -2
@@ -1,3 +1,3 @@
-This project is dual licensed under the Eclipse Public License 1.0 and the
-Eclipse Distribution License 1.0 as described in the epl-v10 and edl-v10 files.
+This project is dual licensed under the Eclipse Public License 2.0 and the
+Eclipse Distribution License 1.0 as described in the epl-v20 and edl-v10 files.
 
Quoted 5 lines
Quoted 3 lines

  And to top things up, epl-v20 is missing in the tarball...

  Could you check if there is a version that does have the epl-v20 file? Perhaps even from an upstream git repo?

Ah, I suppose those hashes are only checked on legal-info and not a normal build of the package?

Yes, I always do 'make foo-legal-info' on a version bump to check exactly this.

Quoted 3 lines

https://www.eclipse.org/paho/index.php?page=clients/python/index.php suggests installation via pypi/pip is the canonical way but offers from source installation as an alternative.

https://github.com/eclipse/paho.mqtt.python and the github auto-generated tarball contain the epl-20 license file, should I change the source download to that? (I remember github auto-generated tarballs being problematic in the past because they might silently change. Does the buildroot project have a policy here?)

github autogenerated tarballs have been stable for the last 6 years or so.
Please do use the github helper however.

It's weird that the github tag does have the file, but the pip upload doesn't...

Regards,
Arnout

Quoted 10 lines
Quoted 5 lines

  Regards,
  Arnout

[...]

Best,
Marcus

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#6 lore raw

On 25.08.22 16:17, Arnout Vandecappelle wrote:
[...]

Quoted 8 lines

 github autogenerated tarballs have been stable for the last 6 years or
so. Please do use the github helper however.

 It's weird that the github tag does have the file, but the pip upload
doesn't...

In setuptools world everything to be packaged into the sdist (which is uploaded to pypi) needs to be manually specified: https://github.com/eclipse/paho.mqtt.python/blob/master/MANIFEST.in

Seems like Fabrice also noticed already: https://github.com/eclipse/paho.mqtt.python/pull/635

Marcus
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot