diff mbox

[1/1] python-paho-mqtt: add new package

Message ID 1451307455-23911-1-git-send-email-zinosat@tiscali.it
State Changes Requested
Headers show

Commit Message

Davide Viti Dec. 28, 2015, 12:57 p.m. UTC
Signed-off-by: Davide Viti <zinosat@tiscali.it>
---
 package/Config.in                              |  1 +
 package/python-paho-mqtt/Config.in             |  9 +++++++++
 package/python-paho-mqtt/python-paho-mqtt.hash |  2 ++
 package/python-paho-mqtt/python-paho-mqtt.mk   | 21 +++++++++++++++++++++
 4 files changed, 33 insertions(+)
 create mode 100644 package/python-paho-mqtt/Config.in
 create mode 100644 package/python-paho-mqtt/python-paho-mqtt.hash
 create mode 100644 package/python-paho-mqtt/python-paho-mqtt.mk

Comments

Yegor Yefremov Dec. 28, 2015, 1:24 p.m. UTC | #1
Hi Davide,

On Mon, Dec 28, 2015 at 1:57 PM, Davide Viti <zinosat@tiscali.it> wrote:
> Signed-off-by: Davide Viti <zinosat@tiscali.it>
> ---
>  package/Config.in                              |  1 +
>  package/python-paho-mqtt/Config.in             |  9 +++++++++
>  package/python-paho-mqtt/python-paho-mqtt.hash |  2 ++
>  package/python-paho-mqtt/python-paho-mqtt.mk   | 21 +++++++++++++++++++++
>  4 files changed, 33 insertions(+)
>  create mode 100644 package/python-paho-mqtt/Config.in
>  create mode 100644 package/python-paho-mqtt/python-paho-mqtt.hash
>  create mode 100644 package/python-paho-mqtt/python-paho-mqtt.mk
>
> diff --git a/package/Config.in b/package/Config.in
> index dd44743..aab1958 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -659,6 +659,7 @@ menu "External python modules"
>         source "package/python-networkmanager/Config.in"
>         source "package/python-nfc/Config.in"
>         source "package/python-numpy/Config.in"
> +       source "package/python-paho-mqtt/Config.in"
>         source "package/python-pam/Config.in"
>         source "package/python-posix-ipc/Config.in"
>         source "package/python-protobuf/Config.in"
> diff --git a/package/python-paho-mqtt/Config.in b/package/python-paho-mqtt/Config.in
> new file mode 100644
> index 0000000..1b20da9
> --- /dev/null
> +++ b/package/python-paho-mqtt/Config.in
> @@ -0,0 +1,9 @@
> +config BR2_PACKAGE_PYTHON_PAHO_MQTT
> +       bool "python-paho-mqtt"
> +       help
> +         The Paho Python Client provides a client class with support
> +         for both MQTT v3.1 and v3.1.1 on Python 2.7 or 3.x. It also
> +         provides some helper functions to make publishing one off
> +         messages to an MQTT server very straightforward.
> +
> +         https://pypi.python.org/pypi/paho-mqtt
> diff --git a/package/python-paho-mqtt/python-paho-mqtt.hash b/package/python-paho-mqtt/python-paho-mqtt.hash
> new file mode 100644
> index 0000000..eb1dfb5
> --- /dev/null
> +++ b/package/python-paho-mqtt/python-paho-mqtt.hash
> @@ -0,0 +1,2 @@
> +# Locally computed:
> +sha256  0f7a629efe6e3a2c61b59d3550aa9f2c4529b5689a65fde45e6f1ac36b9a261e  paho-mqtt-1.1.tar.gz
> diff --git a/package/python-paho-mqtt/python-paho-mqtt.mk b/package/python-paho-mqtt/python-paho-mqtt.mk

please also provide oficial md5 from pypi like we do in for example
package/python-pyudev

> new file mode 100644
> index 0000000..f039835
> --- /dev/null
> +++ b/package/python-paho-mqtt/python-paho-mqtt.mk
> @@ -0,0 +1,21 @@
> +################################################################################
> +#
> +# python-paho-mqtt
> +#
> +################################################################################
> +
> +PYTHON_PAHO_MQTT_VERSION = 1.1
> +PYTHON_PAHO_MQTT_SOURCE = paho-mqtt-$(PYTHON_PAHO_MQTT_VERSION).tar.gz
> +PYTHON_PAHO_MQTT_SITE = https://pypi.python.org/packages/source/p/paho-mqtt
> +PYTHON_PAHO_MQTT_LICENSE = EPLv1.0 or EDLv1.0
> +PYTHON_PAHO_MQTT_LICENSE_FILES = LICENSE.txt edl-v10 epl-v10
> +PYTHON_PAHO_MQTT_SETUP_TYPE = setuptools
> +
> +define PYTHON_PAHO_MQTT_INSTALL_TARGET_CMDS
> +       (cd $(@D); \
> +               $(HOST_PKG_PYTHON_SETUPTOOLS_ENV) \
> +               $(HOST_DIR)/usr/bin/python2 setup.py install \
> +               --root=/)
> +endef

Why do you need this and have you tested this with Python3?

> +$(eval $(python-package))
> --
> 2.1.4
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Thomas Petazzoni Dec. 28, 2015, 1:25 p.m. UTC | #2
Davide,

On Mon, 28 Dec 2015 13:57:35 +0100, Davide Viti wrote:

> diff --git a/package/python-paho-mqtt/Config.in b/package/python-paho-mqtt/Config.in
> new file mode 100644
> index 0000000..1b20da9
> --- /dev/null
> +++ b/package/python-paho-mqtt/Config.in
> @@ -0,0 +1,9 @@
> +config BR2_PACKAGE_PYTHON_PAHO_MQTT
> +	bool "python-paho-mqtt"
> +	help
> +	  The Paho Python Client provides a client class with support
> +	  for both MQTT v3.1 and v3.1.1 on Python 2.7 or 3.x. It also
> +	  provides some helper functions to make publishing one off
> +	  messages to an MQTT server very straightforward.

I know it was copy/pasted from the website, but this last sentence
doesn't make much sense to me. Maybe it's because I'm not a native
speaker, but "publishing one off messages" is not something that I can
parse. Did they mean "publishing on/off messages" ? Or something else ?

> +PYTHON_PAHO_MQTT_VERSION = 1.1
> +PYTHON_PAHO_MQTT_SOURCE = paho-mqtt-$(PYTHON_PAHO_MQTT_VERSION).tar.gz
> +PYTHON_PAHO_MQTT_SITE = https://pypi.python.org/packages/source/p/paho-mqtt
> +PYTHON_PAHO_MQTT_LICENSE = EPLv1.0 or EDLv1.0
> +PYTHON_PAHO_MQTT_LICENSE_FILES = LICENSE.txt edl-v10 epl-v10
> +PYTHON_PAHO_MQTT_SETUP_TYPE = setuptools
> +
> +define PYTHON_PAHO_MQTT_INSTALL_TARGET_CMDS
> +	(cd $(@D); \
> +		$(HOST_PKG_PYTHON_SETUPTOOLS_ENV) \
> +		$(HOST_DIR)/usr/bin/python2 setup.py install \
> +		--root=/)
> +endef

Why do you need to override <pkg>_INSTALL_TARGET_CMDS ?

Using $(HOST_PKG_PYTHON_SETUPTOOLS_ENV) for a target package looks
clearly wrong. Also, since you're not passing
--prefix=$(TARGET_DIR)/usr, I don't see how this overriden install
target commands can even install something in $(TARGET_DIR).

Could you clarify this?

Thanks!

Thomas
Davide Viti Dec. 29, 2015, 10:37 p.m. UTC | #3
*Hi Thomas and Yegor,*

I've tried to rebuild the package using python3 and the build fails finding
$(HOST_DIR)/usr/bin/python2

I guess it's worth discussing the redefinition of
PYTHON_PAHO_MQTT_INSTALL_TARGET_CMDS though, since it probably is the
origin of the problems

2015-12-28 14:25 GMT+01:00 Thomas Petazzoni <
thomas.petazzoni@free-electrons.com>:

>
> On Mon, 28 Dec 2015 13:57:35 +0100, Davide Viti wrote:
>
> > ...
> > +define PYTHON_PAHO_MQTT_INSTALL_TARGET_CMDS
> > +     (cd $(@D); \
> > +             $(HOST_PKG_PYTHON_SETUPTOOLS_ENV) \
> > +             $(HOST_DIR)/usr/bin/python2 setup.py install \
> > +             --root=/)
> > +endef
>
> Why do you need to override <pkg>_INSTALL_TARGET_CMDS ?
>
> Using $(HOST_PKG_PYTHON_SETUPTOOLS_ENV) for a target package looks
> clearly wrong. Also, since you're not passing
> --prefix=$(TARGET_DIR)/usr, I don't see how this overriden install
> target commands can even install something in $(TARGET_DIR).
>
> Could you clarify this?
>
>
The install stage of the package, fails with the following error (I
replaced the custom paths with "..."):

.../bin/python setup.py install --prefix=... --executable=/usr/bin/python
--single-version-externally-managed --root=/ )
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: option --executable not recognized

I narrowed this down to "--executable" and
"--single-version-externally-managed" not being supported by setup.py
I've looked at packages/pkg-python.mk and tried to fix it overriding
"PYTHON_PAHO_MQTT_BASE_INSTALL_TARGET_OPTS" and
"PYTHON_PAHO_MQTT_INSTALL_TARGET_OPTS" but it did not work, so I ended up
overriding the entire rule.
Never packaged a python module before, so thank you for assisting me in
this process

Davide
Yegor Yefremov Dec. 29, 2015, 10:45 p.m. UTC | #4
On Tue, Dec 29, 2015 at 11:37 PM, Davide Viti <zinosat@tiscali.it> wrote:
> Hi Thomas and Yegor,
>
> I've tried to rebuild the package using python3 and the build fails finding
> $(HOST_DIR)/usr/bin/python2
>
> I guess it's worth discussing the redefinition of
> PYTHON_PAHO_MQTT_INSTALL_TARGET_CMDS though, since it probably is the origin
> of the problems
>
>
> 2015-12-28 14:25 GMT+01:00 Thomas Petazzoni
> <thomas.petazzoni@free-electrons.com>:
>>
>>
>> On Mon, 28 Dec 2015 13:57:35 +0100, Davide Viti wrote:
>>
>> > ...
>> > +define PYTHON_PAHO_MQTT_INSTALL_TARGET_CMDS
>> > +     (cd $(@D); \
>> > +             $(HOST_PKG_PYTHON_SETUPTOOLS_ENV) \
>> > +             $(HOST_DIR)/usr/bin/python2 setup.py install \
>> > +             --root=/)
>> > +endef
>>
>> Why do you need to override <pkg>_INSTALL_TARGET_CMDS ?
>>
>> Using $(HOST_PKG_PYTHON_SETUPTOOLS_ENV) for a target package looks
>> clearly wrong. Also, since you're not passing
>> --prefix=$(TARGET_DIR)/usr, I don't see how this overriden install
>> target commands can even install something in $(TARGET_DIR).
>>
>> Could you clarify this?
>>
>
> The install stage of the package, fails with the following error (I replaced
> the custom paths with "..."):
>
> .../bin/python setup.py install --prefix=... --executable=/usr/bin/python
> --single-version-externally-managed --root=/ )
> usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
> or: setup.py --help [cmd1 cmd2 ...]
> or: setup.py --help-commands
> or: setup.py cmd --help
>
> error: option --executable not recognized
>
>
> I narrowed this down to "--executable" and
> "--single-version-externally-managed" not being supported by setup.py
> I've looked at packages/pkg-python.mk and tried to fix it overriding
> "PYTHON_PAHO_MQTT_BASE_INSTALL_TARGET_OPTS" and
> "PYTHON_PAHO_MQTT_INSTALL_TARGET_OPTS" but it did not work, so I ended up
> overriding the entire rule.
> Never packaged a python module before, so thank you for assisting me in this
> process

Just change PYTHON_PAHO_MQTT_SETUP_TYPE = setuptools

to

PYTHON_PAHO_MQTT_SETUP_TYPE = distutils

Yegor
Arnout Vandecappelle Dec. 30, 2015, 9:03 p.m. UTC | #5
On 28-12-15 14:25, Thomas Petazzoni wrote:
> On Mon, 28 Dec 2015 13:57:35 +0100, Davide Viti wrote:
> 
>> > diff --git a/package/python-paho-mqtt/Config.in b/package/python-paho-mqtt/Config.in
>> > new file mode 100644
>> > index 0000000..1b20da9
>> > --- /dev/null
>> > +++ b/package/python-paho-mqtt/Config.in
>> > @@ -0,0 +1,9 @@
>> > +config BR2_PACKAGE_PYTHON_PAHO_MQTT
>> > +	bool "python-paho-mqtt"
>> > +	help
>> > +	  The Paho Python Client provides a client class with support
>> > +	  for both MQTT v3.1 and v3.1.1 on Python 2.7 or 3.x. It also
>> > +	  provides some helper functions to make publishing one off
>> > +	  messages to an MQTT server very straightforward.
> I know it was copy/pasted from the website, but this last sentence
> doesn't make much sense to me. Maybe it's because I'm not a native
> speaker, but "publishing one off messages" is not something that I can
> parse. Did they mean "publishing on/off messages" ? Or something else ?
> 

 They mean "publishing one-off messages", which I guess translates to having a
simple function to publish a message without the need for setting up a
connection etc.

 Regards,
 Arnout
Steve Calfee Jan. 1, 2016, 5:17 p.m. UTC | #6
On Wed, Dec 30, 2015 at 1:03 PM, Arnout Vandecappelle <arnout@mind.be>
wrote:

> On 28-12-15 14:25, Thomas Petazzoni wrote:
> > On Mon, 28 Dec 2015 13:57:35 +0100, Davide Viti wrote:
> >
> >> > diff --git a/package/python-paho-mqtt/Config.in
> b/package/python-paho-mqtt/Config.in
> >> > new file mode 100644
> >> > index 0000000..1b20da9
> >> > --- /dev/null
> >> > +++ b/package/python-paho-mqtt/Config.in
> >> > @@ -0,0 +1,9 @@
> >> > +config BR2_PACKAGE_PYTHON_PAHO_MQTT
> >> > +  bool "python-paho-mqtt"
> >> > +  help
> >> > +    The Paho Python Client provides a client class with support
> >> > +    for both MQTT v3.1 and v3.1.1 on Python 2.7 or 3.x. It also
> >> > +    provides some helper functions to make publishing one off
> >> > +    messages to an MQTT server very straightforward.
> > I know it was copy/pasted from the website, but this last sentence
> > doesn't make much sense to me. Maybe it's because I'm not a native
> > speaker, but "publishing one off messages" is not something that I can
> > parse. Did they mean "publishing on/off messages" ? Or something else ?
> >
>
>  They mean "publishing one-off messages", which I guess translates to
> having a
> simple function to publish a message without the need for setting up a
> connection etc.
>
>  Regards,
>  Arnout
>
> ​
> one-off
> British informal
> *adjective*
> adjective: *one-off*
>
>    1. *1*.
>    done, made, or happening only once and not repeated.
>    "one-off tax deductible donations to charity"
>
> *noun*
> noun: *one-off*; plural noun: *one-offs*
>
>    1. *1*.
>    something done, made, or happening only once, not as part of a regular
>    sequence.
>    "the meeting is a one-off"
>    - a person who is unusual or unique, especially in an admirable way.
>       "he's a one-off, no one else has his skills"
>
> ​My interpretation: A hack or something done quick and dirty without
> setting up infrastructure etc.
>

​Regards, Steve​
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index dd44743..aab1958 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -659,6 +659,7 @@  menu "External python modules"
 	source "package/python-networkmanager/Config.in"
 	source "package/python-nfc/Config.in"
 	source "package/python-numpy/Config.in"
+	source "package/python-paho-mqtt/Config.in"
 	source "package/python-pam/Config.in"
 	source "package/python-posix-ipc/Config.in"
 	source "package/python-protobuf/Config.in"
diff --git a/package/python-paho-mqtt/Config.in b/package/python-paho-mqtt/Config.in
new file mode 100644
index 0000000..1b20da9
--- /dev/null
+++ b/package/python-paho-mqtt/Config.in
@@ -0,0 +1,9 @@ 
+config BR2_PACKAGE_PYTHON_PAHO_MQTT
+	bool "python-paho-mqtt"
+	help
+	  The Paho Python Client provides a client class with support
+	  for both MQTT v3.1 and v3.1.1 on Python 2.7 or 3.x. It also
+	  provides some helper functions to make publishing one off
+	  messages to an MQTT server very straightforward.
+
+	  https://pypi.python.org/pypi/paho-mqtt
diff --git a/package/python-paho-mqtt/python-paho-mqtt.hash b/package/python-paho-mqtt/python-paho-mqtt.hash
new file mode 100644
index 0000000..eb1dfb5
--- /dev/null
+++ b/package/python-paho-mqtt/python-paho-mqtt.hash
@@ -0,0 +1,2 @@ 
+# Locally computed:
+sha256  0f7a629efe6e3a2c61b59d3550aa9f2c4529b5689a65fde45e6f1ac36b9a261e  paho-mqtt-1.1.tar.gz
diff --git a/package/python-paho-mqtt/python-paho-mqtt.mk b/package/python-paho-mqtt/python-paho-mqtt.mk
new file mode 100644
index 0000000..f039835
--- /dev/null
+++ b/package/python-paho-mqtt/python-paho-mqtt.mk
@@ -0,0 +1,21 @@ 
+################################################################################
+#
+# python-paho-mqtt
+#
+################################################################################
+
+PYTHON_PAHO_MQTT_VERSION = 1.1
+PYTHON_PAHO_MQTT_SOURCE = paho-mqtt-$(PYTHON_PAHO_MQTT_VERSION).tar.gz
+PYTHON_PAHO_MQTT_SITE = https://pypi.python.org/packages/source/p/paho-mqtt
+PYTHON_PAHO_MQTT_LICENSE = EPLv1.0 or EDLv1.0
+PYTHON_PAHO_MQTT_LICENSE_FILES = LICENSE.txt edl-v10 epl-v10
+PYTHON_PAHO_MQTT_SETUP_TYPE = setuptools
+
+define PYTHON_PAHO_MQTT_INSTALL_TARGET_CMDS
+	(cd $(@D); \
+		$(HOST_PKG_PYTHON_SETUPTOOLS_ENV) \
+		$(HOST_DIR)/usr/bin/python2 setup.py install \
+		--root=/)
+endef
+
+$(eval $(python-package))