From 7c996a7e547efc89b16f5205160afbfe9d2be47a Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Sat, 11 Feb 2023 11:33:03 +0100 Subject: pypi.eclass: Add PYPI_NO_NORMALIZE control var MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: https://github.com/gentoo/gentoo/pull/29526 Signed-off-by: Michał Górny --- eclass/pypi.eclass | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'eclass') 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: # @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 -- cgit v1.2.3-65-gdbad