Gentoo Archives: gentoo-dev

From: Patrick McLean <chutzpah@g.o>
To: gentoo-dev@l.g.o
Cc: Patrick McLean <chutzpah@g.o>
Subject: [gentoo-dev] [PATCH] python-utils-r1.eclass: Add PYTHON_RELAXED_VERSIONS variable
Date: Thu, 30 Apr 2020 05:23:16
Message-Id: 20200430052250.1681602-1-chutzpah@gentoo.org
1 This adds PYTHON_RELAXED_VERSIONS that ebuilds can set before inheriting the
2 python eclasses that will make the implementation dependencies be simple slot
3 dependencies rather than >= dependencies. The purpose of this is for packages in
4 @system to use to avoid circular dependencies like in bug #720048
5
6 Bug: https://bugs.gentoo.org/720048
7 Signed-off-by: Patrick McLean <chutzpah@g.o>
8 ---
9 eclass/python-utils-r1.eclass | 56 ++++++++++++++++++++++++++---------
10 1 file changed, 42 insertions(+), 14 deletions(-)
11
12 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
13 index e85aefda792..e5781605c8e 100644
14 --- a/eclass/python-utils-r1.eclass
15 +++ b/eclass/python-utils-r1.eclass
16 @@ -57,6 +57,17 @@ readonly _PYTHON_ALL_IMPLS
17 # which can involve revisions of this eclass that support a different
18 # set of Python implementations.
19
20 +# @ECLASS-VARIABLE: PYTHON_RELAXED_VERSIONS
21 +# @INTERNAL
22 +# @DESCRIPTION:
23 +# Set to a non-empty value in order to make eclass dependencies on
24 +# Python versions be simple slot dependencies rather than setting
25 +# a minimum version.
26 +#
27 +# This is intended to be set in ebuilds that are part of @system, or
28 +# are dependencies of Python implementations themselves to avoid
29 +# circular dependencies with the Python interpreter.
30 +
31 # @FUNCTION: _python_impl_supported
32 # @USAGE: <impl>
33 # @INTERNAL
34 @@ -376,20 +387,37 @@ _python_export() {
35 ;;
36 PYTHON_PKG_DEP)
37 local d
38 - case ${impl} in
39 - python2.7)
40 - PYTHON_PKG_DEP='>=dev-lang/python-2.7.17-r1:2.7';;
41 - python3.6)
42 - PYTHON_PKG_DEP=">=dev-lang/python-3.6.10:3.6";;
43 - python3.7)
44 - PYTHON_PKG_DEP=">=dev-lang/python-3.7.7-r1:3.7";;
45 - python3.8)
46 - PYTHON_PKG_DEP=">=dev-lang/python-3.8.2:3.8";;
47 - pypy3)
48 - PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.0:0=';;
49 - *)
50 - die "Invalid implementation: ${impl}"
51 - esac
52 + if [[ -z ${PYTHON_RELAXED_VERSIONS} ]]; then
53 + case ${impl} in
54 + python2.7)
55 + PYTHON_PKG_DEP='>=dev-lang/python-2.7.17-r1:2.7';;
56 + python3.6)
57 + PYTHON_PKG_DEP=">=dev-lang/python-3.6.10:3.6";;
58 + python3.7)
59 + PYTHON_PKG_DEP=">=dev-lang/python-3.7.7-r1:3.7";;
60 + python3.8)
61 + PYTHON_PKG_DEP=">=dev-lang/python-3.8.2:3.8";;
62 + pypy3)
63 + PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.0:0=';;
64 + *)
65 + die "Invalid implementation: ${impl}"
66 + esac
67 + else
68 + case ${impl} in
69 + python2.7)
70 + PYTHON_PKG_DEP='dev-lang/python:2.7';;
71 + python3.6)
72 + PYTHON_PKG_DEP="dev-lang/python:3.6";;
73 + python3.7)
74 + PYTHON_PKG_DEP="dev-lang/python:3.7";;
75 + python3.8)
76 + PYTHON_PKG_DEP="dev-lang/python:3.8";;
77 + pypy3)
78 + PYTHON_PKG_DEP='dev-python/pypy3:0=';;
79 + *)
80 + die "Invalid implementation: ${impl}"
81 + esac
82 + fi
83
84 # use-dep
85 if [[ ${PYTHON_REQ_USE} ]]; then
86 --
87 2.26.2

Replies