diff options
author | Michał Górny <mgorny@gentoo.org> | 2023-02-05 12:53:28 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2023-02-05 12:59:47 +0100 |
commit | 3a4c0d4ec8dac19fde36f704dc278f6b55ec8d51 (patch) | |
tree | 81f36b4e01bc54be6266195132a2d624629fe684 /eclass/pypi.eclass | |
parent | dev-python/ensurepip-setuptools: Use pypi.eclass in 67.1.0 too (diff) | |
download | gentoo-3a4c0d4ec8dac19fde36f704dc278f6b55ec8d51.tar.gz gentoo-3a4c0d4ec8dac19fde36f704dc278f6b55ec8d51.tar.bz2 gentoo-3a4c0d4ec8dac19fde36f704dc278f6b55ec8d51.zip |
pypi.eclass: Make package optional as well
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/pypi.eclass')
-rw-r--r-- | eclass/pypi.eclass | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/eclass/pypi.eclass b/eclass/pypi.eclass index 12ce5d4ace15..e11999fc7e9c 100644 --- a/eclass/pypi.eclass +++ b/eclass/pypi.eclass @@ -39,20 +39,22 @@ SRC_URI=" " # @FUNCTION: pypi_sdist_url -# @USAGE: <project> [<version> [<suffix>]] +# @USAGE: [<project> [<version> [<suffix>]]] # @DESCRIPTION: # Output the URL to PyPI sdist for specified project/version tuple. # +# If <package> is unspecified, it defaults to ${PN}. +# # If <version> is unspecified, it defaults to ${PV}. # # If <format> is unspecified, it defaults to ".tar.gz". Another valid # value is ".zip" (please remember to add a BDEPEND on app-arch/unzip). pypi_sdist_url() { - if ! has "${#}" {1..3}; then + if [[ ${#} -gt 3 ]]; then die "Usage: ${FUNCNAME} <project> [<version> [<suffix>]]" fi - local project=${1} + local project=${1-"${PN}"} local version=${2-"${PV}"} local suffix=${3-.tar.gz} printf "https://files.pythonhosted.org/packages/source/%s" \ @@ -60,10 +62,12 @@ pypi_sdist_url() { } # @FUNCTION: pypi_wheel_name -# @USAGE: <project> [<version> [<python-tag> [<abi-platform-tag>]]] +# @USAGE: [<project> [<version> [<python-tag> [<abi-platform-tag>]]]] # @DESCRIPTION: # Output the wheel filename for the specified project/version tuple. # +# If <package> is unspecified, it defaults to ${PN}. +# # If <version> is unspecified, it defaults to ${PV}. # # If <python-tag> is unspecified, it defaults to "py3". It can also be @@ -73,11 +77,11 @@ pypi_sdist_url() { # You need to specify the correct value for non-pure wheels, # e.g. "abi3-linux_x86_64". pypi_wheel_name() { - if ! has "${#}" {1..4}; then + if [[ ${#} -gt 4 ]]; then die "Usage: ${FUNCNAME} <project> [<version> [<python-tag> [<abi-platform-tag>]]]" fi - local project=${1} + local project=${1-"${PN}"} local version=${2-"${PV}"} local pytag=${3-py3} local abitag=${4-none-any} @@ -85,10 +89,12 @@ pypi_wheel_name() { } # @FUNCTION: pypi_wheel_url -# @USAGE: <project> [<version> [<python-tag> [<abi-platform-tag>]]] +# @USAGE: [<project> [<version> [<python-tag> [<abi-platform-tag>]]]] # @DESCRIPTION: # Output the URL to PyPI wheel for specified project/version tuple. # +# If <package> is unspecified, it defaults to ${PN}. +# # If <version> is unspecified, it defaults to ${PV}. # # If <python-tag> is unspecified, it defaults to "py3". It can also be @@ -103,11 +109,11 @@ pypi_wheel_name() { # operator to rename it or call unzip directly. Remember to BDEPEND # on app-arch/unzip. pypi_wheel_url() { - if ! has "${#}" {1..4}; then + if [[ ${#} -gt 4 ]]; then die "Usage: ${FUNCNAME} <project> [<version> [<python-tag> [<abi-platform-tag>]]]" fi - local project=${1} + local project=${1-"${PN}"} local version=${2-"${PV}"} local pytag=${3-py3} printf "https://files.pythonhosted.org/packages/%s" \ |