[prev in list] [next in list] [prev in thread] [next in thread]
List: gentoo-dev
Subject: [gentoo-dev] [PATCH 15/25] python-utils-r2.eclass: Remove PYTHON_LIBPATH export
From: Michał Górny <mgorny () gentoo ! org>
Date: 2020-02-29 20:41:51
Message-ID: 20200229204201.99290-16-mgorny () gentoo ! org
[Download RAW message or body]
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/python-utils-r2.eclass | 25 ++++++++++---------------
eclass/tests/python-utils-r2.sh | 6 +++---
2 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index 87c7dd506274..edf030b24683 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -268,16 +268,6 @@ _python_export() {
export PYTHON=${EPREFIX}/usr/bin/${impl}
debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
;;
- PYTHON_LIBPATH)
- [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or \
requested before it"
- PYTHON_LIBPATH=$("${PYTHON}" -c 'import os.path, sysconfig; \
print(os.path.join(sysconfig.get_config_var("LIBDIR"), \
sysconfig.get_config_var("LDLIBRARY")) if sysconfig.get_config_var("LDLIBRARY") else \
"")') || die
- export PYTHON_LIBPATH
- debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}"
-
- if [[ ! ${PYTHON_LIBPATH} ]]; then
- die "${impl} lacks a (usable) dynamic library"
- fi
- ;;
PYTHON_CFLAGS)
local val
@@ -399,18 +389,23 @@ python_get_includedir() {
}
# @FUNCTION: python_get_library_path
-# @USAGE: [<impl>]
# @DESCRIPTION:
-# Obtain and print the Python library path for the given implementation.
-# If no implementation is provided, ${EPYTHON} will be used.
+# Obtain and print the Python library path for ${EPYTHON}.
#
# Please note that this function can be used with CPython only. Use
# in another implementation will result in a fatal failure.
python_get_library_path() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
- _python_export "${@}" PYTHON_LIBPATH
- echo "${PYTHON_LIBPATH}"
+ local out=$("${EPYTHON}" -c 'import os.path, sysconfig; \
print(os.path.join(sysconfig.get_config_var("LIBDIR"), \
sysconfig.get_config_var("LDLIBRARY")) if sysconfig.get_config_var("LDLIBRARY") else \
"")') || die + debug-print "${FUNCNAME} -> ${out}"
+
+ if [[ ! ${out} ]]; then
+ die "${EPYTHON} lacks a (usable) dynamic library"
+ fi
+
+ echo "${out}"
}
# @FUNCTION: python_get_CFLAGS
diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
index a6221a625c50..cba74b84c70a 100755
--- a/eclass/tests/python-utils-r2.sh
+++ b/eclass/tests/python-utils-r2.sh
@@ -78,7 +78,7 @@ test_var PYTHON python2_7 /usr/bin/python2.7
if [[ -x /usr/bin/python2.7 ]]; then
test_get sitedir python2.7 "/usr/lib*/python2.7/site-packages"
test_get includedir python2.7 /usr/include/python2.7
- test_var PYTHON_LIBPATH python2_7 "/usr/lib*/libpython2.7$(get_libname)"
+ 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_var PYTHON_LIBS python2_7 "*-lpython2.7*"
@@ -92,7 +92,7 @@ if [[ -x /usr/bin/python3.6 ]]; then
abiflags=$(/usr/bin/python3.6 -c 'import sysconfig; \
print(sysconfig.get_config_var("ABIFLAGS"))') test_get sitedir python3.6 \
"/usr/lib*/python3.6/site-packages" test_get includedir python3.6 \
"/usr/include/python3.6${abiflags}"
- test_var PYTHON_LIBPATH python3_6 "/usr/lib*/libpython3.6${abiflags}$(get_libname)"
+ 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_var PYTHON_LIBS python3_6 "*-lpython3.6*"
@@ -106,7 +106,7 @@ if [[ -x /usr/bin/python3.7 ]]; then
abiflags=$(/usr/bin/python3.7 -c 'import sysconfig; \
print(sysconfig.get_config_var("ABIFLAGS"))') test_get sitedir python3.7 \
"/usr/lib/python3.7/site-packages" test_get includedir python3.7 \
"/usr/include/python3.7${abiflags}"
- test_var PYTHON_LIBPATH python3_7 "/usr/lib*/libpython3.7${abiflags}$(get_libname)"
+ 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_var PYTHON_LIBS python3_7 "*-lpython3.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