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 1A49815800F for ; Sat, 11 Feb 2023 11:45:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1D4BEE085E; Sat, 11 Feb 2023 11:45:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 CCB2CE0831 for ; Sat, 11 Feb 2023 11:45:33 +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 1/2] pypi.eclass: Normalize PN and translate PV for S as well Date: Sat, 11 Feb 2023 12:45:08 +0100 Message-Id: <20230211114509.2077813-1-mgorny@gentoo.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: 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: 595abd12-003d-4d6f-a615-93d3cbc25d67 X-Archives-Hash: 28aaf7933e73d51366e535c76301c0d3 Signed-off-by: Michał Górny --- eclass/pypi.eclass | 19 ++++++++++++++----- 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='' 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="/foo_bar-1.2.3b2"' texit -- 2.39.1