diff options
author | Michał Górny <mgorny@gentoo.org> | 2023-02-11 11:30:54 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2023-02-12 20:00:47 +0100 |
commit | 4141f5032c5e45dc912f27d39d81ef0a65c6c56b (patch) | |
tree | 2108bcabd97ed91aea6a1787a7f981f604c7af08 /eclass | |
parent | pypi.eclass: Translate ${PV} by default (diff) | |
download | gentoo-4141f5032c5e45dc912f27d39d81ef0a65c6c56b.tar.gz gentoo-4141f5032c5e45dc912f27d39d81ef0a65c6c56b.tar.bz2 gentoo-4141f5032c5e45dc912f27d39d81ef0a65c6c56b.zip |
pypi.eclass: Normalize PN and translate PV for S as well
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/pypi.eclass | 19 | ||||
-rwxr-xr-x | eclass/tests/pypi.sh | 3 |
2 files changed, 17 insertions, 5 deletions
diff --git a/eclass/pypi.eclass b/eclass/pypi.eclass index be0e498fcbf3..f4367b3fbfec 100644 --- a/eclass/pypi.eclass +++ b/eclass/pypi.eclass @@ -11,12 +11,20 @@ # @DESCRIPTION: # The pypi.eclass can be used to easily obtain URLs for artifacts # uploaded to PyPI.org. When inherited, the eclass defaults SRC_URI -# to fetch ${P}.tar.gz sdist. +# and S to fetch .tar.gz sdist. The project filename is normalized +# by default, and the version is translated using +# pypi_translate_version. # -# If necessary, SRC_URI can be overriden by the ebuild. Two helper -# functions, pypi_sdist_url and pypi_wheel_url are provided to generate -# URLs to artifacts of specified type, with customizable project name. -# Additionally, pypi_wheel_name can be used to generate wheel filename. +# If necessary, SRC_URI and S can be overriden by the ebuild. Two +# helper functions, pypi_sdist_url and pypi_wheel_url are provided +# to generate URLs to artifacts of specified type, with customizable +# URL components. Additionally, pypi_wheel_name can be used to generate +# wheel filename. +# +# pypi_normalize_name can be used to normalize an arbitrary project name +# according to sdist/wheel normalization rules. pypi_translate_version +# can be used to translate a Gentoo version string into its PEP 440 +# equivalent. # # @EXAMPLE: # @CODE@ @@ -193,5 +201,6 @@ pypi_wheel_url() { } SRC_URI="$(pypi_sdist_url)" +S="${WORKDIR}/$(pypi_normalize_name "${PN}")-$(pypi_translate_version "${PV}")" fi diff --git a/eclass/tests/pypi.sh b/eclass/tests/pypi.sh index e114549633a0..ebfcdb630856 100755 --- a/eclass/tests/pypi.sh +++ b/eclass/tests/pypi.sh @@ -7,6 +7,7 @@ source tests-common.sh || exit PN=Foo.Bar PV=1.2.3_beta2 +WORKDIR='<WORKDIR>' inherit pypi @@ -89,5 +90,7 @@ test-eq "pypi_sdist_url --no-normalize Flask-BabelEx 4 .zip" \ test-eq 'declare -p SRC_URI' \ 'declare -- SRC_URI="https://files.pythonhosted.org/packages/source/F/Foo.Bar/foo_bar-1.2.3b2.tar.gz"' +test-eq 'declare -p S' \ + 'declare -- S="<WORKDIR>/foo_bar-1.2.3b2"' texit |