Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] python-r1.eclass: Allow empty depstring to python_gen_any_dep
Date: Sun, 07 Feb 2021 10:44:46
Message-Id: 20210207104434.206420-1-mgorny@gentoo.org
1 Allow python_gen_any_dep to accept an empty/missing depstring, in order
2 to generate a pure dependency on the Python interpreter. This is
3 a valid use case for it since python-r1 does not provide any-r1 style
4 PYTHON_DEPS.
5
6 Signed-off-by: Michał Górny <mgorny@g.o>
7 ---
8 eclass/python-r1.eclass | 15 ++++++++-------
9 1 file changed, 8 insertions(+), 7 deletions(-)
10
11 diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
12 index 5cae020c6d90..74e3fb38a1cc 100644
13 --- a/eclass/python-r1.eclass
14 +++ b/eclass/python-r1.eclass
15 @@ -524,16 +524,18 @@ python_gen_impl_dep() {
16 }
17
18 # @FUNCTION: python_gen_any_dep
19 -# @USAGE: <dependency-block> [<impl-pattern>...]
20 +# @USAGE: [<dependency-block> [<impl-pattern>...]]
21 # @DESCRIPTION:
22 # Generate an any-of dependency that enforces a version match between
23 -# the Python interpreter and Python packages. <dependency-block> needs
24 -# to list one or more dependencies with verbatim '${PYTHON_USEDEP}'
25 +# the Python interpreter and Python packages. <dependency-block> may
26 +# list one or more dependencies with verbatim '${PYTHON_USEDEP}'
27 # or '${PYTHON_SINGLE_USEDEP}' references (quoted!) that will get
28 -# expanded inside the function. Optionally, patterns may be specified
29 -# to restrict the dependency to a subset of Python implementations
30 -# supported by the ebuild.
31 +# expanded inside the function. If <dependency-block> is an empty string
32 +# (or no arguments are passed), a pure dependency on any Python
33 +# interpreter will be generated.
34 #
35 +# Optionally, patterns may be specified to restrict the dependency to
36 +# a subset of Python implementations supported by the ebuild.
37 # The patterns can be either fnmatch-style patterns (matched via bash
38 # == operator against PYTHON_COMPAT values) or '-2' / '-3' to indicate
39 # appropriately all enabled Python 2/3 implementations (alike
40 @@ -587,7 +589,6 @@ python_gen_any_dep() {
41 debug-print-function ${FUNCNAME} "${@}"
42
43 local depstr=${1}
44 - [[ ${depstr} ]] || die "No dependency string provided"
45 shift
46
47 local i PYTHON_PKG_DEP out=
48 --
49 2.30.0