From 01e902405dd6552763cf66e4077f801a65bc244b Mon Sep 17 00:00:00 2001
From: Michał Górny <mgorny@gentoo.org>
Date: Fri, 11 Dec 2015 22:26:45 +0100
Subject: python*-r1.eclass: Replace non-portable use of 'declare -g'

Replace uses of 'declare -g -r' (bash-4.2+) with 'readonly'. Reported
by Arfrever. This time use split assignments followed by readonly calls
since combined calls work unreliably.
---
 eclass/python-any-r1.eclass    | 3 ++-
 eclass/python-r1.eclass        | 6 +++---
 eclass/python-single-r1.eclass | 4 ++--
 eclass/python-utils-r1.eclass  | 3 ++-
 4 files changed, 9 insertions(+), 7 deletions(-)

(limited to 'eclass')

diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
index 82ead76edf18..721ba4520625 100644
--- a/eclass/python-any-r1.eclass
+++ b/eclass/python-any-r1.eclass
@@ -133,7 +133,8 @@ _python_any_set_globals() {
 
 		PYTHON_DEPS="${PYTHON_PKG_DEP} ${PYTHON_DEPS}"
 	done
-	declare -g -r PYTHON_DEPS="|| ( ${PYTHON_DEPS})"
+	PYTHON_DEPS="|| ( ${PYTHON_DEPS})"
+	readonly PYTHON_DEPS
 }
 _python_any_set_globals
 unset -f _python_any_set_globals
diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index 4b9c6f36e55d..fbc39dceaa83 100644
--- a/eclass/python-r1.eclass
+++ b/eclass/python-r1.eclass
@@ -216,8 +216,8 @@ _python_set_globals() {
 	optflags+=,${flags_st[@]/%/(-)}
 
 	IUSE=${flags[*]}
-	declare -g -r PYTHON_REQUIRED_USE="|| ( ${flags[*]} )"
-	declare -g -r PYTHON_USEDEP=${optflags// /,}
+	PYTHON_REQUIRED_USE="|| ( ${flags[*]} )"
+	PYTHON_USEDEP=${optflags// /,}
 
 	# 1) well, python-exec would suffice as an RDEP
 	# but no point in making this overcomplex, BDEP doesn't hurt anyone
@@ -232,7 +232,7 @@ _python_set_globals() {
 	else
 		PYTHON_DEPS+="dev-lang/python-exec:2[${PYTHON_USEDEP}]"
 	fi
-	readonly PYTHON_DEPS
+	readonly PYTHON_DEPS PYTHON_REQUIRED_USE PYTHON_USEDEP
 }
 _python_set_globals
 unset -f _python_set_globals
diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
index 158229503f99..b8684f024099 100644
--- a/eclass/python-single-r1.eclass
+++ b/eclass/python-single-r1.eclass
@@ -238,7 +238,7 @@ _python_single_set_globals() {
 			PYTHON_DEPS+="python_single_target_${i}? ( ${PYTHON_PKG_DEP} ) "
 		done
 	fi
-	declare -g -r PYTHON_USEDEP=${optflags// /,}
+	PYTHON_USEDEP=${optflags// /,}
 
 	# 1) well, python-exec would suffice as an RDEP
 	# but no point in making this overcomplex, BDEP doesn't hurt anyone
@@ -253,7 +253,7 @@ _python_single_set_globals() {
 	else
 		PYTHON_DEPS+="dev-lang/python-exec:2[${PYTHON_USEDEP}]"
 	fi
-	readonly PYTHON_DEPS PYTHON_REQUIRED_USE
+	readonly PYTHON_DEPS PYTHON_REQUIRED_USE PYTHON_USEDEP
 }
 _python_single_set_globals
 unset -f _python_single_set_globals
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index cf0e13496245..7830323abc05 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -40,12 +40,13 @@ inherit toolchain-funcs
 # @INTERNAL
 # @DESCRIPTION:
 # All supported Python implementations, most preferred last.
-declare -g -r _PYTHON_ALL_IMPLS=(
+_PYTHON_ALL_IMPLS=(
 	python2_7
 	python3_3 python3_4 python3_5
 	pypy pypy3
 	jython2_7
 )
+readonly _PYTHON_ALL_IMPLS
 
 # @FUNCTION: _python_impl_supported
 # @USAGE: <impl>
-- 
cgit v1.2.3-65-gdbad