[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    [gentoo-dev] [PATCH 17/25] python-utils-r2.eclass: Remove PYTHON_LIBS export
From:       Michał Górny <mgorny () gentoo ! org>
Date:       2020-02-29 20:41:53
Message-ID: 20200229204201.99290-18-mgorny () gentoo ! org
[Download RAW message or body]

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/python-utils-r2.eclass   | 36 ++++++++++++++-------------------
 eclass/tests/python-utils-r2.sh |  6 +++---
 2 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index dc5c8dafd12c..00bc635ebab4 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -268,22 +268,6 @@ _python_export() {
 				export PYTHON=${EPREFIX}/usr/bin/${impl}
 				debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
 				;;
-			PYTHON_LIBS)
-				local val
-
-				case "${impl}" in
-					python*)
-						# python-2.7, python-3.2, etc.
-						val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}) || die
-						;;
-					*)
-						die "${impl}: obtaining ${var} not supported"
-						;;
-				esac
-
-				export PYTHON_LIBS=${val}
-				debug-print "${FUNCNAME}: PYTHON_LIBS = ${PYTHON_LIBS}"
-				;;
 			PYTHON_CONFIG)
 				local flags val
 
@@ -420,20 +404,30 @@ python_get_CFLAGS() {
 }
 
 # @FUNCTION: python_get_LIBS
-# @USAGE: [<impl>]
 # @DESCRIPTION:
 # Obtain and print the compiler flags for linking against Python,
-# for the given implementation. If no implementation is provided,
-# ${EPYTHON} will be used.
+# for ${EPYTHON}.
 #
 # Please note that this function can be used with CPython only.
 # It requires Python and pkg-config installed, and therefore proper
 # build-time dependencies need be added to the ebuild.
 python_get_LIBS() {
 	debug-print-function ${FUNCNAME} "${@}"
+	[[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
+
+	local out
+	case ${EPYTHON} in
+		python*)
+			# python-2.7, python-3.2, etc.
+			out=$($(tc-getPKG_CONFIG) --libs ${EPYTHON/n/n-}) || die
+			;;
+		*)
+			die "${EPYTHON}: obtaining LIBS not supported"
+			;;
+	esac
 
-	_python_export "${@}" PYTHON_LIBS
-	echo "${PYTHON_LIBS}"
+	debug-print "${FUNCNAME} -> ${out}"
+	echo "${out}"
 }
 
 # @FUNCTION: python_get_PYTHON_CONFIG
diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
index fd0883376ab7..8758f6d20464 100755
--- a/eclass/tests/python-utils-r2.sh
+++ b/eclass/tests/python-utils-r2.sh
@@ -81,7 +81,7 @@ if [[ -x /usr/bin/python2.7 ]]; then
 	test_get library_path python2.7 "/usr/lib*/libpython2.7$(get_libname)"
 	test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config
 	test_get CFLAGS python2.7 "*-I/usr/include/python2.7*"
-	test_var PYTHON_LIBS python2_7 "*-lpython2.7*"
+	test_get LIBS python2.7 "*-lpython2.7*"
 fi
 test_var PYTHON_PKG_DEP python2_7 '*dev-lang/python*:2.7'
 test_var PYTHON_SCRIPTDIR python2_7 /usr/lib/python-exec/python2.7
@@ -95,7 +95,7 @@ if [[ -x /usr/bin/python3.6 ]]; then
 	test_get library_path python3.6 "/usr/lib*/libpython3.6${abiflags}$(get_libname)"
 	test_var PYTHON_CONFIG python3_6 "/usr/bin/python3.6${abiflags}-config"
 	test_get CFLAGS python3.6 "*-I/usr/include/python3.6*"
-	test_var PYTHON_LIBS python3_6 "*-lpython3.6*"
+	test_get LIBS python3.6 "*-lpython3.6*"
 fi
 test_var PYTHON_PKG_DEP python3_6 '*dev-lang/python*:3.6'
 test_var PYTHON_SCRIPTDIR python3_6 /usr/lib/python-exec/python3.6
@@ -109,7 +109,7 @@ if [[ -x /usr/bin/python3.7 ]]; then
 	test_get library_path python3.7 "/usr/lib*/libpython3.7${abiflags}$(get_libname)"
 	test_var PYTHON_CONFIG python3_7 "/usr/bin/python3.7${abiflags}-config"
 	test_get CFLAGS python3.7 "*-I/usr/include/python3.7*"
-	test_var PYTHON_LIBS python3_7 "*-lpython3.7*"
+	test_get LIBS python3.7 "*-lpython3.7*"
 fi
 test_var PYTHON_PKG_DEP python3_7 '*dev-lang/python*:3.7'
 test_var PYTHON_SCRIPTDIR python3_7 /usr/lib/python-exec/python3.7
-- 
2.25.1


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic