From 9d683e6e8c036b5a2c61529a3c4c9c84295b62ba Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Wed, 1 Mar 2017 10:08:20 +0100 Subject: python-single-r1.eclass: Refactor global setter to use locals, NFC --- eclass/python-single-r1.eclass | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'eclass') diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass index 84d1f067be14..85350924b657 100644 --- a/eclass/python-single-r1.eclass +++ b/eclass/python-single-r1.eclass @@ -180,7 +180,6 @@ if [[ ! ${_PYTHON_SINGLE_R1} ]]; then _python_single_set_globals() { _python_set_impls - PYTHON_DEPS= local i PYTHON_PKG_DEP local flags_mt=( "${_PYTHON_SUPPORTED_IMPLS[@]/#/python_targets_}" ) @@ -191,12 +190,13 @@ _python_single_set_globals() { IUSE="${flags_mt[*]}" + local deps requse usedep if [[ ${#_PYTHON_SUPPORTED_IMPLS[@]} -eq 1 ]]; then # There is only one supported implementation; set IUSE and other # variables without PYTHON_SINGLE_TARGET. - PYTHON_REQUIRED_USE="${flags_mt[*]}" + requse=${flags_mt[*]} python_export "${_PYTHON_SUPPORTED_IMPLS[0]}" PYTHON_PKG_DEP - PYTHON_DEPS="${flags_mt[*]}? ( ${PYTHON_PKG_DEP} ) " + deps="${flags_mt[*]}? ( ${PYTHON_PKG_DEP} ) " # Force on the python_single_target_* flag for this impl, so # that any dependencies that inherit python-single-r1 and # happen to have multiple implementations will still need @@ -205,7 +205,7 @@ _python_single_set_globals() { else # Multiple supported implementations; honor PYTHON_SINGLE_TARGET. IUSE+=" ${flags[*]}" - PYTHON_REQUIRED_USE="^^ ( ${flags[*]} )" + requse="^^ ( ${flags[*]} )" # Ensure deps honor the same python_single_target_* flag as is set # on this package. optflags+=,${flags[@]/%/(+)?} @@ -214,13 +214,13 @@ _python_single_set_globals() { # The chosen targets need to be in PYTHON_TARGETS as well. # This is in order to enforce correct dependencies on packages # supporting multiple implementations. - PYTHON_REQUIRED_USE+=" python_single_target_${i}? ( python_targets_${i} )" + requse+=" python_single_target_${i}? ( python_targets_${i} )" python_export "${i}" PYTHON_PKG_DEP - PYTHON_DEPS+="python_single_target_${i}? ( ${PYTHON_PKG_DEP} ) " + deps+="python_single_target_${i}? ( ${PYTHON_PKG_DEP} ) " done fi - PYTHON_USEDEP=${optflags// /,} + usedep=${optflags// /,} # 1) well, python-exec would suffice as an RDEP # but no point in making this overcomplex, BDEP doesn't hurt anyone @@ -229,8 +229,12 @@ _python_single_set_globals() { if [[ ${_PYTHON_WANT_PYTHON_EXEC2} == 0 ]]; then die "python-exec:0 is no longer supported, please fix your ebuild to work with python-exec:2" else - PYTHON_DEPS+=">=dev-lang/python-exec-2:=[${PYTHON_USEDEP}]" + deps+=">=dev-lang/python-exec-2:=[${usedep}]" fi + + PYTHON_DEPS=${deps} + PYTHON_REQUIRED_USE=${requse} + PYTHON_USEDEP=${usedep} readonly PYTHON_DEPS PYTHON_REQUIRED_USE PYTHON_USEDEP } _python_single_set_globals -- cgit v1.2.3-65-gdbad