summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-02-04 22:37:03 +0100
committerMichał Górny <mgorny@gentoo.org>2022-02-09 09:43:53 +0100
commit3445afea171d0f1df2c1dc4af57bf59caba27a12 (patch)
tree24a74d819b7fc389e1e9dec9aa3ce4eba9054601 /eclass
parentdistutils-r1.eclass: Use heredoc instead of "python -c" (diff)
downloadgentoo-3445afea171d0f1df2c1dc4af57bf59caba27a12.tar.gz
gentoo-3445afea171d0f1df2c1dc4af57bf59caba27a12.tar.bz2
gentoo-3445afea171d0f1df2c1dc4af57bf59caba27a12.zip
python-utils-r1.eclass: Use heredoc instead of "python -c"
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/python-utils-r1.eclass41
1 files changed, 36 insertions, 5 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 29ff04d2892c..9e2ba0743f51 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -316,13 +316,23 @@ _python_export() {
;;
PYTHON_SITEDIR)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- PYTHON_SITEDIR=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_path("purelib"))') || die
+ PYTHON_SITEDIR=$(
+ "${PYTHON}" - <<-EOF || die
+ import sysconfig
+ print(sysconfig.get_path("purelib"))
+ EOF
+ )
export PYTHON_SITEDIR
debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
;;
PYTHON_INCLUDEDIR)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_path("platinclude"))') || die
+ PYTHON_INCLUDEDIR=$(
+ "${PYTHON}" - <<-EOF || die
+ import sysconfig
+ print(sysconfig.get_path("platinclude"))
+ EOF
+ )
export PYTHON_INCLUDEDIR
debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
@@ -333,7 +343,17 @@ _python_export() {
;;
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
+ PYTHON_LIBPATH=$(
+ "${PYTHON}" - <<-EOF || die
+ 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 "")
+ EOF
+ )
export PYTHON_LIBPATH
debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}"
@@ -383,7 +403,13 @@ _python_export() {
case "${impl}" in
python*)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- flags=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS") or "")') || die
+ flags=$(
+ "${PYTHON}" - <<-EOF || die
+ import sysconfig
+ print(sysconfig.get_config_var("ABIFLAGS")
+ or "")
+ EOF
+ )
val=${PYTHON}${flags}-config
;;
*)
@@ -574,7 +600,12 @@ python_optimize() {
if [[ ${f} == /* && -d ${D%/}${f} ]]; then
set -- "${D%/}${f}" "${@}"
fi
- done < <("${PYTHON}" -c 'import sys; print("".join(x + "\0" for x in sys.path))' || die)
+ done < <(
+ "${PYTHON}" - <<-EOF || die
+ import sys
+ print("".join(x + "\0" for x in sys.path))
+ EOF
+ )
debug-print "${FUNCNAME}: using sys.path: ${*/%/;}"
fi