blob: f510bfed06f07d946c7acea89d25af230a499b75 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7def pypi_package(d):
8 bpn = d.getVar('BPN')
9 if bpn.startswith('python-'):
10 return bpn[7:]
11 elif bpn.startswith('python3-'):
12 return bpn[8:]
13 return bpn
14
15PYPI_PACKAGE ?= "${@pypi_package(d)}"
16PYPI_PACKAGE_EXT ?= "tar.gz"
17PYPI_ARCHIVE_NAME ?= "${PYPI_PACKAGE}-${PV}.${PYPI_PACKAGE_EXT}"
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050018PYPI_ARCHIVE_NAME_PREFIX ?= ""
Patrick Williams92b42cb2022-09-03 06:53:57 -050019
20def pypi_src_uri(d):
21 package = d.getVar('PYPI_PACKAGE')
22 archive_name = d.getVar('PYPI_ARCHIVE_NAME')
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050023 archive_downloadname = d.getVar('PYPI_ARCHIVE_NAME_PREFIX') + archive_name
24 return 'https://files.pythonhosted.org/packages/source/%s/%s/%s;downloadfilename=%s' % (package[0], package, archive_name, archive_downloadname)
Patrick Williams92b42cb2022-09-03 06:53:57 -050025
26PYPI_SRC_URI ?= "${@pypi_src_uri(d)}"
27
28HOMEPAGE ?= "https://pypi.python.org/pypi/${PYPI_PACKAGE}/"
29SECTION = "devel/python"
30SRC_URI:prepend = "${PYPI_SRC_URI} "
31S = "${WORKDIR}/${PYPI_PACKAGE}-${PV}"
32
33UPSTREAM_CHECK_URI ?= "https://pypi.org/project/${PYPI_PACKAGE}/"
34UPSTREAM_CHECK_REGEX ?= "/${PYPI_PACKAGE}/(?P<pver>(\d+[\.\-_]*)+)/"
35
36CVE_PRODUCT ?= "python:${PYPI_PACKAGE}"