1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-07 16:59:22 +00:00

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>
This commit is contained in:
Zoltan Boszormenyi
2023-03-10 13:32:54 +01:00
committed by Richard Purdie
parent 31bdac666f
commit 6690023f28
+3 -1
View File
@@ -15,11 +15,13 @@ def pypi_package(d):
PYPI_PACKAGE ?= "${@pypi_package(d)}"
PYPI_PACKAGE_EXT ?= "tar.gz"
PYPI_ARCHIVE_NAME ?= "${PYPI_PACKAGE}-${PV}.${PYPI_PACKAGE_EXT}"
PYPI_ARCHIVE_NAME_PREFIX ?= ""
def pypi_src_uri(d):
package = d.getVar('PYPI_PACKAGE')
archive_name = d.getVar('PYPI_ARCHIVE_NAME')
return 'https://files.pythonhosted.org/packages/source/%s/%s/%s' % (package[0], package, archive_name)
archive_downloadname = d.getVar('PYPI_ARCHIVE_NAME_PREFIX') + archive_name
return 'https://files.pythonhosted.org/packages/source/%s/%s/%s;downloadfilename=%s' % (package[0], package, archive_name, archive_downloadname)
PYPI_SRC_URI ?= "${@pypi_src_uri(d)}"