[prev in list] [next in list] [prev in thread] [next in thread]
List: gentoo-dev
Subject: [gentoo-dev] [PATCH 16/25] python-utils-r2.eclass: Remove PYTHON_CFLAGS export
From: Michał Górny <mgorny () gentoo ! org>
Date: 2020-02-29 20:41:52
Message-ID: 20200229204201.99290-17-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 edf030b24683..dc5c8dafd12c 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_CFLAGS)
- local val
-
- case "${impl}" in
- python*)
- # python-2.7, python-3.2, etc.
- val=$($(tc-getPKG_CONFIG) --cflags ${impl/n/n-}) || die
- ;;
- *)
- die "${impl}: obtaining ${var} not supported"
- ;;
- esac
-
- export PYTHON_CFLAGS=${val}
- debug-print "${FUNCNAME}: PYTHON_CFLAGS = ${PYTHON_CFLAGS}"
- ;;
PYTHON_LIBS)
local val
@@ -409,20 +393,30 @@ python_get_library_path() {
}
# @FUNCTION: python_get_CFLAGS
-# @USAGE: [<impl>]
# @DESCRIPTION:
# Obtain and print the compiler flags for building 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_CFLAGS() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
- _python_export "${@}" PYTHON_CFLAGS
- echo "${PYTHON_CFLAGS}"
+ local out
+ case ${EPYTHON} in
+ python*)
+ # python-2.7, python-3.2, etc.
+ out=$($(tc-getPKG_CONFIG) --cflags ${EPYTHON/n/n-}) || die
+ ;;
+ *)
+ die "${impl}: obtaining CFLAGS not supported"
+ ;;
+ esac
+
+ debug-print "${FUNCNAME} -> ${out}"
+ echo "${out}"
}
# @FUNCTION: python_get_LIBS
diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
index cba74b84c70a..fd0883376ab7 100755
--- a/eclass/tests/python-utils-r2.sh
+++ b/eclass/tests/python-utils-r2.sh
@@ -80,7 +80,7 @@ if [[ -x /usr/bin/python2.7 ]]; then
test_get includedir python2.7 /usr/include/python2.7
test_get library_path python2.7 "/usr/lib*/libpython2.7$(get_libname)"
test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config
- test_var PYTHON_CFLAGS python2_7 "*-I/usr/include/python2.7*"
+ test_get CFLAGS python2.7 "*-I/usr/include/python2.7*"
test_var PYTHON_LIBS python2_7 "*-lpython2.7*"
fi
test_var PYTHON_PKG_DEP python2_7 '*dev-lang/python*:2.7'
@@ -94,7 +94,7 @@ if [[ -x /usr/bin/python3.6 ]]; then
test_get includedir python3.6 "/usr/include/python3.6${abiflags}"
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_var PYTHON_CFLAGS python3_6 "*-I/usr/include/python3.6*"
+ test_get CFLAGS python3.6 "*-I/usr/include/python3.6*"
test_var PYTHON_LIBS python3_6 "*-lpython3.6*"
fi
test_var PYTHON_PKG_DEP python3_6 '*dev-lang/python*:3.6'
@@ -108,7 +108,7 @@ if [[ -x /usr/bin/python3.7 ]]; then
test_get includedir python3.7 "/usr/include/python3.7${abiflags}"
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_var PYTHON_CFLAGS python3_7 "*-I/usr/include/python3.7*"
+ test_get CFLAGS python3.7 "*-I/usr/include/python3.7*"
test_var PYTHON_LIBS python3_7 "*-lpython3.7*"
fi
test_var PYTHON_PKG_DEP python3_7 '*dev-lang/python*:3.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