Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] python-utils-r1.eclass: Make python_wrapper_setup private
Date: Thu, 19 Mar 2020 21:26:38
Message-Id: 20200319212605.316447-1-mgorny@gentoo.org
This function was never meant to be a part of the public API.  Correct
the mistake by renaming it to _python_wrapper_setup(), and adding a QA
warning under the old name.

Signed-off-by: Michał Górny <mgorny@g.o>
---
 eclass/python-any-r1.eclass    |  8 ++++----
 eclass/python-r1.eclass        |  4 ++--
 eclass/python-single-r1.eclass |  4 ++--
 eclass/python-utils-r1.eclass  | 16 +++++++++++++++-
 4 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
index 66c6965c04ea..d16677debd2a 100644
--- a/eclass/python-any-r1.eclass
+++ b/eclass/python-any-r1.eclass
@@ -300,7 +300,7 @@ python_setup() {
 		ewarn "Dependencies won't be satisfied, and EPYTHON/eselect-python will be ignored."
 
 		python_export "${impls[0]}" EPYTHON PYTHON
-		python_wrapper_setup
+		_python_wrapper_setup
 		einfo "Using ${EPYTHON} to build"
 		return
 	fi
@@ -309,7 +309,7 @@ python_setup() {
 	if [[ ${EPYTHON} ]]; then
 		if _python_EPYTHON_supported "${EPYTHON}"; then
 			python_export EPYTHON PYTHON
-			python_wrapper_setup
+			_python_wrapper_setup
 			einfo "Using ${EPYTHON} to build"
 			return
 		fi
@@ -325,7 +325,7 @@ python_setup() {
 			break
 		elif _python_EPYTHON_supported "${i}"; then
 			python_export "${i}" EPYTHON PYTHON
-			python_wrapper_setup
+			_python_wrapper_setup
 			einfo "Using ${EPYTHON} to build"
 			return
 		fi
@@ -336,7 +336,7 @@ python_setup() {
 	for (( i = ${#_PYTHON_SUPPORTED_IMPLS[@]} - 1; i >= 0; i-- )); do
 		python_export "${_PYTHON_SUPPORTED_IMPLS[i]}" EPYTHON PYTHON
 		if _python_EPYTHON_supported "${EPYTHON}"; then
-			python_wrapper_setup
+			_python_wrapper_setup
 			einfo "Using ${EPYTHON} to build"
 			return
 		fi
diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index 960fed8c451a..3ac35e401217 100644
--- a/eclass/python-r1.eclass
+++ b/eclass/python-r1.eclass
@@ -638,7 +638,7 @@ _python_multibuild_wrapper() {
 	local -x EPYTHON PYTHON
 	local -x PATH=${PATH} PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
 	python_export "${MULTIBUILD_VARIANT}" EPYTHON PYTHON
-	python_wrapper_setup
+	_python_wrapper_setup
 
 	"${@}"
 }
@@ -784,7 +784,7 @@ python_setup() {
 		die "${FUNCNAME}: no enabled implementation satisfy requirements"
 	fi
 
-	python_wrapper_setup
+	_python_wrapper_setup
 	einfo "Using ${EPYTHON} in global scope"
 }
 
diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
index f9e26e7c334f..888db3631d9c 100644
--- a/eclass/python-single-r1.eclass
+++ b/eclass/python-single-r1.eclass
@@ -466,7 +466,7 @@ python_setup() {
 		ewarn "Dependencies won't be satisfied, and PYTHON_SINGLE_TARGET flags will be ignored."
 
 		python_export "${impls[0]}" EPYTHON PYTHON
-		python_wrapper_setup
+		_python_wrapper_setup
 		einfo "Using ${EPYTHON} to build"
 		return
 	fi
@@ -484,7 +484,7 @@ python_setup() {
 			fi
 
 			python_export "${impl}" EPYTHON PYTHON
-			python_wrapper_setup
+			_python_wrapper_setup
 			einfo "Using ${EPYTHON} to build"
 		fi
 	done
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index f144cbbb1279..d6fec6446320 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -950,6 +950,20 @@ python_doheader() {
 # @FUNCTION: python_wrapper_setup
 # @USAGE: [<path> [<impl>]]
 # @DESCRIPTION:
+# Backwards compatibility function.  The relevant API is now considered
+# private, please use python_setup instead.
+python_wrapper_setup() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	eqawarn "python_wrapper_setup() is part of private eclass API."
+	eqawarn "Please call python_setup() instead."
+
+	_python_wrapper_setup "${@}"
+}
+
+# @FUNCTION: _python_wrapper_setup
+# @USAGE: [<path> [<impl>]]
+# @DESCRIPTION:
 # Create proper 'python' executable and pkg-config wrappers
 # (if available) in the directory named by <path>. Set up PATH
 # and PKG_CONFIG_PATH appropriately. <path> defaults to ${T}/${EPYTHON}.
@@ -961,7 +975,7 @@ python_doheader() {
 # be assumed to contain proper wrappers already and only environment
 # setup will be done. If wrapper update is requested, the directory
 # shall be removed first.
-python_wrapper_setup() {
+_python_wrapper_setup() {
 	debug-print-function ${FUNCNAME} "${@}"
 
 	local workdir=${1:-${T}/${EPYTHON}}
-- 
2.25.2