mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-28 00:51:41 +02:00
eclass/pypi: Sync with Gentoo
It's from Gentoo commit 58fd31f892cd8315d8c67b08cfd1fad64be431b0.
This commit is contained in:
parent
a14930a9dc
commit
03df767647
@ -16,7 +16,7 @@
|
|||||||
# the eclass), and the version is translated using
|
# the eclass), and the version is translated using
|
||||||
# pypi_translate_version.
|
# pypi_translate_version.
|
||||||
#
|
#
|
||||||
# If necessary, SRC_URI and S can be overriden by the ebuild. Two
|
# If necessary, SRC_URI and S can be overridden by the ebuild. Two
|
||||||
# helper functions, pypi_sdist_url and pypi_wheel_url are provided
|
# helper functions, pypi_sdist_url and pypi_wheel_url are provided
|
||||||
# to generate URLs to artifacts of specified type, with customizable
|
# to generate URLs to artifacts of specified type, with customizable
|
||||||
# URL components. Additionally, pypi_wheel_name can be used to generate
|
# URL components. Additionally, pypi_wheel_name can be used to generate
|
||||||
@ -50,6 +50,19 @@ _PYPI_ECLASS=1
|
|||||||
# When set to a non-empty value, disables project name normalization
|
# When set to a non-empty value, disables project name normalization
|
||||||
# for the default SRC_URI and S values.
|
# for the default SRC_URI and S values.
|
||||||
|
|
||||||
|
# @ECLASS_VARIABLE: PYPI_PN
|
||||||
|
# @PRE_INHERIT
|
||||||
|
# @DESCRIPTION:
|
||||||
|
# The PyPI project name. This should be overridden scarcely, generally
|
||||||
|
# when upstream project name does not conform to Gentoo naming rules,
|
||||||
|
# e.g. when it contains dots or uppercase letters.
|
||||||
|
#
|
||||||
|
# Example use:
|
||||||
|
# @CODE
|
||||||
|
# PYPI_PN=${PN/-/.}
|
||||||
|
# @CODE
|
||||||
|
: "${PYPI_PN:=${PN}}"
|
||||||
|
|
||||||
# @FUNCTION: pypi_normalize_name
|
# @FUNCTION: pypi_normalize_name
|
||||||
# @USAGE: <name>
|
# @USAGE: <name>
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
@ -99,9 +112,9 @@ pypi_translate_version() {
|
|||||||
# generated using build systems that did not follow PEP 625
|
# generated using build systems that did not follow PEP 625
|
||||||
# (i.e. the sdist name contains uppercase letters, hyphens or dots).
|
# (i.e. the sdist name contains uppercase letters, hyphens or dots).
|
||||||
#
|
#
|
||||||
# If <package> is unspecified, it defaults to ${PN}. The package name
|
# If <package> is unspecified, it defaults to ${PYPI_PN}. The package
|
||||||
# is normalized according to the specification unless `--no-normalize`
|
# name is normalized according to the specification unless
|
||||||
# is passed.
|
# `--no-normalize` is passed.
|
||||||
#
|
#
|
||||||
# If <version> is unspecified, it defaults to ${PV} translated
|
# If <version> is unspecified, it defaults to ${PV} translated
|
||||||
# via pypi_translate_version. If it is specified, then it is used
|
# via pypi_translate_version. If it is specified, then it is used
|
||||||
@ -121,7 +134,7 @@ pypi_sdist_url() {
|
|||||||
die "Usage: ${FUNCNAME} [--no-normalize] <project> [<version> [<suffix>]]"
|
die "Usage: ${FUNCNAME} [--no-normalize] <project> [<version> [<suffix>]]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local project=${1-"${PN}"}
|
local project=${1-"${PYPI_PN}"}
|
||||||
local version=${2-"$(pypi_translate_version "${PV}")"}
|
local version=${2-"$(pypi_translate_version "${PV}")"}
|
||||||
local suffix=${3-.tar.gz}
|
local suffix=${3-.tar.gz}
|
||||||
local fn_project=${project}
|
local fn_project=${project}
|
||||||
@ -135,8 +148,8 @@ pypi_sdist_url() {
|
|||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# Output the wheel filename for the specified project/version tuple.
|
# Output the wheel filename for the specified project/version tuple.
|
||||||
#
|
#
|
||||||
# If <package> is unspecified, it defaults to ${PN}. The package name
|
# If <package> is unspecified, it defaults to ${PYPI_PN}. The package
|
||||||
# is normalized according to the wheel specification.
|
# name is normalized according to the wheel specification.
|
||||||
#
|
#
|
||||||
# If <version> is unspecified, it defaults to ${PV} translated
|
# If <version> is unspecified, it defaults to ${PV} translated
|
||||||
# via pypi_translate_version. If it is specified, then it is used
|
# via pypi_translate_version. If it is specified, then it is used
|
||||||
@ -154,7 +167,7 @@ pypi_wheel_name() {
|
|||||||
die "Usage: ${FUNCNAME} <project> [<version> [<python-tag> [<abi-platform-tag>]]]"
|
die "Usage: ${FUNCNAME} <project> [<version> [<python-tag> [<abi-platform-tag>]]]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local project=$(pypi_normalize_name "${1-"${PN}"}")
|
local project=$(pypi_normalize_name "${1-"${PYPI_PN}"}")
|
||||||
local version=${2-"$(pypi_translate_version "${PV}")"}
|
local version=${2-"$(pypi_translate_version "${PV}")"}
|
||||||
local pytag=${3-py3}
|
local pytag=${3-py3}
|
||||||
local abitag=${4-none-any}
|
local abitag=${4-none-any}
|
||||||
@ -172,7 +185,7 @@ pypi_wheel_name() {
|
|||||||
# the wheel contents will be unpacked straight into ${WORKDIR}.
|
# the wheel contents will be unpacked straight into ${WORKDIR}.
|
||||||
# You need to add a BDEPEND on app-arch/unzip.
|
# You need to add a BDEPEND on app-arch/unzip.
|
||||||
#
|
#
|
||||||
# If <package> is unspecified, it defaults to ${PN}.
|
# If <package> is unspecified, it defaults to ${PYPI_PN}.
|
||||||
#
|
#
|
||||||
# If <version> is unspecified, it defaults to ${PV} translated
|
# If <version> is unspecified, it defaults to ${PV} translated
|
||||||
# via pypi_translate_version. If it is specified, then it is used
|
# via pypi_translate_version. If it is specified, then it is used
|
||||||
@ -197,7 +210,7 @@ pypi_wheel_url() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local filename=$(pypi_wheel_name "${@}")
|
local filename=$(pypi_wheel_name "${@}")
|
||||||
local project=${1-"${PN}"}
|
local project=${1-"${PYPI_PN}"}
|
||||||
local version=${2-"$(pypi_translate_version "${PV}")"}
|
local version=${2-"$(pypi_translate_version "${PV}")"}
|
||||||
local pytag=${3-py3}
|
local pytag=${3-py3}
|
||||||
printf "https://files.pythonhosted.org/packages/%s" \
|
printf "https://files.pythonhosted.org/packages/%s" \
|
||||||
@ -210,10 +223,10 @@ pypi_wheel_url() {
|
|||||||
|
|
||||||
if [[ ${PYPI_NO_NORMALIZE} ]]; then
|
if [[ ${PYPI_NO_NORMALIZE} ]]; then
|
||||||
SRC_URI="$(pypi_sdist_url --no-normalize)"
|
SRC_URI="$(pypi_sdist_url --no-normalize)"
|
||||||
S="${WORKDIR}/${PN}-$(pypi_translate_version "${PV}")"
|
S="${WORKDIR}/${PYPI_PN}-$(pypi_translate_version "${PV}")"
|
||||||
else
|
else
|
||||||
SRC_URI="$(pypi_sdist_url)"
|
SRC_URI="$(pypi_sdist_url)"
|
||||||
S="${WORKDIR}/$(pypi_normalize_name "${PN}")-$(pypi_translate_version "${PV}")"
|
S="${WORKDIR}/$(pypi_normalize_name "${PYPI_PN}")-$(pypi_translate_version "${PV}")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user