Message ID | 20230310123254.2744497-1-zboszor@gmail.com |
---|---|
State | Accepted, archived |
Commit | 6f9a6a3dbe5c8eb9f0d19987410932fec3d6dd1a |
Headers | show |
Series | pypi.bbclass: Set SRC_URI downloadfilename with an optional prefix | expand |
Thanks, I like this better than changing the cmake recipe. Alex On Fri, 10 Mar 2023 at 13:32, Zoltán Böszörményi <zboszor@gmail.com> wrote: > > 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-" > > Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> > --- > meta/classes-recipe/pypi.bbclass | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > 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): > 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)}" > > -- > 2.39.2 >
2023. 03. 10. 13:45 keltezéssel, Alexander Kanavin írta: > Thanks, I like this better than changing the cmake recipe. Thank you. I will resend the new module recipes against meta-oe soon. > > Alex > > On Fri, 10 Mar 2023 at 13:32, Zoltán Böszörményi <zboszor@gmail.com> wrote: >> 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-" >> >> Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> >> --- >> meta/classes-recipe/pypi.bbclass | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> 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): >> 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)}" >> >> -- >> 2.39.2 >>
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): 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)}"
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-" Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> --- meta/classes-recipe/pypi.bbclass | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)