Browse Source

python-nfc: new package

[thomas.petazzoni@free-electrons.com:
   add patch that creates a standard setup.py file. This allows the
   .pyc files to be generated at build time, and installed into the
   target. This is important because by default, Buildroot removes all
   .py files from the target, to keep only the .pyc files. The
   python-nfc.mk file was changed to use this setup.py standard build
   process.]

Signed-off-by: Simon Dawson <spdawson@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Simon Dawson 13 years ago
parent
commit
45166f30dc

+ 1 - 0
package/Config.in

@@ -269,6 +269,7 @@ source "package/python-dpkt/Config.in"
 source "package/python-id3/Config.in"
 source "package/python-mad/Config.in"
 source "package/python-netifaces/Config.in"
+source "package/python-nfc/Config.in"
 source "package/python-pygame/Config.in"
 source "package/python-serial/Config.in"
 source "package/python-setuptools/Config.in"

+ 9 - 0
package/python-nfc/Config.in

@@ -0,0 +1,9 @@
+config BR2_PACKAGE_PYTHON_NFC
+	bool "python-nfc"
+	depends on BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_LIBUSB
+	select BR2_PACKAGE_LIBUSB_COMPAT
+	help
+	  Python module for near field communication.
+
+	  https://launchpad.net/nfcpy

+ 26 - 0
package/python-nfc/python-nfc-add-setup-py.patch

@@ -0,0 +1,26 @@
+Add simple setup.py
+
+Having a setup.py allows to easily get the .py files compiled into
+.pyc, which is good because by default, Buildroot only keeps .pyc
+files on the target.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+Index: b/setup.py
+===================================================================
+--- /dev/null
++++ b/setup.py
+@@ -0,0 +1,13 @@
++#!/usr/bin/env python
++
++from distutils.core import setup
++
++setup(name='NFC',
++      version='1.0',
++      description='Python NFC',
++      author='Stephen Tiedemann',
++      author_email='stephen.tiedemann@googlemail.com',
++      url='https://launchpad.net/nfcpy',
++      packages=['nfc', 'nfc/dev', 'nfc/llcp', 'nfc/ndef',
++                'nfc/npp', 'nfc/snep'],
++      )

+ 23 - 0
package/python-nfc/python-nfc.mk

@@ -0,0 +1,23 @@
+#############################################################
+#
+# python-nfc
+#
+#############################################################
+PYTHON_NFC_VERSION = 112
+PYTHON_NFC_SITE = https://launchpad.net/nfcpy
+PYTHON_NFC_SITE_METHOD = bzr
+PYTHON_NFC_DEPENDENCIES = python libusb libusb-compat
+
+define PYTHON_NFC_BUILD_CMDS
+	(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build)
+endef
+
+define PYTHON_NFC_INSTALL_TARGET_CMDS
+	(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
+endef
+
+define PYTHON_NFC_UNINSTALL_TARGET_CMDS
+	$(RM) -r $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages/nfc/
+endef
+
+$(eval $(generic-package))