mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00

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>
27 lines
866 B
Plaintext
27 lines
866 B
Plaintext
def pypi_package(d):
|
|
bpn = d.getVar('BPN')
|
|
if bpn.startswith('python-'):
|
|
return bpn[7:]
|
|
elif bpn.startswith('python3-'):
|
|
return bpn[8:]
|
|
return bpn
|
|
|
|
PYPI_PACKAGE ?= "${@pypi_package(d)}"
|
|
PYPI_PACKAGE_EXT ?= "tar.gz"
|
|
PYPI_ARCHIVE_NAME ?= "${PYPI_PACKAGE}-${PV}.${PYPI_PACKAGE_EXT}"
|
|
|
|
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)
|
|
|
|
PYPI_SRC_URI ?= "${@pypi_src_uri(d)}"
|
|
|
|
HOMEPAGE ?= "https://pypi.python.org/pypi/${PYPI_PACKAGE}/"
|
|
SECTION = "devel/python"
|
|
SRC_URI:prepend = "${PYPI_SRC_URI} "
|
|
S = "${WORKDIR}/${PYPI_PACKAGE}-${PV}"
|
|
|
|
UPSTREAM_CHECK_URI ?= "https://pypi.org/project/${PYPI_PACKAGE}/"
|
|
UPSTREAM_CHECK_REGEX ?= "/${PYPI_PACKAGE}/(?P<pver>(\d+[\.\-_]*)+)/"
|