diff mbox series

[2/4] classes/pypi: only set downloadprefix in SRC_URI if needed

Message ID 20260904133610.774110-2-ross.burton@arm.com
State Accepted, archived
Commit be391d8a8b7d4898063ceae1fbd707bfd2218be3
Headers show
Series [1/4] python/*: remove spurious CLEANBROKENs | expand

Commit Message

Ross Burton Sept. 4, 2026, 1:36 p.m. UTC
Don't bloat the SRC_URI by setting a redundant downloadprefix if it is
not required.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes-recipe/pypi.bbclass | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/pypi.bbclass b/meta/classes-recipe/pypi.bbclass
index 0897994bb65..b42b171e151 100644
--- a/meta/classes-recipe/pypi.bbclass
+++ b/meta/classes-recipe/pypi.bbclass
@@ -25,8 +25,13 @@  def pypi_src_uri(d):
     """
     package = d.getVar('PYPI_PACKAGE')
     archive_name = d.expand('${PYPI_PACKAGE}-${PV}.${PYPI_PACKAGE_EXT}')
-    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)
+    url = 'https://files.pythonhosted.org/packages/source/%s/%s/%s' % (package[0], package, archive_name)
+
+    download_prefix = d.getVar("PYPI_ARCHIVE_NAME_PREFIX")
+    if download_prefix:
+        url += ";downloadfilename=" + download_prefix + archive_name
+
+    return url
 
 def pypi_normalize(d):
     """"