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 12/20] python-utils-r2.eclass: Remove PYTHON_INCLUDEDIR export
Date: Thu, 05 Mar 2020 15:15:23
Message-Id: 20200305151024.125834-13-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 | 30 ++++++++++++------------------
4 eclass/tests/python-utils-r2.sh | 10 +++++-----
5 2 files changed, 17 insertions(+), 23 deletions(-)
6
7 diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
8 index 4f9df6000e16..1a91beea70bb 100644
9 --- a/eclass/python-utils-r2.eclass
10 +++ b/eclass/python-utils-r2.eclass
11 @@ -271,17 +271,6 @@ _python_export() {
12 export PYTHON=${EPREFIX}/usr/bin/${impl}
13 debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
14 ;;
15 - PYTHON_INCLUDEDIR)
16 - [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
17 - PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())') || die
18 - export PYTHON_INCLUDEDIR
19 - debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
20 -
21 - # Jython gives a non-existing directory
22 - if [[ ! -d ${PYTHON_INCLUDEDIR} ]]; then
23 - die "${impl} does not install any header files!"
24 - fi
25 - ;;
26 PYTHON_LIBPATH)
27 [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
28 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
29 @@ -395,15 +384,21 @@ python_get_sitedir() {
30 }
31
32 # @FUNCTION: python_get_includedir
33 -# @USAGE: [<impl>]
34 # @DESCRIPTION:
35 -# Obtain and print the include path for the given implementation. If no
36 -# implementation is provided, ${EPYTHON} will be used.
37 +# Obtain and print the include path for ${EPYTHON}.
38 python_get_includedir() {
39 debug-print-function ${FUNCNAME} "${@}"
40 + [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
41
42 - _python_export "${@}" PYTHON_INCLUDEDIR
43 - echo "${PYTHON_INCLUDEDIR}"
44 + local out=$("${EPYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())') || die
45 + debug-print "${FUNCNAME} -> ${out}"
46 +
47 + # Jython gives a non-existing directory
48 + if [[ ! -d ${out} ]]; then
49 + die "${EPYTHON} does not install any header files!"
50 + fi
51 +
52 + echo "${out}"
53 }
54
55 # @FUNCTION: python_get_library_path
56 @@ -809,8 +804,7 @@ python_doheader() {
57
58 [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
59
60 - local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR}
61 - [[ ${PYTHON_INCLUDEDIR} ]] || _python_export PYTHON_INCLUDEDIR
62 + local d PYTHON_INCLUDEDIR=$(python_get_includedir)
63
64 d=${PYTHON_INCLUDEDIR#${EPREFIX}}
65
66 diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
67 index 423a0465d39a..a6221a625c50 100755
68 --- a/eclass/tests/python-utils-r2.sh
69 +++ b/eclass/tests/python-utils-r2.sh
70 @@ -77,7 +77,7 @@ test_var EPYTHON python2_7 python2.7
71 test_var PYTHON python2_7 /usr/bin/python2.7
72 if [[ -x /usr/bin/python2.7 ]]; then
73 test_get sitedir python2.7 "/usr/lib*/python2.7/site-packages"
74 - test_var PYTHON_INCLUDEDIR python2_7 /usr/include/python2.7
75 + test_get includedir python2.7 /usr/include/python2.7
76 test_var PYTHON_LIBPATH 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 @@ -91,7 +91,7 @@ test_var PYTHON python3_6 /usr/bin/python3.6
80 if [[ -x /usr/bin/python3.6 ]]; then
81 abiflags=$(/usr/bin/python3.6 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
82 test_get sitedir python3.6 "/usr/lib*/python3.6/site-packages"
83 - test_var PYTHON_INCLUDEDIR python3_6 "/usr/include/python3.6${abiflags}"
84 + test_get includedir python3.6 "/usr/include/python3.6${abiflags}"
85 test_var PYTHON_LIBPATH 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 @@ -105,7 +105,7 @@ test_var PYTHON python3_7 /usr/bin/python3.7
89 if [[ -x /usr/bin/python3.7 ]]; then
90 abiflags=$(/usr/bin/python3.7 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
91 test_get sitedir python3.7 "/usr/lib/python3.7/site-packages"
92 - test_var PYTHON_INCLUDEDIR python3_7 "/usr/include/python3.7${abiflags}"
93 + test_get includedir python3.7 "/usr/include/python3.7${abiflags}"
94 test_var PYTHON_LIBPATH 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 @@ -126,7 +126,7 @@ test_var EPYTHON pypy pypy
98 test_var PYTHON pypy /usr/bin/pypy
99 if [[ -x /usr/bin/pypy ]]; then
100 test_get sitedir pypy "/usr/lib*/pypy2.7/site-packages"
101 - test_var PYTHON_INCLUDEDIR pypy "/usr/lib*/pypy2.7/include"
102 + test_get includedir pypy "/usr/lib*/pypy2.7/include"
103 fi
104 test_var PYTHON_PKG_DEP pypy '*dev-python/pypy*:0='
105 test_var PYTHON_SCRIPTDIR pypy /usr/lib/python-exec/pypy
106 @@ -135,7 +135,7 @@ test_var EPYTHON pypy3 pypy3
107 test_var PYTHON pypy3 /usr/bin/pypy3
108 if [[ -x /usr/bin/pypy3 ]]; then
109 test_get sitedir pypy3 "/usr/lib*/pypy3.?/site-packages"
110 - test_var PYTHON_INCLUDEDIR pypy3 "/usr/lib*/pypy3.?/include"
111 + test_get includedir pypy3 "/usr/lib*/pypy3.?/include"
112 fi
113 test_var PYTHON_PKG_DEP pypy3 '*dev-python/pypy3*:0='
114 test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3
115 --
116 2.25.1