summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorPaul Barker <paul@pbarker.dev>2021-08-10 12:03:50 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-13 14:44:05 +0100
commita42896018396d685bbf81261cca20d9d0cfe9817 (patch)
tree8d30fa20278064c04508051457c478309b81edf8 /meta/classes
parentb3246ebd87a4d0b4934ff48c7ce874d0499711dc (diff)
downloadpoky-a42896018396d685bbf81261cca20d9d0cfe9817.tar.gz
pypi: Allow override of PyPI archive name
Some packages on PyPI don't follow the usual expectations for archive naming. For example, the archive for asyncio-mqtt 0.10.0 is named asyncio_mqtt-0.10.0.tar.gz (with an underscore instead of the dash used in the package name). To handle these edge cases a new PYPI_ARCHIVE_NAME variable is introduced. By default this is set to the expected archive name based on the PyPI package name, version and extension but it can be set to a different value if needed in a recipe which inherits the pypi class. (From OE-Core rev: 9659f5a51a2d094b45b52136feac4402d501b4f2) Signed-off-by: Paul Barker <paul@pbarker.dev> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/pypi.bbclass6
1 files changed, 3 insertions, 3 deletions
diff --git a/meta/classes/pypi.bbclass b/meta/classes/pypi.bbclass
index 272c220bca..9405d58601 100644
--- a/meta/classes/pypi.bbclass
+++ b/meta/classes/pypi.bbclass
@@ -8,12 +8,12 @@ def pypi_package(d):
8 8
9PYPI_PACKAGE ?= "${@pypi_package(d)}" 9PYPI_PACKAGE ?= "${@pypi_package(d)}"
10PYPI_PACKAGE_EXT ?= "tar.gz" 10PYPI_PACKAGE_EXT ?= "tar.gz"
11PYPI_ARCHIVE_NAME ?= "${PYPI_PACKAGE}-${PV}.${PYPI_PACKAGE_EXT}"
11 12
12def pypi_src_uri(d): 13def pypi_src_uri(d):
13 package = d.getVar('PYPI_PACKAGE') 14 package = d.getVar('PYPI_PACKAGE')
14 package_ext = d.getVar('PYPI_PACKAGE_EXT') 15 archive_name = d.getVar('PYPI_ARCHIVE_NAME')
15 pv = d.getVar('PV') 16 return 'https://files.pythonhosted.org/packages/source/%s/%s/%s' % (package[0], package, archive_name)
16 return 'https://files.pythonhosted.org/packages/source/%s/%s/%s-%s.%s' % (package[0], package, package, pv, package_ext)
17 17
18PYPI_SRC_URI ?= "${@pypi_src_uri(d)}" 18PYPI_SRC_URI ?= "${@pypi_src_uri(d)}"
19 19