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 v2 15/20] python-utils-r2.eclass: Remove PYTHON_LIBS export
Date: Thu, 05 Mar 2020 15:16:23
Message-Id: 20200305151024.125834-16-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH v2 00/20] python-r2 suite by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 eclass/python-utils-r2.eclass | 36 ++++++++++++++-------------------
4 eclass/tests/python-utils-r2.sh | 6 +++---
5 2 files changed, 18 insertions(+), 24 deletions(-)
6
7 diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
8 index 2aa063152e3e..7f4178da09d6 100644
9 --- a/eclass/python-utils-r2.eclass
10 +++ b/eclass/python-utils-r2.eclass
11 @@ -271,22 +271,6 @@ _python_export() {
12 export PYTHON=${EPREFIX}/usr/bin/${impl}
13 debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
14 ;;
15 - PYTHON_LIBS)
16 - local val
17 -
18 - case "${impl}" in
19 - python*)
20 - # python-2.7, python-3.2, etc.
21 - val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}) || die
22 - ;;
23 - *)
24 - die "${impl}: obtaining ${var} not supported"
25 - ;;
26 - esac
27 -
28 - export PYTHON_LIBS=${val}
29 - debug-print "${FUNCNAME}: PYTHON_LIBS = ${PYTHON_LIBS}"
30 - ;;
31 PYTHON_CONFIG)
32 local flags val
33
34 @@ -423,20 +407,30 @@ python_get_CFLAGS() {
35 }
36
37 # @FUNCTION: python_get_LIBS
38 -# @USAGE: [<impl>]
39 # @DESCRIPTION:
40 # Obtain and print the compiler flags for linking against Python,
41 -# for the given implementation. If no implementation is provided,
42 -# ${EPYTHON} will be used.
43 +# for ${EPYTHON}.
44 #
45 # Please note that this function can be used with CPython only.
46 # It requires Python and pkg-config installed, and therefore proper
47 # build-time dependencies need be added to the ebuild.
48 python_get_LIBS() {
49 debug-print-function ${FUNCNAME} "${@}"
50 + [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
51 +
52 + local out
53 + case ${EPYTHON} in
54 + python*)
55 + # python-2.7, python-3.2, etc.
56 + out=$($(tc-getPKG_CONFIG) --libs ${EPYTHON/n/n-}) || die
57 + ;;
58 + *)
59 + die "${EPYTHON}: obtaining LIBS not supported"
60 + ;;
61 + esac
62
63 - _python_export "${@}" PYTHON_LIBS
64 - echo "${PYTHON_LIBS}"
65 + debug-print "${FUNCNAME} -> ${out}"
66 + echo "${out}"
67 }
68
69 # @FUNCTION: python_get_PYTHON_CONFIG
70 diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
71 index fd0883376ab7..8758f6d20464 100755
72 --- a/eclass/tests/python-utils-r2.sh
73 +++ b/eclass/tests/python-utils-r2.sh
74 @@ -81,7 +81,7 @@ if [[ -x /usr/bin/python2.7 ]]; then
75 test_get library_path python2.7 "/usr/lib*/libpython2.7$(get_libname)"
76 test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config
77 test_get CFLAGS python2.7 "*-I/usr/include/python2.7*"
78 - test_var PYTHON_LIBS python2_7 "*-lpython2.7*"
79 + test_get LIBS python2.7 "*-lpython2.7*"
80 fi
81 test_var PYTHON_PKG_DEP python2_7 '*dev-lang/python*:2.7'
82 test_var PYTHON_SCRIPTDIR python2_7 /usr/lib/python-exec/python2.7
83 @@ -95,7 +95,7 @@ if [[ -x /usr/bin/python3.6 ]]; then
84 test_get library_path python3.6 "/usr/lib*/libpython3.6${abiflags}$(get_libname)"
85 test_var PYTHON_CONFIG python3_6 "/usr/bin/python3.6${abiflags}-config"
86 test_get CFLAGS python3.6 "*-I/usr/include/python3.6*"
87 - test_var PYTHON_LIBS python3_6 "*-lpython3.6*"
88 + test_get LIBS python3.6 "*-lpython3.6*"
89 fi
90 test_var PYTHON_PKG_DEP python3_6 '*dev-lang/python*:3.6'
91 test_var PYTHON_SCRIPTDIR python3_6 /usr/lib/python-exec/python3.6
92 @@ -109,7 +109,7 @@ if [[ -x /usr/bin/python3.7 ]]; then
93 test_get library_path python3.7 "/usr/lib*/libpython3.7${abiflags}$(get_libname)"
94 test_var PYTHON_CONFIG python3_7 "/usr/bin/python3.7${abiflags}-config"
95 test_get CFLAGS python3.7 "*-I/usr/include/python3.7*"
96 - test_var PYTHON_LIBS python3_7 "*-lpython3.7*"
97 + test_get LIBS python3.7 "*-lpython3.7*"
98 fi
99 test_var PYTHON_PKG_DEP python3_7 '*dev-lang/python*:3.7'
100 test_var PYTHON_SCRIPTDIR python3_7 /usr/lib/python-exec/python3.7
101 --
102 2.25.1