public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: python@gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH v2 12/20] python-utils-r2.eclass: Remove PYTHON_INCLUDEDIR export
Date: Thu,  5 Mar 2020 16:10:16 +0100	[thread overview]
Message-ID: <20200305151024.125834-13-mgorny@gentoo.org> (raw)
In-Reply-To: <20200305151024.125834-1-mgorny@gentoo.org>

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/python-utils-r2.eclass   | 30 ++++++++++++------------------
 eclass/tests/python-utils-r2.sh | 10 +++++-----
 2 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index 4f9df6000e16..1a91beea70bb 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -271,17 +271,6 @@ _python_export() {
 				export PYTHON=${EPREFIX}/usr/bin/${impl}
 				debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
 				;;
-			PYTHON_INCLUDEDIR)
-				[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
-				PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())') || die
-				export PYTHON_INCLUDEDIR
-				debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
-
-				# Jython gives a non-existing directory
-				if [[ ! -d ${PYTHON_INCLUDEDIR} ]]; then
-					die "${impl} does not install any header files!"
-				fi
-				;;
 			PYTHON_LIBPATH)
 				[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
 				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
@@ -395,15 +384,21 @@ python_get_sitedir() {
 }
 
 # @FUNCTION: python_get_includedir
-# @USAGE: [<impl>]
 # @DESCRIPTION:
-# Obtain and print the include path for the given implementation. If no
-# implementation is provided, ${EPYTHON} will be used.
+# Obtain and print the include path for ${EPYTHON}.
 python_get_includedir() {
 	debug-print-function ${FUNCNAME} "${@}"
+	[[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
 
-	_python_export "${@}" PYTHON_INCLUDEDIR
-	echo "${PYTHON_INCLUDEDIR}"
+	local out=$("${EPYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())') || die
+	debug-print "${FUNCNAME} -> ${out}"
+
+	# Jython gives a non-existing directory
+	if [[ ! -d ${out} ]]; then
+		die "${EPYTHON} does not install any header files!"
+	fi
+
+	echo "${out}"
 }
 
 # @FUNCTION: python_get_library_path
@@ -809,8 +804,7 @@ python_doheader() {
 
 	[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
 
-	local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR}
-	[[ ${PYTHON_INCLUDEDIR} ]] || _python_export PYTHON_INCLUDEDIR
+	local d PYTHON_INCLUDEDIR=$(python_get_includedir)
 
 	d=${PYTHON_INCLUDEDIR#${EPREFIX}}
 
diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
index 423a0465d39a..a6221a625c50 100755
--- a/eclass/tests/python-utils-r2.sh
+++ b/eclass/tests/python-utils-r2.sh
@@ -77,7 +77,7 @@ test_var EPYTHON python2_7 python2.7
 test_var PYTHON python2_7 /usr/bin/python2.7
 if [[ -x /usr/bin/python2.7 ]]; then
 	test_get sitedir python2.7 "/usr/lib*/python2.7/site-packages"
-	test_var PYTHON_INCLUDEDIR python2_7 /usr/include/python2.7
+	test_get includedir python2.7 /usr/include/python2.7
 	test_var PYTHON_LIBPATH python2_7 "/usr/lib*/libpython2.7$(get_libname)"
 	test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config
 	test_var PYTHON_CFLAGS python2_7 "*-I/usr/include/python2.7*"
@@ -91,7 +91,7 @@ test_var PYTHON python3_6 /usr/bin/python3.6
 if [[ -x /usr/bin/python3.6 ]]; then
 	abiflags=$(/usr/bin/python3.6 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
 	test_get sitedir python3.6 "/usr/lib*/python3.6/site-packages"
-	test_var PYTHON_INCLUDEDIR python3_6 "/usr/include/python3.6${abiflags}"
+	test_get includedir python3.6 "/usr/include/python3.6${abiflags}"
 	test_var PYTHON_LIBPATH python3_6 "/usr/lib*/libpython3.6${abiflags}$(get_libname)"
 	test_var PYTHON_CONFIG python3_6 "/usr/bin/python3.6${abiflags}-config"
 	test_var PYTHON_CFLAGS python3_6 "*-I/usr/include/python3.6*"
@@ -105,7 +105,7 @@ test_var PYTHON python3_7 /usr/bin/python3.7
 if [[ -x /usr/bin/python3.7 ]]; then
 	abiflags=$(/usr/bin/python3.7 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
 	test_get sitedir python3.7 "/usr/lib/python3.7/site-packages"
-	test_var PYTHON_INCLUDEDIR python3_7 "/usr/include/python3.7${abiflags}"
+	test_get includedir python3.7 "/usr/include/python3.7${abiflags}"
 	test_var PYTHON_LIBPATH python3_7 "/usr/lib*/libpython3.7${abiflags}$(get_libname)"
 	test_var PYTHON_CONFIG python3_7 "/usr/bin/python3.7${abiflags}-config"
 	test_var PYTHON_CFLAGS python3_7 "*-I/usr/include/python3.7*"
@@ -126,7 +126,7 @@ test_var EPYTHON pypy pypy
 test_var PYTHON pypy /usr/bin/pypy
 if [[ -x /usr/bin/pypy ]]; then
 	test_get sitedir pypy "/usr/lib*/pypy2.7/site-packages"
-	test_var PYTHON_INCLUDEDIR pypy "/usr/lib*/pypy2.7/include"
+	test_get includedir pypy "/usr/lib*/pypy2.7/include"
 fi
 test_var PYTHON_PKG_DEP pypy '*dev-python/pypy*:0='
 test_var PYTHON_SCRIPTDIR pypy /usr/lib/python-exec/pypy
@@ -135,7 +135,7 @@ test_var EPYTHON pypy3 pypy3
 test_var PYTHON pypy3 /usr/bin/pypy3
 if [[ -x /usr/bin/pypy3 ]]; then
 	test_get sitedir pypy3 "/usr/lib*/pypy3.?/site-packages"
-	test_var PYTHON_INCLUDEDIR pypy3 "/usr/lib*/pypy3.?/include"
+	test_get includedir pypy3 "/usr/lib*/pypy3.?/include"
 fi
 test_var PYTHON_PKG_DEP pypy3 '*dev-python/pypy3*:0='
 test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3
-- 
2.25.1



  parent reply	other threads:[~2020-03-05 15:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 15:10 [gentoo-dev] [PATCH v2 00/20] python-r2 suite Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 01/20] eclass: Copy python-r1 suite to python-r2 Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 02/20] distutils-r2.eclass: Remove EXAMPLES Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 03/20] distutils-r2.eclass: Remove no-op subphase defaults Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 04/20] distutils-r2.eclass: Remove distutils.eclass checks Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 05/20] python-r2.eclass: Remove python_gen_usedep Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 06/20] python-utils-r2.eclass: Remove python.eclass checks Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 07/20] python-utils-r2.eclass: Mark python_wrapper_setup private Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 08/20] python-utils-r2.eclass: Mark python_is_installed private Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 09/20] python-utils-r2.eclass: Fix obsolete docs on python_export_best Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 10/20] python-utils-r2.eclass: Mark python_export private Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 11/20] python-utils-r2.eclass: Remove PYTHON_SITEDIR export Michał Górny
2020-03-05 15:10 ` Michał Górny [this message]
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 13/20] python-utils-r2.eclass: Remove PYTHON_LIBPATH export Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 14/20] python-utils-r2.eclass: Remove PYTHON_CFLAGS export Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 15/20] python-utils-r2.eclass: Remove PYTHON_LIBS export Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 16/20] python-utils-r2.eclass: Remove PYTHON_CONFIG export Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 17/20] python-utils-r2.eclass: Remove PYTHON_SCRIPTDIR export Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 18/20] python-single-r2.eclass: PYTHON_MULTI_USEDEP → PYTHON_USEDEP Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 19/20] distutils-r2.eclass: Pass --skip-build to install Michał Górny
2020-03-05 15:10 ` [gentoo-dev] [PATCH v2 20/20] eclass: python-r2.eclass → python-multi-r2.eclass Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200305151024.125834-13-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=python@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox