summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/pypi.bbclass
diff options
context:
space:
mode:
authorZoltan Boszormenyi <zboszor@gmail.com>2023-03-10 13:32:54 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-14 17:10:00 +0000
commit6690023f2848fc9bd407c9ce22b78c29270a16f0 (patch)
tree50a7bef850c52f7199dc09b762c01233e9eab2f3 /meta/classes-recipe/pypi.bbclass
parent31bdac666f1283f7b2b5f2a933d95d2f4f717790 (diff)
downloadpoky-6690023f2848fc9bd407c9ce22b78c29270a16f0.tar.gz
pypi.bbclass: Set SRC_URI downloadfilename with an optional prefix
This allows avoiding clashes between source archives of a main project and a pypi project using the same name and version. The new optional setting is PYPI_ARCHIVE_NAME_PREFIX which is empty by default so previous downloads can be used. Example usage: PYPI_ARCHIVE_NAME_PREFIX = "pypi-" (From OE-Core rev: 6f9a6a3dbe5c8eb9f0d19987410932fec3d6dd1a) Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/pypi.bbclass')
-rw-r--r--meta/classes-recipe/pypi.bbclass4
1 files changed, 3 insertions, 1 deletions
diff --git a/meta/classes-recipe/pypi.bbclass b/meta/classes-recipe/pypi.bbclass
index aab04c638f..f510bfed06 100644
--- a/meta/classes-recipe/pypi.bbclass
+++ b/meta/classes-recipe/pypi.bbclass
@@ -15,11 +15,13 @@ def pypi_package(d):
15PYPI_PACKAGE ?= "${@pypi_package(d)}" 15PYPI_PACKAGE ?= "${@pypi_package(d)}"
16PYPI_PACKAGE_EXT ?= "tar.gz" 16PYPI_PACKAGE_EXT ?= "tar.gz"
17PYPI_ARCHIVE_NAME ?= "${PYPI_PACKAGE}-${PV}.${PYPI_PACKAGE_EXT}" 17PYPI_ARCHIVE_NAME ?= "${PYPI_PACKAGE}-${PV}.${PYPI_PACKAGE_EXT}"
18PYPI_ARCHIVE_NAME_PREFIX ?= ""
18 19
19def pypi_src_uri(d): 20def pypi_src_uri(d):
20 package = d.getVar('PYPI_PACKAGE') 21 package = d.getVar('PYPI_PACKAGE')
21 archive_name = d.getVar('PYPI_ARCHIVE_NAME') 22 archive_name = d.getVar('PYPI_ARCHIVE_NAME')
22 return 'https://files.pythonhosted.org/packages/source/%s/%s/%s' % (package[0], package, archive_name) 23 archive_downloadname = d.getVar('PYPI_ARCHIVE_NAME_PREFIX') + archive_name
24 return 'https://files.pythonhosted.org/packages/source/%s/%s/%s;downloadfilename=%s' % (package[0], package, archive_name, archive_downloadname)
23 25
24PYPI_SRC_URI ?= "${@pypi_src_uri(d)}" 26PYPI_SRC_URI ?= "${@pypi_src_uri(d)}"
25 27