From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7B74D138350 for ; Sat, 29 Feb 2020 20:46:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EE2ADE0A96; Sat, 29 Feb 2020 20:42:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 98BD2E094A for ; Sat, 29 Feb 2020 20:42:51 +0000 (UTC) Received: from localhost.localdomain (c142-245.icpnet.pl [85.221.142.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 82AB734F11F; Sat, 29 Feb 2020 20:42:49 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: python@gentoo.org, =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 14/25] python-utils-r2.eclass: Remove PYTHON_INCLUDEDIR export Date: Sat, 29 Feb 2020 21:41:50 +0100 Message-Id: <20200229204201.99290-15-mgorny@gentoo.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200229204201.99290-1-mgorny@gentoo.org> References: <20200229204201.99290-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 05390e77-48fc-441d-a7ac-8269c1a45324 X-Archives-Hash: 5a934b4bb4e64432af3565bc2d6a0619 Signed-off-by: Michał Górny --- 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 971dd4393963..87c7dd506274 100644 --- a/eclass/python-utils-r2.eclass +++ b/eclass/python-utils-r2.eclass @@ -268,17 +268,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 @@ -392,15 +381,21 @@ python_get_sitedir() { } # @FUNCTION: python_get_includedir -# @USAGE: [] # @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 @@ -806,8 +801,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