This adds PYTHON_RELAXED_VERSIONS that ebuilds can set before inheriting the python eclasses that will make the implementation dependencies be simple slot dependencies rather than >= dependencies. The purpose of this is for packages in @system to use to avoid circular dependencies like in bug #720048
Bug: https://bugs.gentoo.org/720048 Signed-off-by: Patrick McLean <chutz...@gentoo.org> --- eclass/python-utils-r1.eclass | 56 ++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index e85aefda792..e5781605c8e 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -57,6 +57,17 @@ readonly _PYTHON_ALL_IMPLS # which can involve revisions of this eclass that support a different # set of Python implementations. +# @ECLASS-VARIABLE: PYTHON_RELAXED_VERSIONS +# @INTERNAL +# @DESCRIPTION: +# Set to a non-empty value in order to make eclass dependencies on +# Python versions be simple slot dependencies rather than setting +# a minimum version. +# +# This is intended to be set in ebuilds that are part of @system, or +# are dependencies of Python implementations themselves to avoid +# circular dependencies with the Python interpreter. + # @FUNCTION: _python_impl_supported # @USAGE: <impl> # @INTERNAL @@ -376,20 +387,37 @@ _python_export() { ;; PYTHON_PKG_DEP) local d - case ${impl} in - python2.7) - PYTHON_PKG_DEP='>=dev-lang/python-2.7.17-r1:2.7';; - python3.6) - PYTHON_PKG_DEP=">=dev-lang/python-3.6.10:3.6";; - python3.7) - PYTHON_PKG_DEP=">=dev-lang/python-3.7.7-r1:3.7";; - python3.8) - PYTHON_PKG_DEP=">=dev-lang/python-3.8.2:3.8";; - pypy3) - PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.0:0=';; - *) - die "Invalid implementation: ${impl}" - esac + if [[ -z ${PYTHON_RELAXED_VERSIONS} ]]; then + case ${impl} in + python2.7) + PYTHON_PKG_DEP='>=dev-lang/python-2.7.17-r1:2.7';; + python3.6) + PYTHON_PKG_DEP=">=dev-lang/python-3.6.10:3.6";; + python3.7) + PYTHON_PKG_DEP=">=dev-lang/python-3.7.7-r1:3.7";; + python3.8) + PYTHON_PKG_DEP=">=dev-lang/python-3.8.2:3.8";; + pypy3) + PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.0:0=';; + *) + die "Invalid implementation: ${impl}" + esac + else + case ${impl} in + python2.7) + PYTHON_PKG_DEP='dev-lang/python:2.7';; + python3.6) + PYTHON_PKG_DEP="dev-lang/python:3.6";; + python3.7) + PYTHON_PKG_DEP="dev-lang/python:3.7";; + python3.8) + PYTHON_PKG_DEP="dev-lang/python:3.8";; + pypy3) + PYTHON_PKG_DEP='dev-python/pypy3:0=';; + *) + die "Invalid implementation: ${impl}" + esac + fi # use-dep if [[ ${PYTHON_REQ_USE} ]]; then -- 2.26.2