Skip to contentSkip to conversation

New package: python-dpkt

PATCH Superseded yegorslists at googlemail.com 3 participants 4 messages Dec 14, 2011

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 New package: python-dpkt

From: Yegor Yefremov <[email protected]>

---
 package/Config.in                  |    1 +
 package/python-dpkt/Config.in      |   11 +++++++++++
 package/python-dpkt/python-dpkt.mk |   29 +++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+), 0 deletions(-)
 create mode 100644 package/python-dpkt/Config.in
 create mode 100644 package/python-dpkt/python-dpkt.mk
package/Config.in +1 -0
index cca2b0a..e5c2cae 100644
@@ -239,6 +239,7 @@ source "package/python/Config.in"
 if BR2_PACKAGE_PYTHON
 menu "external python modules"
 source "package/multimedia/python-mad/Config.in"
+source "package/python-dpkt/Config.in"
 source "package/python-serial/Config.in"
 endmenu
 endif
package/python-dpkt/Config.in new file +11 -0
new file mode 100644
index 0000000..2d337dd
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_PYTHON_DPKT
+	bool "python-dpkt"
+	depends on BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_PYTHON_ZLIB
+	help
+	  Fast, simple packet creation / parsing, with definitions 
+	  for the basic TCP/IP protocols. 
+
+	  http://code.google.com/p/dpkt/ 
+
+
package/python-dpkt/python-dpkt.mk new file +29 -0
new file mode 100644
index 0000000..a76e8ca
@@ -0,0 +1,29 @@
+#############################################################
+#
+# python-dpkt
+#
+#############################################################
+
+PYTHON_DPKT_VERSION = 1.7
+PYTHON_DPKT_SOURCE  = dpkt-$(PYTHON_DPKT_VERSION).tar.gz
+PYTHON_DPKT_SITE    = http://dpkt.googlecode.com/files
+
+PYTHON_DPKT_DEPENDENCIES = python
+
+define PYTHON_DPKT_BUILD_CMDS
+	(cd $(@D); \
+		CC="$(TARGET_CC)"		\
+		CFLAGS="$(TARGET_CFLAGS)" 	\
+		LDSHARED="$(TARGET_CC) -shared" \
+		LDFLAGS="$(TARGET_LDFLAGS)" 	\
+	$(HOST_DIR)/usr/bin/python setup.py build_ext \
+	--include-dirs=$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR))
+	(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build)
+endef
+
+define PYTHON_DPKT_INSTALL_TARGET_CMDS
+	(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
+endef
+
+$(eval $(call GENTARGETS))
+
Signature · 1 line
1.7.1.1
#1 lore raw

PATCH 1/1 New package: python-dpkt

Quoted 13 lines
package/python-dpkt/python-dpkt.mk new file +13 -0
+PYTHON_DPKT_VERSION = 1.7
+PYTHON_DPKT_SOURCE  = dpkt-$(PYTHON_DPKT_VERSION).tar.gz
+PYTHON_DPKT_SITE    = http://dpkt.googlecode.com/files
+
+PYTHON_DPKT_DEPENDENCIES = python
+
+define PYTHON_DPKT_BUILD_CMDS
+	(cd $(@D); \
+		CC="$(TARGET_CC)"		\
+		CFLAGS="$(TARGET_CFLAGS)" 	\
+		LDSHARED="$(TARGET_CC) -shared" \
+		LDFLAGS="$(TARGET_LDFLAGS)" 	\
+	$(HOST_DIR)/usr/bin/python setup.py build_ext \

package/python-dpkt/python-dpkt.mk line 29

Quoted 10 lines
package/python-dpkt/python-dpkt.mk new file +10 -0
+	--include-dirs=$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR))
+	(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build)
+endef
+
+define PYTHON_DPKT_INSTALL_TARGET_CMDS
+	(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
+endef
+
+$(eval $(call GENTARGETS))
+

I have following problem building this package:

Traceback (most recent call last):
File "setup.py", line 4, in <module>
import dpkt
File "/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/build/python-dpkt-1.7/dpkt/__init__.py", line 26, in <module>
import gzip
File "/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/build/python-dpkt-1.7/dpkt/gzip.py", line 5, in <module>
import struct, zlib
ImportError: No module named zlib

zlib is selected as core python component. Nevertheless it cannot be found. At first I tried to mimic python-serial build script, than python-mad, but they both don't require zlib.

Any idea?

Yegor

#2 lore raw

PATCH 1/1 New package: python-dpkt

Le Wed, 14 Dec 2011 11:39:05 +0100,
Yegor Yefremov <[email protected]> a ?crit :

Quoted 11 lines

I have following problem building this package:

Traceback (most recent call last):
File "setup.py", line 4, in <module>
import dpkt
File
"/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/build/python-dpkt-1.7/dpkt/__init__.py", line 26, in <module> import gzip File "/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/build/python-dpkt-1.7/dpkt/gzip.py", line 5, in <module> import struct, zlib ImportError: No module named
zlib

At build time, the host-python is used. And the fact that you enabled "zlib" for the target python has no impact on the configuration of the host python. Why does it require zlib support in Python at build time? Or, said otherwise, why does it tries to import the dpkt Python module you're building, at build time?

Regards,

Thomas

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

PATCH 1/1 New package: python-dpkt

Am 14.12.2011 11:46, schrieb Thomas Petazzoni:

Quoted 14 lines

Le Wed, 14 Dec 2011 11:39:05 +0100,
Yegor Yefremov <[email protected]> a ?crit :

Quoted 11 lines

I have following problem building this package:

Traceback (most recent call last):
File "setup.py", line 4, in <module>
import dpkt
File
"/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/build/python-dpkt-1.7/dpkt/__init__.py", line 26, in <module> import gzip File "/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/build/python-dpkt-1.7/dpkt/gzip.py", line 5, in <module> import struct, zlib ImportError: No module named
zlib

Quoted 5 lines

At build time, the host-python is used. And the fact that you enabled "zlib" for the target python has no impact on the configuration of the host python. Why does it require zlib support in Python at build time? Or, said otherwise, why does it tries to import the dpkt Python module you're building, at build time?

This is a good question to maintainer of dpkt. I copied version, author and other stuff from dpkt/_init_.py to setup.py, commented import dpkt and could successfully install this package. Still haven't tested it. Because I need netifaces and this package needs setuptools :-(

Yegor