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 14/20] python-utils-r2.eclass: Remove PYTHON_CFLAGS export
Date: Thu, 05 Mar 2020 15:16:03
Message-Id: 20200305151024.125834-15-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 eb3f2c7e5b14..2aa063152e3e 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_CFLAGS)
16 - local val
17 -
18 - case "${impl}" in
19 - python*)
20 - # python-2.7, python-3.2, etc.
21 - val=$($(tc-getPKG_CONFIG) --cflags ${impl/n/n-}) || die
22 - ;;
23 - *)
24 - die "${impl}: obtaining ${var} not supported"
25 - ;;
26 - esac
27 -
28 - export PYTHON_CFLAGS=${val}
29 - debug-print "${FUNCNAME}: PYTHON_CFLAGS = ${PYTHON_CFLAGS}"
30 - ;;
31 PYTHON_LIBS)
32 local val
33
34 @@ -412,20 +396,30 @@ python_get_library_path() {
35 }
36
37 # @FUNCTION: python_get_CFLAGS
38 -# @USAGE: [<impl>]
39 # @DESCRIPTION:
40 # Obtain and print the compiler flags for building 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_CFLAGS() {
49 debug-print-function ${FUNCNAME} "${@}"
50 + [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
51
52 - _python_export "${@}" PYTHON_CFLAGS
53 - echo "${PYTHON_CFLAGS}"
54 + local out
55 + case ${EPYTHON} in
56 + python*)
57 + # python-2.7, python-3.2, etc.
58 + out=$($(tc-getPKG_CONFIG) --cflags ${EPYTHON/n/n-}) || die
59 + ;;
60 + *)
61 + die "${impl}: obtaining CFLAGS not supported"
62 + ;;
63 + esac
64 +
65 + debug-print "${FUNCNAME} -> ${out}"
66 + echo "${out}"
67 }
68
69 # @FUNCTION: python_get_LIBS
70 diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
71 index cba74b84c70a..fd0883376ab7 100755
72 --- a/eclass/tests/python-utils-r2.sh
73 +++ b/eclass/tests/python-utils-r2.sh
74 @@ -80,7 +80,7 @@ if [[ -x /usr/bin/python2.7 ]]; then
75 test_get includedir python2.7 /usr/include/python2.7
76 test_get library_path python2.7 "/usr/lib*/libpython2.7$(get_libname)"
77 test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config
78 - test_var PYTHON_CFLAGS python2_7 "*-I/usr/include/python2.7*"
79 + test_get CFLAGS python2.7 "*-I/usr/include/python2.7*"
80 test_var PYTHON_LIBS python2_7 "*-lpython2.7*"
81 fi
82 test_var PYTHON_PKG_DEP python2_7 '*dev-lang/python*:2.7'
83 @@ -94,7 +94,7 @@ if [[ -x /usr/bin/python3.6 ]]; then
84 test_get includedir python3.6 "/usr/include/python3.6${abiflags}"
85 test_get library_path python3.6 "/usr/lib*/libpython3.6${abiflags}$(get_libname)"
86 test_var PYTHON_CONFIG python3_6 "/usr/bin/python3.6${abiflags}-config"
87 - test_var PYTHON_CFLAGS python3_6 "*-I/usr/include/python3.6*"
88 + test_get CFLAGS python3.6 "*-I/usr/include/python3.6*"
89 test_var PYTHON_LIBS python3_6 "*-lpython3.6*"
90 fi
91 test_var PYTHON_PKG_DEP python3_6 '*dev-lang/python*:3.6'
92 @@ -108,7 +108,7 @@ if [[ -x /usr/bin/python3.7 ]]; then
93 test_get includedir python3.7 "/usr/include/python3.7${abiflags}"
94 test_get library_path python3.7 "/usr/lib*/libpython3.7${abiflags}$(get_libname)"
95 test_var PYTHON_CONFIG python3_7 "/usr/bin/python3.7${abiflags}-config"
96 - test_var PYTHON_CFLAGS python3_7 "*-I/usr/include/python3.7*"
97 + test_get CFLAGS python3.7 "*-I/usr/include/python3.7*"
98 test_var PYTHON_LIBS python3_7 "*-lpython3.7*"
99 fi
100 test_var PYTHON_PKG_DEP python3_7 '*dev-lang/python*:3.7'
101 --
102 2.25.1