summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-02-10 14:51:26 +0100
committerMichał Górny <mgorny@gentoo.org>2023-02-12 20:00:46 +0100
commit1b21375a8ce05dad4d9e977f2098f0e70cfec4fa (patch)
tree9bd9e792351218dee2f0618b6afd5488bc000cc7 /eclass/pypi.eclass
parentpypi.eclass: Add a version translation function (diff)
downloadgentoo-1b21375a8ce05dad4d9e977f2098f0e70cfec4fa.tar.gz
gentoo-1b21375a8ce05dad4d9e977f2098f0e70cfec4fa.tar.bz2
gentoo-1b21375a8ce05dad4d9e977f2098f0e70cfec4fa.zip
pypi.eclass: Translate ${PV} by default
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/pypi.eclass')
-rw-r--r--eclass/pypi.eclass21
1 files changed, 15 insertions, 6 deletions
diff --git a/eclass/pypi.eclass b/eclass/pypi.eclass
index 27bd17403100..be0e498fcbf3 100644
--- a/eclass/pypi.eclass
+++ b/eclass/pypi.eclass
@@ -87,7 +87,10 @@ pypi_translate_version() {
# is normalized according to the specification unless `--no-normalize`
# is passed.
#
-# If <version> is unspecified, it defaults to ${PV}.
+# If <version> is unspecified, it defaults to ${PV} translated
+# via pypi_translate_version. If it is specified, then it is used
+# verbatim (the function can be called explicitly to translate custom
+# version number).
#
# If <format> is unspecified, it defaults to ".tar.gz". Another valid
# value is ".zip" (please remember to add a BDEPEND on app-arch/unzip).
@@ -103,7 +106,7 @@ pypi_sdist_url() {
fi
local project=${1-"${PN}"}
- local version=${2-"${PV}"}
+ local version=${2-"$(pypi_translate_version "${PV}")"}
local suffix=${3-.tar.gz}
local fn_project=${project}
[[ ${normalize} ]] && fn_project=$(pypi_normalize_name "${project}")
@@ -119,7 +122,10 @@ pypi_sdist_url() {
# If <package> is unspecified, it defaults to ${PN}. The package name
# is normalized according to the wheel specification.
#
-# If <version> is unspecified, it defaults to ${PV}.
+# If <version> is unspecified, it defaults to ${PV} translated
+# via pypi_translate_version. If it is specified, then it is used
+# verbatim (the function can be called explicitly to translate custom
+# version number).
#
# If <python-tag> is unspecified, it defaults to "py3". It can also be
# "py2.py3", or a specific version in case of non-pure wheels.
@@ -133,7 +139,7 @@ pypi_wheel_name() {
fi
local project=$(pypi_normalize_name "${1-"${PN}"}")
- local version=${2-"${PV}"}
+ local version=${2-"$(pypi_translate_version "${PV}")"}
local pytag=${3-py3}
local abitag=${4-none-any}
echo "${project}-${version}-${pytag}-${abitag}.whl"
@@ -152,7 +158,10 @@ pypi_wheel_name() {
#
# If <package> is unspecified, it defaults to ${PN}.
#
-# If <version> is unspecified, it defaults to ${PV}.
+# If <version> is unspecified, it defaults to ${PV} translated
+# via pypi_translate_version. If it is specified, then it is used
+# verbatim (the function can be called explicitly to translate custom
+# version number).
#
# If <python-tag> is unspecified, it defaults to "py3". It can also be
# "py2.py3", or a specific version in case of non-pure wheels.
@@ -173,7 +182,7 @@ pypi_wheel_url() {
local filename=$(pypi_wheel_name "${@}")
local project=${1-"${PN}"}
- local version=${2-"${PV}"}
+ local version=${2-"$(pypi_translate_version "${PV}")"}
local pytag=${3-py3}
printf "https://files.pythonhosted.org/packages/%s" \
"${pytag}/${project::1}/${project}/${filename}"