From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 580C415800F for ; Sat, 11 Feb 2023 09:17:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 42EA5E0875; Sat, 11 Feb 2023 09:16:23 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id EB397E0870 for ; Sat, 11 Feb 2023 09:16:22 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 3/7] pypi.eclass: Normalize wheel filenames Date: Sat, 11 Feb 2023 10:16:10 +0100 Message-Id: <20230211091614.879528-4-mgorny@gentoo.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230211091614.879528-1-mgorny@gentoo.org> References: <20230211091614.879528-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 698890da-eb23-4d5f-a5bd-adb20f86dad3 X-Archives-Hash: 042c46142547649b44b2e557359ef62e Signed-off-by: Michał Górny --- eclass/pypi.eclass | 5 +++-- 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 is unspecified, it defaults to ${PN}. +# If is unspecified, it defaults to ${PN}. The package name +# is normalized according to the wheel specification. # # If is unspecified, it defaults to ${PV}. # @@ -97,7 +98,7 @@ pypi_wheel_name() { die "Usage: ${FUNCNAME} [ [ []]]" 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 -- 2.39.1