From 54ef05621701a320a71e56f68a0a942bc53ae0e9 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 7 Feb 2023 15:25:19 +0000 Subject: gentoo auto-resync : 07:02:2023 - 15:25:18 --- eclass/pypi.eclass | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'eclass/pypi.eclass') diff --git a/eclass/pypi.eclass b/eclass/pypi.eclass index e11999fc7e9c..e9d3eec1268b 100644 --- a/eclass/pypi.eclass +++ b/eclass/pypi.eclass @@ -6,7 +6,7 @@ # Michał Górny # @AUTHOR: # Michał Górny -# @SUPPORTED_EAPIS: 8 +# @SUPPORTED_EAPIS: 7 8 # @BLURB: A helper eclass to generate PyPI source URIs # @DESCRIPTION: # The pypi.eclass can be used to easily obtain URLs for artifacts @@ -27,7 +27,7 @@ # @CODE@ case ${EAPI} in - 8) ;; + 7|8) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac @@ -89,10 +89,16 @@ pypi_wheel_name() { } # @FUNCTION: pypi_wheel_url -# @USAGE: [ [ [ []]]] +# @USAGE: [--unpack] [ [ [ []]]] # @DESCRIPTION: # Output the URL to PyPI wheel for specified project/version tuple. # +# The `--unpack` option causes a SRC_URI with an arrow operator to +# be generated, that adds a .zip suffix to the fetched distfile, +# so that it is unpacked in default src_unpack(). Note that +# the wheel contents will be unpacked straight into ${WORKDIR}. +# You need to add a BDEPEND on app-arch/unzip. +# # If is unspecified, it defaults to ${PN}. # # If is unspecified, it defaults to ${PV}. @@ -103,21 +109,27 @@ pypi_wheel_name() { # If is unspecified, it defaults to "none-any". # You need to specify the correct value for non-pure wheels, # e.g. "abi3-linux_x86_64". -# -# Note that wheels are suffixed .whl by default and therefore are not -# unpacked automatically. If you need automatic unpacking, use "->" -# operator to rename it or call unzip directly. Remember to BDEPEND -# on app-arch/unzip. pypi_wheel_url() { + local unpack= + if [[ ${1} == --unpack ]]; then + unpack=1 + shift + fi + if [[ ${#} -gt 4 ]]; then die "Usage: ${FUNCNAME} [ [ []]]" fi + local filename=$(pypi_wheel_name "${@}") local project=${1-"${PN}"} local version=${2-"${PV}"} local pytag=${3-py3} printf "https://files.pythonhosted.org/packages/%s" \ - "${pytag}/${project::1}/${project}/$(pypi_wheel_name "${@}")" + "${pytag}/${project::1}/${project}/${filename}" + + if [[ ${unpack} ]]; then + echo " -> ${filename}.zip" + fi } fi -- cgit v1.2.3