Don't bloat the SRC_URI by setting a redundant downloadprefix if it is
not required.

Signed-off-by: Ross Burton <[email protected]>
---
 meta/classes-recipe/pypi.bbclass | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

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):
     """"
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#245111): 
https://lists.openembedded.org/g/openembedded-core/message/245111
Mute This Topic: https://lists.openembedded.org/mt/121085954/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to