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 16/20] python-utils-r2.eclass: Remove PYTHON_CONFIG export
Date: Thu, 05 Mar 2020 15:16:43
Message-Id: 20200305151024.125834-17-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 | 41 +++++++++++++++------------------
4 eclass/tests/python-utils-r2.sh | 6 ++---
5 2 files changed, 21 insertions(+), 26 deletions(-)
6
7 diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
8 index 7f4178da09d6..026ef907a880 100644
9 --- a/eclass/python-utils-r2.eclass
10 +++ b/eclass/python-utils-r2.eclass
11 @@ -271,23 +271,6 @@ _python_export() {
12 export PYTHON=${EPREFIX}/usr/bin/${impl}
13 debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
14 ;;
15 - PYTHON_CONFIG)
16 - local flags val
17 -
18 - case "${impl}" in
19 - python*)
20 - [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
21 - flags=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS") or "")') || die
22 - val=${PYTHON}${flags}-config
23 - ;;
24 - *)
25 - die "${impl}: obtaining ${var} not supported"
26 - ;;
27 - esac
28 -
29 - export PYTHON_CONFIG=${val}
30 - debug-print "${FUNCNAME}: PYTHON_CONFIG = ${PYTHON_CONFIG}"
31 - ;;
32 PYTHON_PKG_DEP)
33 local d
34 case ${impl} in
35 @@ -434,20 +417,32 @@ python_get_LIBS() {
36 }
37
38 # @FUNCTION: python_get_PYTHON_CONFIG
39 -# @USAGE: [<impl>]
40 # @DESCRIPTION:
41 -# Obtain and print the PYTHON_CONFIG location for the given
42 -# implementation. If no implementation is provided, ${EPYTHON} will be
43 -# used.
44 +# Obtain and print the PYTHON_CONFIG location for ${EPYTHON}.
45 #
46 # Please note that this function can be used with CPython only.
47 # It requires Python installed, and therefore proper build-time
48 # dependencies need be added to the ebuild.
49 python_get_PYTHON_CONFIG() {
50 debug-print-function ${FUNCNAME} "${@}"
51 + [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
52 +
53 + local flags out
54 + local PYTHON
55 + _python_export PYTHON
56
57 - _python_export "${@}" PYTHON_CONFIG
58 - echo "${PYTHON_CONFIG}"
59 + case ${EPYTHON} in
60 + python*)
61 + flags=$("${EPYTHON}" -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS") or "")') || die
62 + out=${PYTHON}${flags}-config
63 + ;;
64 + *)
65 + die "${EPYTHON}: obtaining PYTHON_CONFIG not supported"
66 + ;;
67 + esac
68 +
69 + debug-print "${FUNCNAME} -> ${out}"
70 + echo "${out}"
71 }
72
73 # @FUNCTION: python_get_scriptdir
74 diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
75 index 8758f6d20464..0b41a7bcdb53 100755
76 --- a/eclass/tests/python-utils-r2.sh
77 +++ b/eclass/tests/python-utils-r2.sh
78 @@ -79,7 +79,7 @@ if [[ -x /usr/bin/python2.7 ]]; then
79 test_get sitedir python2.7 "/usr/lib*/python2.7/site-packages"
80 test_get includedir python2.7 /usr/include/python2.7
81 test_get library_path python2.7 "/usr/lib*/libpython2.7$(get_libname)"
82 - test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config
83 + test_get PYTHON_CONFIG python2.7 /usr/bin/python2.7-config
84 test_get CFLAGS python2.7 "*-I/usr/include/python2.7*"
85 test_get LIBS python2.7 "*-lpython2.7*"
86 fi
87 @@ -93,7 +93,7 @@ if [[ -x /usr/bin/python3.6 ]]; then
88 test_get sitedir python3.6 "/usr/lib*/python3.6/site-packages"
89 test_get includedir python3.6 "/usr/include/python3.6${abiflags}"
90 test_get library_path python3.6 "/usr/lib*/libpython3.6${abiflags}$(get_libname)"
91 - test_var PYTHON_CONFIG python3_6 "/usr/bin/python3.6${abiflags}-config"
92 + test_get PYTHON_CONFIG python3.6 "/usr/bin/python3.6${abiflags}-config"
93 test_get CFLAGS python3.6 "*-I/usr/include/python3.6*"
94 test_get LIBS python3.6 "*-lpython3.6*"
95 fi
96 @@ -107,7 +107,7 @@ if [[ -x /usr/bin/python3.7 ]]; then
97 test_get sitedir python3.7 "/usr/lib/python3.7/site-packages"
98 test_get includedir python3.7 "/usr/include/python3.7${abiflags}"
99 test_get library_path python3.7 "/usr/lib*/libpython3.7${abiflags}$(get_libname)"
100 - test_var PYTHON_CONFIG python3_7 "/usr/bin/python3.7${abiflags}-config"
101 + test_get PYTHON_CONFIG python3.7 "/usr/bin/python3.7${abiflags}-config"
102 test_get CFLAGS python3.7 "*-I/usr/include/python3.7*"
103 test_get LIBS python3.7 "*-lpython3.7*"
104 fi
105 --
106 2.25.1