Skip to contentSkip to conversation

Python related changes

PATCH Superseded yegorslists at googlemail.com 3 participants 10 messages Dec 22, 2011 – Dec 23, 2011

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Python related changes

1. add infrastructure to external python packages
2. enable zlib support for host-python due to setuptools and others dependencies
3. add some external packages

FIXME: python-netifaces crosscompilation. I'll comment later on the patch.

ChangeLog: integrate all patches in one serie. Remove dpkt patch as zlib is enabled by default

#1 lore raw

PATCH v4 1/5 Python: add external modules option

From: Yegor Yefremov <[email protected]>

all external python packages/libraries should reside in "external python modules" section.

Move existing modules python-serial and python-mad there

Move python-mad from package/multimedia to package

---
 package/Config.in                           |    7 ++++-
 package/multimedia/Config.in                |    1 -
 package/multimedia/python-mad/Config.in     |    9 ------
 package/multimedia/python-mad/python-mad.mk |   41 ---------------------------
 package/python-mad/Config.in                |    9 ++++++
 package/python-mad/python-mad.mk            |   41 +++++++++++++++++++++++++++
 6 files changed, 56 insertions(+), 52 deletions(-)
 delete mode 100644 package/multimedia/python-mad/Config.in
 delete mode 100644 package/multimedia/python-mad/python-mad.mk
 create mode 100644 package/python-mad/Config.in
 create mode 100644 package/python-mad/python-mad.mk
package/Config.in +6 -1
index eb93b1c..6ab893f 100644
@@ -236,6 +236,12 @@ endif
 source "package/microperl/Config.in"
 source "package/php/Config.in"
 source "package/python/Config.in"
+if BR2_PACKAGE_PYTHON
+menu "external python modules"
+source "package/python-mad/Config.in"
+source "package/python-serial/Config.in"
+endmenu
+endif
 source "package/ruby/Config.in"
 source "package/tcl/Config.in"
 endmenu
@@ -312,7 +318,6 @@ source "package/libhid/Config.in"
 source "package/libiqrf/Config.in"
 source "package/libusb/Config.in"
 source "package/libusb-compat/Config.in"
-source "package/python-serial/Config.in"
 endmenu
 
 if BROKEN
package/multimedia/Config.in +0 -1
index d50e4fc..a05d1d9 100644
@@ -40,7 +40,6 @@ source "package/multimedia/mplayer/Config.in"
 source "package/multimedia/musepack/Config.in"
 source "package/multimedia/portaudio/Config.in"
 source "package/multimedia/pulseaudio/Config.in"
-source "package/multimedia/python-mad/Config.in"
 source "package/multimedia/speex/Config.in"
 source "package/multimedia/tidsp-binaries/Config.in"
 source "package/multimedia/taglib/Config.in"
package/multimedia/python-mad/Config.in deleted +0 -9
deleted file mode 100644
index 2535421..0000000
@@ -1,9 +0,0 @@
-config BR2_PACKAGE_PYTHON_MAD
-	bool "python-mad"
-	depends on BR2_PACKAGE_PYTHON
-	select BR2_PACKAGE_LIBMAD
-	help
-	  python-mad is a Python binding for the MAD library, a
-	  high-quality integer-only MPEG decoder.
-
-	  http://spacepants.org/src/pymad/
package/multimedia/python-mad/python-mad.mk deleted +0 -41

41 lines not on this page · raw message

package/python-mad/Config.in new file +9 -0
new file mode 100644
index 0000000..2535421
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_PYTHON_MAD
+	bool "python-mad"
+	depends on BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_LIBMAD
+	help
+	  python-mad is a Python binding for the MAD library, a
+	  high-quality integer-only MPEG decoder.
+
+	  http://spacepants.org/src/pymad/
package/python-mad/python-mad.mk new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
1.7.1.1
#2 lore raw

PATCH v4 2/5 Python: enable zlib support for the host package

In reply to yegorslists at googlemail.com

From: Yegor Yefremov <[email protected]>

zlib is needed for the host-setuptools package

---
 package/python/python.mk |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
package/python/python.mk +1 -2
index 9ef2ccc..78895d4 100644
@@ -28,7 +28,6 @@ HOST_PYTHON_CONF_OPT += 	\
 	--disable-bsddb		\
 	--disable-test-modules	\
 	--disable-bz2		\
-	--disable-zlib		\
 	--disable-ssl
 
 HOST_PYTHON_MAKE_ENV = \
@@ -52,7 +51,7 @@ endef
 
 PYTHON_DEPENDENCIES  = host-python libffi
 
-HOST_PYTHON_DEPENDENCIES = host-expat
+HOST_PYTHON_DEPENDENCIES = host-expat host-zlib
 
 PYTHON_INSTALL_STAGING = YES
 
Signature · 1 line
1.7.1.1
#3 lore raw

PATCH v4 3/5 New package: python-dpkt

In reply to yegorslists at googlemail.com

From: Yegor Yefremov <[email protected]>

---
 package/Config.in                  |    1 +
 package/python-dpkt/Config.in      |   11 +++++++++++
 package/python-dpkt/python-dpkt.mk |   22 ++++++++++++++++++++++
 3 files changed, 34 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 6ab893f..bb5e5b0 100644
@@ -238,6 +238,7 @@ source "package/php/Config.in"
 source "package/python/Config.in"
 if BR2_PACKAGE_PYTHON
 menu "external python modules"
+source "package/python-dpkt/Config.in"
 source "package/python-mad/Config.in"
 source "package/python-serial/Config.in"
 endmenu
package/python-dpkt/Config.in new file +11 -0
new file mode 100644
index 0000000..aac9f09
@@ -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 +22 -0
new file mode 100644
index 0000000..7ac873c
@@ -0,0 +1,22 @@
+#############################################################
+#
+# 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); $(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
#4 lore raw

PATCH v4 4/5 New package: python-setuptools

In reply to yegorslists at googlemail.com

From: Yegor Yefremov <[email protected]>

---
 package/Config.in                              |    1 +
 package/python-setuptools/Config.in            |    8 ++++++
 package/python-setuptools/python-setuptools.mk |   28 ++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 0 deletions(-)
 create mode 100644 package/python-setuptools/Config.in
 create mode 100644 package/python-setuptools/python-setuptools.mk
package/Config.in +1 -0
index bb5e5b0..71e1889 100644
@@ -241,6 +241,7 @@ menu "external python modules"
 source "package/python-dpkt/Config.in"
 source "package/python-mad/Config.in"
 source "package/python-serial/Config.in"
+source "package/python-setuptools/Config.in"
 endmenu
 endif
 source "package/ruby/Config.in"
package/python-setuptools/Config.in new file +8 -0
new file mode 100644
index 0000000..63c2b01
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_PYTHON_SETUPTOOLS
+	bool "python-setuptools"
+	depends on BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_PYTHON_ZLIB
+	help
+	  Download, build, install, upgrade, and uninstall Python packages.
+
+	  http://pypi.python.org/pypi/setuptools
package/python-setuptools/python-setuptools.mk new file +28 -0
new file mode 100644
index 0000000..1bcd628
@@ -0,0 +1,28 @@
+#############################################################
+#
+# python-setuptools
+#
+#############################################################
+
+PYTHON_SETUPTOOLS_VERSION = 0.6c11
+PYTHON_SETUPTOOLS_SOURCE  = setuptools-$(PYTHON_SETUPTOOLS_VERSION).tar.gz
+PYTHON_SETUPTOOLS_SITE    = http://pypi.python.org/packages/source/s/setuptools
+PYTHON_SETUPTOOLS_DEPENDENCIES = host-python
+
+define HOST_PYTHON_SETUPTOOLS_BUILD_CMDS
+	(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build)
+endef
+
+define HOST_PYTHON_SETUPTOOLS_INSTALL_CMDS
+	(cd $(@D); PYTHONPATH="$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages"\
+	$(HOST_DIR)/usr/bin/python setup.py install --prefix=$(HOST_DIR)/usr)
+endef
+
+define PYTHON_SETUPTOOLS_INSTALL_TARGET_CMDS
+	(cd $(@D); 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 $(call GENTARGETS))
+$(eval $(call GENTARGETS,host))
+
Signature · 1 line
1.7.1.1
#5 lore raw

PATCH v4 4/5 New package: python-setuptools

Le Thu, 22 Dec 2011 13:08:34 +0100,
yegorslists at googlemail.com a ?crit :

Quoted 1 line

+PYTHON_SETUPTOOLS_DEPENDENCIES = host-python

Shouldn't this be:

PYTHON_SETUPTOOLS_DEPENDENCIES = python

HOST_PYTHON_SETUPTOOLS_DEPENDENCIES = host-python

package/python-setuptools/python-setuptools.mk line 24

Quoted 13 lines
package/python-setuptools/python-setuptools.mk new file +13 -0
+define HOST_PYTHON_SETUPTOOLS_BUILD_CMDS
+	(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build)
+endef
+
+define HOST_PYTHON_SETUPTOOLS_INSTALL_CMDS
+	(cd $(@D); PYTHONPATH="$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages"\
+	$(HOST_DIR)/usr/bin/python setup.py install --prefix=$(HOST_DIR)/usr)
+endef
+
+define PYTHON_SETUPTOOLS_INSTALL_TARGET_CMDS
+	(cd $(@D); PYTHONPATH="$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages"\
+	$(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
+endef

You have build/install for the host case, but only install for the target case. Does it really work?

Thomas

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

PATCH v4 4/5 New package: python-setuptools

Quoted 10 lines · Thomas Petazzoni

Le Thu, 22 Dec 2011 13:08:34 +0100,
yegorslists at googlemail.com a ?crit :

Quoted 1 line

+PYTHON_SETUPTOOLS_DEPENDENCIES = host-python

Shouldn't this be:

PYTHON_SETUPTOOLS_DEPENDENCIES = python

HOST_PYTHON_SETUPTOOLS_DEPENDENCIES = host-python

ACK

Quoted 8 lines
Quoted 8 lines
package/python-setuptools/python-setuptools.mk new file +8 -0
+define HOST_PYTHON_SETUPTOOLS_BUILD_CMDS
+ ? ? (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build)
+endef
+
+define HOST_PYTHON_SETUPTOOLS_INSTALL_CMDS
+ ? ? (cd $(@D); PYTHONPATH="$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages"\
+ ? ? $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(HOST_DIR)/usr)
+endef
Quoted 8 lines

package/python-setuptools/python-setuptools.mk line 24

Quoted 5 lines
package/python-setuptools/python-setuptools.mk new file +5 -0
+
+define PYTHON_SETUPTOOLS_INSTALL_TARGET_CMDS
+ ? ? (cd $(@D); PYTHONPATH="$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages"\
+ ? ? $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
+endef

You have build/install for the host case, but only install for the target case. Does it really work?

I don't get any errors and I can see setuptools files in both host and target site-packages folder. But I've added build commands for target now.

Yegor

#7 lore raw

PATCH v4 5/5 New package: python-netifaces

In reply to yegorslists at googlemail.com

From: Yegor Yefremov <[email protected]>

---
 package/Config.in                            |    1 +
 package/python-netifaces/Config.in           |    9 +++++++++
 package/python-netifaces/python-netifaces.mk |   26 ++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 package/python-netifaces/Config.in
 create mode 100644 package/python-netifaces/python-netifaces.mk
package/Config.in +1 -0
index 71e1889..666a224 100644
@@ -240,6 +240,7 @@ if BR2_PACKAGE_PYTHON
 menu "external python modules"
 source "package/python-dpkt/Config.in"
 source "package/python-mad/Config.in"
+source "package/python-netifaces/Config.in"
 source "package/python-serial/Config.in"
 source "package/python-setuptools/Config.in"
 endmenu
package/python-netifaces/Config.in new file +9 -0
new file mode 100644
index 0000000..199191c
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_PYTHON_NETIFACES
+	bool "python-netifaces"
+	depends on BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_PYTHON_SETUPTOOLS
+	help
+	  Portable access to network interfaces from Python.
+
+	  http://alastairs-place.net/projects/netifaces
+
package/python-netifaces/python-netifaces.mk new file +26 -0
new file mode 100644
index 0000000..9a626ef
@@ -0,0 +1,26 @@
+#############################################################
+#
+# python-netifaces
+#
+#############################################################
+
+PYTHON_NETIFACES_VERSION = 0.6
+PYTHON_NETIFACES_SOURCE  = netifaces-$(PYTHON_NETIFACES_VERSION).tar.gz
+PYTHON_NETIFACES_SITE    = http://alastairs-place.net/projects/netifaces
+
+PYTHON_NETIFACES_DEPENDENCIES = python host-python-setuptools
+
+define PYTHON_NETIFACES_BUILD_CMDS
+	(cd $(@D); \
+		CC="$(TARGET_CC)"		\
+	$(HOST_DIR)/usr/bin/python setup.py build)
+endef
+
+define PYTHON_NETIFACES_INSTALL_TARGET_CMDS
+	(cd $(@D); 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 $(call GENTARGETS))
+
Signature · 1 line
1.7.1.1
#8 lore raw

PATCH v4 5/5 New package: python-netifaces

Am 22.12.2011 13:08, schrieb yegorslists at googlemail.com:

Quoted 60 lines

From: Yegor Yefremov <[email protected]>

---
 package/Config.in                            |    1 +
 package/python-netifaces/Config.in           |    9 +++++++++
 package/python-netifaces/python-netifaces.mk |   26 ++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 package/python-netifaces/Config.in
 create mode 100644 package/python-netifaces/python-netifaces.mk
package/Config.in +1 -0
index 71e1889..666a224 100644
@@ -240,6 +240,7 @@ if BR2_PACKAGE_PYTHON
 menu "external python modules"
 source "package/python-dpkt/Config.in"
 source "package/python-mad/Config.in"
+source "package/python-netifaces/Config.in"
 source "package/python-serial/Config.in"
 source "package/python-setuptools/Config.in"
 endmenu
package/python-netifaces/Config.in new file +9 -0
new file mode 100644
index 0000000..199191c
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_PYTHON_NETIFACES
+	bool "python-netifaces"
+	depends on BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_PYTHON_SETUPTOOLS
+	help
+	  Portable access to network interfaces from Python.
+
+	  http://alastairs-place.net/projects/netifaces
+
package/python-netifaces/python-netifaces.mk new file +16 -0
new file mode 100644
index 0000000..9a626ef
@@ -0,0 +1,26 @@
+#############################################################
+#
+# python-netifaces
+#
+#############################################################
+
+PYTHON_NETIFACES_VERSION = 0.6
+PYTHON_NETIFACES_SOURCE  = netifaces-$(PYTHON_NETIFACES_VERSION).tar.gz
+PYTHON_NETIFACES_SITE    = http://alastairs-place.net/projects/netifaces
+
+PYTHON_NETIFACES_DEPENDENCIES = python host-python-setuptools
+
+define PYTHON_NETIFACES_BUILD_CMDS
+	(cd $(@D); \
+		CC="$(TARGET_CC)"		\
+	$(HOST_DIR)/usr/bin/python setup.py build)

package/python-netifaces/python-netifaces.mk line 26

Quoted 10 lines
package/python-netifaces/python-netifaces.mk new file +10 -0
+endef
+
+define PYTHON_NETIFACES_INSTALL_TARGET_CMDS
+	(cd $(@D); 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 $(call GENTARGETS))
+

This is what I get:

Quoted 1 line
Quoted 1 line
Quoted 1 line

python-netifaces 0.6 Building

(cd /home/YegorYefremov/projects/versioned/tests/br-queue-python/output/build/python-netifaces-0.6; CC="/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/usr/bin/arm-none-linux-gnueabi-gcc" /home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/usr/bin/python setup.py build)
running build
running build_ext
checking for getifaddrs... not found. (cached)
checking for getnameinfo... not found. (cached)
checking for socket IOCTLs... not found. (cached)
checking for optional header files... netash/ash.h netatalk/at.h netax25/ax25.h neteconet/ec.h netipx/ipx.h netpacket/packet.h linux/irda.h linux/atm.h linux/llc.h linux/tipc.h linux/dn.h. (cached)
checking whether struct sockaddr has a length field... no. (cached)
checking which sockaddr_xxx structs are defined... at ax25 in in6 ipx un ash ec ll atmpvc atmsvc dn irda llc. (cached)
building 'netifaces' extension
/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/usr/bin/arm-none-linux-gnueabi-gcc -fno-strict-aliasing -O2 -I/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/include -I/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/usr/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_NETASH_ASH_H=1 -DHAVE_NETATALK_AT_H=1 -DHAVE_NETAX25_AX25_H=1 -DHAVE_NETECONET_EC_H=1 -DHAVE_NETIPX_IPX_H=1 -DHAVE_NETPACKET_PACKET_H=1 -DHAVE_LINUX_IRDA_H=1 -DHAVE_LINUX_ATM_H=1 -DHAVE_LINUX_LLC_H=1 -DHAVE_LINUX_TIPC_H=1 -DHAVE_LINUX_DN_H=1 -DHAVE_SOCKADDR_AT=1 -DHAVE_SOCKADDR_AX25=1 -DHAVE_SOCKADDR_IN=1 -DHAVE_SOCKADDR_IN6=1 -DHAVE_SOCKADDR_IPX=1 -DHAVE_SOCKADDR_UN=1 -DHAVE_SOCKADDR_ASH=1 -DHAVE_SOCKADDR_EC=1 -DHAVE_SOCKADDR_LL=1 -DHAVE_SOCKADDR_ATMPVC=1 -DHAVE_SOCKADDR_ATMSVC=1 -DHAVE_SOCKADDR_DN=1 -DHAVE_SOCKADDR_IRDA=1 -DHAVE_SOCKADDR_LLC=1 -I/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/h ost/usr/include/python2.7 -c netifaces.c -o build/temp.linux-x86_64-2.7/netifaces.o
In file included from /home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/usr/include/python2.7/Python.h:58:0,
from netifaces.c:1:
/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/usr/include/python2.7/pyport.h:849:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
netifaces.c:143:6: error: #error You need to add code for your platform.
netifaces.c:268:1: warning: 'string_from_sockaddr' defined but not used
netifaces.c:360:1: warning: 'add_to_family' defined but not used
error: command '/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/usr/bin/arm-none-linux-gnueabi-gcc' failed with exit status 1

Even if I cheat and let the test for getifaddrs etc. be successful and netifaces.c gets cross-compiled, the process failed as setup.py tries to create a library and uses gcc instead of cross-compiler. Any ideas?

Yegor

#9 lore raw

PATCH v4 5/5 New package: python-netifaces

Am 22.12.2011 13:13, schrieb Yegor Yefremov:

Quoted 75 lines

Am 22.12.2011 13:08, schrieb yegorslists at googlemail.com:

Quoted 60 lines

From: Yegor Yefremov <[email protected]>

---
 package/Config.in                            |    1 +
 package/python-netifaces/Config.in           |    9 +++++++++
 package/python-netifaces/python-netifaces.mk |   26 ++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 package/python-netifaces/Config.in
 create mode 100644 package/python-netifaces/python-netifaces.mk
package/Config.in +1 -0
index 71e1889..666a224 100644
@@ -240,6 +240,7 @@ if BR2_PACKAGE_PYTHON
 menu "external python modules"
 source "package/python-dpkt/Config.in"
 source "package/python-mad/Config.in"
+source "package/python-netifaces/Config.in"
 source "package/python-serial/Config.in"
 source "package/python-setuptools/Config.in"
 endmenu
package/python-netifaces/Config.in new file +9 -0
new file mode 100644
index 0000000..199191c
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_PYTHON_NETIFACES
+	bool "python-netifaces"
+	depends on BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_PYTHON_SETUPTOOLS
+	help
+	  Portable access to network interfaces from Python.
+
+	  http://alastairs-place.net/projects/netifaces
+
package/python-netifaces/python-netifaces.mk new file +16 -0
new file mode 100644
index 0000000..9a626ef
@@ -0,0 +1,26 @@
+#############################################################
+#
+# python-netifaces
+#
+#############################################################
+
+PYTHON_NETIFACES_VERSION = 0.6
+PYTHON_NETIFACES_SOURCE  = netifaces-$(PYTHON_NETIFACES_VERSION).tar.gz
+PYTHON_NETIFACES_SITE    = http://alastairs-place.net/projects/netifaces
+
+PYTHON_NETIFACES_DEPENDENCIES = python host-python-setuptools
+
+define PYTHON_NETIFACES_BUILD_CMDS
+	(cd $(@D); \
+		CC="$(TARGET_CC)"		\
+	$(HOST_DIR)/usr/bin/python setup.py build)

package/python-netifaces/python-netifaces.mk line 26

Quoted 10 lines
package/python-netifaces/python-netifaces.mk new file +10 -0
+endef
+
+define PYTHON_NETIFACES_INSTALL_TARGET_CMDS
+	(cd $(@D); 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 $(call GENTARGETS))
+

This is what I get:

Quoted 1 line
Quoted 1 line
Quoted 1 line

python-netifaces 0.6 Building

Quoted 11 lines

(cd /home/YegorYefremov/projects/versioned/tests/br-queue-python/output/build/python-netifaces-0.6; CC="/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/usr/bin/arm-none-linux-gnueabi-gcc" /home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/usr/bin/python setup.py build)
running build
running build_ext
checking for getifaddrs... not found. (cached)
checking for getnameinfo... not found. (cached)
checking for socket IOCTLs... not found. (cached)
checking for optional header files... netash/ash.h netatalk/at.h netax25/ax25.h neteconet/ec.h netipx/ipx.h netpacket/packet.h linux/irda.h linux/atm.h linux/llc.h linux/tipc.h linux/dn.h. (cached)
checking whether struct sockaddr has a length field... no. (cached)
checking which sockaddr_xxx structs are defined... at ax25 in in6 ipx un ash ec ll atmpvc atmsvc dn irda llc. (cached)
building 'netifaces' extension
/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/usr/bin/arm-none-linux-gnueabi-gcc -fno-strict-aliasing -O2 -I/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/include -I/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/usr/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_NETASH_ASH_H=1 -DHAVE_NETATALK_AT_H=1 -DHAVE_NETAX25_AX25_H=1 -DHAVE_NETECONET_EC_H=1 -DHAVE_NETIPX_IPX_H=1 -DHAVE_NETPACKET_PACKET_H=1 -DHAVE_LINUX_IRDA_H=1 -DHAVE_LINUX_ATM_H=1 -DHAVE_LINUX_LLC_H=1 -DHAVE_LINUX_TIPC_H=1 -DHAVE_LINUX_DN_H=1 -DHAVE_SOCKADDR_AT=1 -DHAVE_SOCKADDR_AX25=1 -DHAVE_SOCKADDR_IN=1 -DHAVE_SOCKADDR_IN6=1 -DHAVE_SOCKADDR_IPX=1 -DHAVE_SOCKADDR_UN=1 -DHAVE_SOCKADDR_ASH=1 -DHAVE_SOCKADDR_EC=1 -DHAVE_SOCKADDR_LL=1 -DHAVE_SOCKADDR_ATMPVC=1 -DHAVE_SOCKADDR_ATMSVC=1 -DHAVE_SOCKADDR_DN=1 -DHAVE_SOCKADDR_IRDA=1 -DHAVE_SOCKADDR_LLC=1 -I/home/YegorYefremov/projects/versioned/tests/br-queue-python/output

/h

Quoted 10 lines

ost/usr/include/python2.7 -c netifaces.c -o build/temp.linux-x86_64-2.7/netifaces.o
In file included from /home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/usr/include/python2.7/Python.h:58:0,
from netifaces.c:1:
/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/usr/include/python2.7/pyport.h:849:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." netifaces.c:143:6: error: #error You need to add code for your platform.
netifaces.c:268:1: warning: 'string_from_sockaddr' defined but not used
netifaces.c:360:1: warning: 'add_to_family' defined but not used
error: command '/home/YegorYefremov/projects/versioned/tests/br-queue-python/output/host/usr/bin/arm-none-linux-gnueabi-gcc' failed with exit status 1

Even if I cheat and let the test for getifaddrs etc. be successful and netifaces.c gets cross-compiled, the process failed as setup.py tries to create a library and uses gcc instead of cross-compiler. Any ideas?

Have found some resources, but still don't really understand, how to use it in BR:

http://whatschrisdoing.com/blog/2009/10/16/cross-compiling-python-extensions/
http://pypi.python.org/pypi/distutilscross

I've installed distutilscross and exported the needed environment variables, but setup.py still doesn't take specified crosscompiler while checking for headers (renamed output/host/usr/bin/arm-none-linux-gnueabi-gcc and setup.py didn't complain). Another thing that I don't really understand, how should distutilscross help if I don't include this package?

Yegor