commit: 7c996a7e547efc89b16f5205160afbfe9d2be47a Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Sat Feb 11 10:33:03 2023 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Sun Feb 12 19:03:44 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c996a7e
pypi.eclass: Add PYPI_NO_NORMALIZE control var Closes: https://github.com/gentoo/gentoo/pull/29526 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> eclass/pypi.eclass | 19 ++++++++++++++++--- 1 file 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
