diff options
| -rw-r--r-- | eclass/pypi.eclass | 5 | ||||
| -rwxr-xr-x | eclass/tests/pypi.sh | 33 |
2 files changed, 36 insertions, 2 deletions
diff --git a/eclass/pypi.eclass b/eclass/pypi.eclass index 3a37214f8977..c7b9604807eb 100644 --- a/eclass/pypi.eclass +++ b/eclass/pypi.eclass @@ -82,7 +82,8 @@ pypi_sdist_url() { # @DESCRIPTION: # Output the wheel filename for the specified project/version tuple. # -# If <package> is unspecified, it defaults to ${PN}. +# If <package> is unspecified, it defaults to ${PN}. The package name +# is normalized according to the wheel specification. # # If <version> is unspecified, it defaults to ${PV}. # @@ -97,7 +98,7 @@ pypi_wheel_name() { die "Usage: ${FUNCNAME} <project> [<version> [<python-tag> [<abi-platform-tag>]]]" fi - local project=${1-"${PN}"} + local project=$(pypi_normalize_name "${1-"${PN}"}") local version=${2-"${PV}"} local pytag=${3-py3} local abitag=${4-none-any} diff --git a/eclass/tests/pypi.sh b/eclass/tests/pypi.sh index 67b2c3c481fb..111b61380fe4 100755 --- a/eclass/tests/pypi.sh +++ b/eclass/tests/pypi.sh @@ -29,4 +29,37 @@ test-eq "pypi_normalize_name foo___bar" foo_bar test-eq "pypi_normalize_name Flask-BabelEx" flask_babelex test-eq "pypi_normalize_name jaraco.context" jaraco_context +PN=Foo.Bar +PV=1.2.3 + +test-eq "pypi_wheel_name" foo_bar-1.2.3-py3-none-any.whl +test-eq "pypi_wheel_name Flask-BabelEx" flask_babelex-1.2.3-py3-none-any.whl +test-eq "pypi_wheel_name Flask-BabelEx 4" flask_babelex-4-py3-none-any.whl +test-eq "pypi_wheel_name Flask-BabelEx 4 py2.py3" \ + flask_babelex-4-py2.py3-none-any.whl +test-eq "pypi_wheel_name cryptography 39.0.1 cp36 abi3-manylinux_2_28_x86_64" \ + cryptography-39.0.1-cp36-abi3-manylinux_2_28_x86_64.whl + +test-eq "pypi_wheel_url" \ + https://files.pythonhosted.org/packages/py3/F/Foo.Bar/foo_bar-1.2.3-py3-none-any.whl +test-eq "pypi_wheel_url Flask-BabelEx" \ + https://files.pythonhosted.org/packages/py3/F/Flask-BabelEx/flask_babelex-1.2.3-py3-none-any.whl +test-eq "pypi_wheel_url Flask-BabelEx 4" \ + https://files.pythonhosted.org/packages/py3/F/Flask-BabelEx/flask_babelex-4-py3-none-any.whl +test-eq "pypi_wheel_url Flask-BabelEx 4 py2.py3" \ + https://files.pythonhosted.org/packages/py2.py3/F/Flask-BabelEx/flask_babelex-4-py2.py3-none-any.whl +test-eq "pypi_wheel_url cryptography 39.0.1 cp36 abi3-manylinux_2_28_x86_64" \ + https://files.pythonhosted.org/packages/cp36/c/cryptography/cryptography-39.0.1-cp36-abi3-manylinux_2_28_x86_64.whl + +test-eq "pypi_wheel_url --unpack" \ + "https://files.pythonhosted.org/packages/py3/F/Foo.Bar/foo_bar-1.2.3-py3-none-any.whl -> foo_bar-1.2.3-py3-none-any.whl.zip" +test-eq "pypi_wheel_url --unpack Flask-BabelEx" \ + "https://files.pythonhosted.org/packages/py3/F/Flask-BabelEx/flask_babelex-1.2.3-py3-none-any.whl -> flask_babelex-1.2.3-py3-none-any.whl.zip" +test-eq "pypi_wheel_url --unpack Flask-BabelEx 4" \ + "https://files.pythonhosted.org/packages/py3/F/Flask-BabelEx/flask_babelex-4-py3-none-any.whl -> flask_babelex-4-py3-none-any.whl.zip" +test-eq "pypi_wheel_url --unpack Flask-BabelEx 4 py2.py3" \ + "https://files.pythonhosted.org/packages/py2.py3/F/Flask-BabelEx/flask_babelex-4-py2.py3-none-any.whl -> flask_babelex-4-py2.py3-none-any.whl.zip" +test-eq "pypi_wheel_url --unpack cryptography 39.0.1 cp36 abi3-manylinux_2_28_x86_64" \ + "https://files.pythonhosted.org/packages/cp36/c/cryptography/cryptography-39.0.1-cp36-abi3-manylinux_2_28_x86_64.whl -> cryptography-39.0.1-cp36-abi3-manylinux_2_28_x86_64.whl.zip" + texit |
