Skip to contentSkip to conversation

python-protobuf: Add support for Python implementation of Google's Protocol Buffers

PATCH RESEND Superseded Thiago A. Correa 3 participants 4 messages Sep 17, 2012 – Oct 5, 2012

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 python-protobuf: Add support for Python implementation of Google's Protocol Buffers

---
 package/Config.in                          |    1 +
 package/python-protobuf/Config.in          |   11 +++++++++++
 package/python-protobuf/python-protobuf.mk |   28 ++++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 0 deletions(-)
 create mode 100644 package/python-protobuf/Config.in
 create mode 100644 package/python-protobuf/python-protobuf.mk
package/Config.in +1 -0
index e129522..3aff270 100644
@@ -276,6 +276,7 @@ source "package/python-mad/Config.in"
 source "package/python-meld3/Config.in"
 source "package/python-netifaces/Config.in"
 source "package/python-nfc/Config.in"
+source "package/python-protobuf/Config.in"
 source "package/python-pygame/Config.in"
 source "package/python-serial/Config.in"
 source "package/python-setuptools/Config.in"
package/python-protobuf/Config.in new file +11 -0
new file mode 100644
index 0000000..d2bf70d
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_PYTHON_PROTOBUF
+	bool "python-protobuf"
+	depends on BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_PYTHON_SETUPTOOLS
+	help
+	  Python implementation of the Google Protocol Buffers.
+
+	  Protocol buffers are Google's language-neutral, platform-neutral,
+	  extensible mechanism for serializing structured data.
+
+	  http://code.google.com/p/protobuf/
package/python-protobuf/python-protobuf.mk new file +28 -0
new file mode 100644
index 0000000..d632e00
@@ -0,0 +1,28 @@
+#############################################################
+#
+# python-protobuf
+#
+#############################################################
+
+PYTHON_PROTOBUF_VERSION = $(PROTOBUF_VERSION)
+PYTHON_PROTOBUF_SOURCE  = $(PROTOBUF_SOURCE)
+PYTHON_PROTOBUF_SITE    = $(PROTOBUF_SITE)
+PYTHON_PROTOBUF_LICENSE = BSD-3c
+PYTHON_PROTOBUF_LICENSE_FILES = COPYING.txt
+
+PYTHON_PROTOBUF_DEPENDENCIES = python host-python-setuptools host-python-distutilscross host-protobuf
+
+define PYTHON_PROTOBUF_BUILD_CMDS
+	(cd $(@D)/python; \
+		PYTHONXCPREFIX="$(STAGING_DIR)/usr/" \
+		LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \
+		PATH=$(HOST_PATH) \
+	$(HOST_DIR)/usr/bin/python setup.py build -x)
+endef
+
+define PYTHON_PROTOBUF_INSTALL_TARGET_CMDS
+	(cd $(@D)/python; PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages \
+	$(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH RESEND v2 1/1 python-protobuf: Add support for Python implementation of Google's Protocol Buffers

Dear Thiago A. Correa,

Quoted 27 lines · Thiago A. Correa
---
 package/Config.in                          |    1 +
 package/python-protobuf/Config.in          |   11 +++++++++++
 package/python-protobuf/python-protobuf.mk |   28 ++++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 0 deletions(-)
 create mode 100644 package/python-protobuf/Config.in
 create mode 100644 package/python-protobuf/python-protobuf.mk
package/Config.in +1 -0
index e129522..3aff270 100644
@@ -276,6 +276,7 @@ source "package/python-mad/Config.in"
 source "package/python-meld3/Config.in"
 source "package/python-netifaces/Config.in"
 source "package/python-nfc/Config.in"
+source "package/python-protobuf/Config.in"
 source "package/python-pygame/Config.in"
 source "package/python-serial/Config.in"
 source "package/python-setuptools/Config.in"
package/python-protobuf/Config.in new file +0 -0
new file mode 100644
index 0000000..d2bf70d

package/python-protobuf/Config.in line 4

Quoted 4 lines
package/python-protobuf/Config.in new file +4 -0
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_PYTHON_PROTOBUF
+	bool "python-protobuf"
+	depends on BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_PYTHON_SETUPTOOLS

Is this select really needed? python-setuptools for the target is not amongst the dependencies of your package. It seems you only need host-python-setuptools, in which case this select is not necessary.

Quoted 13 lines
package/python-protobuf/Config.in new file +7 -0
+	help
+	  Python implementation of the Google Protocol Buffers.
+
+	  Protocol buffers are Google's language-neutral, platform-neutral,
+	  extensible mechanism for serializing structured data.
+
+	  http://code.google.com/p/protobuf/
package/python-protobuf/python-protobuf.mk new file +0 -0
new file mode 100644
index 0000000..d632e00

package/python-protobuf/python-protobuf.mk line 9

Quoted 9 lines
package/python-protobuf/python-protobuf.mk new file +9 -0
@@ -0,0 +1,28 @@
+#############################################################
+#
+# python-protobuf
+#
+#############################################################
+
+PYTHON_PROTOBUF_VERSION = $(PROTOBUF_VERSION)
+PYTHON_PROTOBUF_SOURCE  = $(PROTOBUF_SOURCE)
+PYTHON_PROTOBUF_SITE    = $(PROTOBUF_SITE)

So the source tarball is the same? So what you're doing here in fact is having two separate Buildroot packages for the same source tarball, something that we generally don't do. But in this case, it seems like logical to do it this way.

What do others think about this strategy?

package/python-protobuf/python-protobuf.mk line 13

Quoted 4 lines
package/python-protobuf/python-protobuf.mk new file +4 -0
+PYTHON_PROTOBUF_LICENSE = BSD-3c
+PYTHON_PROTOBUF_LICENSE_FILES = COPYING.txt
+
+PYTHON_PROTOBUF_DEPENDENCIES = python host-python-setuptools host-python-distutilscross host-protobuf

Using \ to cut the line width would be nice.

package/python-protobuf/python-protobuf.mk line 18

Quoted 4 lines
package/python-protobuf/python-protobuf.mk new file +4 -0
+define PYTHON_PROTOBUF_BUILD_CMDS
+	(cd $(@D)/python; \
+		PYTHONXCPREFIX="$(STAGING_DIR)/usr/" \
+		LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \

And you sure those LDFLAGS are necessary? Our cross-compiler already has its sysroot set so that it finds libraries in the staging directory.

package/python-protobuf/python-protobuf.mk line 28

Quoted 10 lines
package/python-protobuf/python-protobuf.mk new file +10 -0
+		PATH=$(HOST_PATH) \
+	$(HOST_DIR)/usr/bin/python setup.py build -x)
+endef
+
+define PYTHON_PROTOBUF_INSTALL_TARGET_CMDS
+	(cd $(@D)/python; PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages \
+	$(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
+endef
+
+$(eval $(generic-package))

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH RESEND v2 1/1 python-protobuf: Add support for Python implementation of Google's Protocol Buffers

Quoted 10 lines · Thomas Petazzoni
Quoted 3 lines
Quoted 3 lines

+PYTHON_PROTOBUF_VERSION = $(PROTOBUF_VERSION)
+PYTHON_PROTOBUF_SOURCE = $(PROTOBUF_SOURCE)
+PYTHON_PROTOBUF_SITE = $(PROTOBUF_SITE)

So the source tarball is the same? So what you're doing here in fact is having two separate Buildroot packages for the same source tarball, something that we generally don't do. But in this case, it seems like logical to do it this way.

What do others think about this strategy?

It's a good start, but I still think we need more generic infrastructure
for this use case. For instance, this will fail if protobuf moves to a hg version, because then PROTOBUF_SOURCE is empty.

For the time being, it's OK, however.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH RESEND v2 1/1 python-protobuf: Add support for Python implementation of Google's Protocol Buffers

Hi,

Somehow I missed your replies. I will resubmit with the changes
suggested. Thanks.

Kind Regards,
Thiago A. Correa

Quoted 29 lines · Arnout Vandecappelle
Quoted 5 lines · Thomas Petazzoni
Quoted 4 lines
Quoted 4 lines

+PYTHON_PROTOBUF_VERSION = $(PROTOBUF_VERSION)
+PYTHON_PROTOBUF_SOURCE = $(PROTOBUF_SOURCE)
+PYTHON_PROTOBUF_SITE = $(PROTOBUF_SITE)

Quoted 7 lines

So the source tarball is the same? So what you're doing here in fact is having two separate Buildroot packages for the same source tarball, something that we generally don't do. But in this case, it seems like logical to do it this way.

What do others think about this strategy?

It's a good start, but I still think we need more generic infrastructure
for this use case. For instance, this will fail if protobuf moves to a hg version, because then PROTOBUF_SOURCE is empty.

For the time being, it's OK, however.

Regards,
Arnout
--

Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F