diff options
author | Michał Górny <mgorny@gentoo.org> | 2023-02-11 11:33:03 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2023-02-12 20:03:44 +0100 |
commit | 7c996a7e547efc89b16f5205160afbfe9d2be47a (patch) | |
tree | 2df120a89730dda3ca6c069158d5565fb2824e0d /eclass | |
parent | pypi.eclass: Normalize PN and translate PV for S as well (diff) | |
download | gentoo-7c996a7e547efc89b16f5205160afbfe9d2be47a.tar.gz gentoo-7c996a7e547efc89b16f5205160afbfe9d2be47a.tar.bz2 gentoo-7c996a7e547efc89b16f5205160afbfe9d2be47a.zip |
pypi.eclass: Add PYPI_NO_NORMALIZE control var
Closes: https://github.com/gentoo/gentoo/pull/29526
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/pypi.eclass | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/eclass/pypi.eclass b/eclass/pypi.eclass index f4367b3fbfec..182b0b6b8c3e 100644 --- a/eclass/pypi.eclass +++ b/eclass/pypi.eclass @@ -12,7 +12,8 @@ # The pypi.eclass can be used to easily obtain URLs for artifacts # uploaded to PyPI.org. When inherited, the eclass defaults SRC_URI # and S to fetch .tar.gz sdist. The project filename is normalized -# by default, and the version is translated using +# by default (unless PYPI_NO_NORMALIZE is set prior to inheriting +# the eclass), and the version is translated using # pypi_translate_version. # # If necessary, SRC_URI and S can be overriden by the ebuild. Two @@ -42,6 +43,13 @@ esac if [[ ! ${_PYPI_ECLASS} ]]; then _PYPI_ECLASS=1 +# @ECLASS_VARIABLE: PYPI_NO_NORMALIZE +# @PRE_INHERIT +# @DEFAULT_UNSET +# @DESCRIPTION: +# When set to a non-empty value, disables project name normalization +# for the default SRC_URI and S values. + # @FUNCTION: pypi_normalize_name # @USAGE: <name> # @DESCRIPTION: @@ -200,7 +208,12 @@ pypi_wheel_url() { fi } -SRC_URI="$(pypi_sdist_url)" -S="${WORKDIR}/$(pypi_normalize_name "${PN}")-$(pypi_translate_version "${PV}")" +if [[ ${PYPI_NO_NORMALIZE} ]]; then + SRC_URI="$(pypi_sdist_url --no-normalize)" + S="${WORKDIR}/${PN}-$(pypi_translate_version "${PV}")" +else + SRC_URI="$(pypi_sdist_url)" + S="${WORKDIR}/$(pypi_normalize_name "${PN}")-$(pypi_translate_version "${PV}")" +fi fi |