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 15/25] python-utils-r2.eclass: Remove PYTHON_LIBPATH export
Date: Sat, 29 Feb 2020 20:47:17
Message-Id: 20200229204201.99290-16-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 00/25] python-r2 eclass suite by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 eclass/python-utils-r2.eclass | 25 ++++++++++---------------
4 eclass/tests/python-utils-r2.sh | 6 +++---
5 2 files changed, 13 insertions(+), 18 deletions(-)
6
7 diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
8 index 87c7dd506274..edf030b24683 100644
9 --- a/eclass/python-utils-r2.eclass
10 +++ b/eclass/python-utils-r2.eclass
11 @@ -268,16 +268,6 @@ _python_export() {
12 export PYTHON=${EPREFIX}/usr/bin/${impl}
13 debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
14 ;;
15 - PYTHON_LIBPATH)
16 - [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
17 - 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
18 - export PYTHON_LIBPATH
19 - debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}"
20 -
21 - if [[ ! ${PYTHON_LIBPATH} ]]; then
22 - die "${impl} lacks a (usable) dynamic library"
23 - fi
24 - ;;
25 PYTHON_CFLAGS)
26 local val
27
28 @@ -399,18 +389,23 @@ python_get_includedir() {
29 }
30
31 # @FUNCTION: python_get_library_path
32 -# @USAGE: [<impl>]
33 # @DESCRIPTION:
34 -# Obtain and print the Python library path for the given implementation.
35 -# If no implementation is provided, ${EPYTHON} will be used.
36 +# Obtain and print the Python library path for ${EPYTHON}.
37 #
38 # Please note that this function can be used with CPython only. Use
39 # in another implementation will result in a fatal failure.
40 python_get_library_path() {
41 debug-print-function ${FUNCNAME} "${@}"
42 + [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
43
44 - _python_export "${@}" PYTHON_LIBPATH
45 - echo "${PYTHON_LIBPATH}"
46 + 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
47 + debug-print "${FUNCNAME} -> ${out}"
48 +
49 + if [[ ! ${out} ]]; then
50 + die "${EPYTHON} lacks a (usable) dynamic library"
51 + fi
52 +
53 + echo "${out}"
54 }
55
56 # @FUNCTION: python_get_CFLAGS
57 diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
58 index a6221a625c50..cba74b84c70a 100755
59 --- a/eclass/tests/python-utils-r2.sh
60 +++ b/eclass/tests/python-utils-r2.sh
61 @@ -78,7 +78,7 @@ test_var PYTHON python2_7 /usr/bin/python2.7
62 if [[ -x /usr/bin/python2.7 ]]; then
63 test_get sitedir python2.7 "/usr/lib*/python2.7/site-packages"
64 test_get includedir python2.7 /usr/include/python2.7
65 - test_var PYTHON_LIBPATH python2_7 "/usr/lib*/libpython2.7$(get_libname)"
66 + test_get library_path python2.7 "/usr/lib*/libpython2.7$(get_libname)"
67 test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config
68 test_var PYTHON_CFLAGS python2_7 "*-I/usr/include/python2.7*"
69 test_var PYTHON_LIBS python2_7 "*-lpython2.7*"
70 @@ -92,7 +92,7 @@ if [[ -x /usr/bin/python3.6 ]]; then
71 abiflags=$(/usr/bin/python3.6 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
72 test_get sitedir python3.6 "/usr/lib*/python3.6/site-packages"
73 test_get includedir python3.6 "/usr/include/python3.6${abiflags}"
74 - test_var PYTHON_LIBPATH python3_6 "/usr/lib*/libpython3.6${abiflags}$(get_libname)"
75 + test_get library_path python3.6 "/usr/lib*/libpython3.6${abiflags}$(get_libname)"
76 test_var PYTHON_CONFIG python3_6 "/usr/bin/python3.6${abiflags}-config"
77 test_var PYTHON_CFLAGS python3_6 "*-I/usr/include/python3.6*"
78 test_var PYTHON_LIBS python3_6 "*-lpython3.6*"
79 @@ -106,7 +106,7 @@ if [[ -x /usr/bin/python3.7 ]]; then
80 abiflags=$(/usr/bin/python3.7 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
81 test_get sitedir python3.7 "/usr/lib/python3.7/site-packages"
82 test_get includedir python3.7 "/usr/include/python3.7${abiflags}"
83 - test_var PYTHON_LIBPATH python3_7 "/usr/lib*/libpython3.7${abiflags}$(get_libname)"
84 + test_get library_path python3.7 "/usr/lib*/libpython3.7${abiflags}$(get_libname)"
85 test_var PYTHON_CONFIG python3_7 "/usr/bin/python3.7${abiflags}-config"
86 test_var PYTHON_CFLAGS python3_7 "*-I/usr/include/python3.7*"
87 test_var PYTHON_LIBS python3_7 "*-lpython3.7*"
88 --
89 2.25.1