[oe] [meta-python][PATCH 1/5] pypi.bbclass: new class to ease writing pypi recipes

Andreas Oberritter obi at opendreambox.org
Thu Mar 26 18:43:27 UTC 2015


Signed-off-by: Andreas Oberritter <obi at opendreambox.org>
---
 meta-python/classes/pypi.bbclass | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 meta-python/classes/pypi.bbclass

diff --git a/meta-python/classes/pypi.bbclass b/meta-python/classes/pypi.bbclass
new file mode 100644
index 0000000..41a70e2
--- /dev/null
+++ b/meta-python/classes/pypi.bbclass
@@ -0,0 +1,21 @@
+def pypi_package(d):
+    bpn = d.getVar('BPN', True)
+    if bpn.startswith('python-'):
+        return bpn[7:]
+    return bpn
+
+PYPI_PACKAGE ?= "${@pypi_package(d)}"
+
+def pypi_src_uri(d):
+    package = d.getVar('PYPI_PACKAGE', True)
+    pv = d.getVar('PV', True)
+    return 'https://pypi.python.org/packages/source/%s/%s/%s-%s.tar.gz' % (package[0], package, package, pv)
+
+PYPI_SRC_URI ?= "${@pypi_src_uri(d)}"
+
+HOMEPAGE ?= "https://pypi.python.org/pypi/${PYPI_PACKAGE}/"
+SECTION = "devel/python"
+SRC_URI += "${PYPI_SRC_URI}"
+S = "${WORKDIR}/${PYPI_PACKAGE}-${PV}"
+
+inherit setuptools
-- 
1.9.1



More information about the Openembedded-devel mailing list