1 |
commit: 3445afea171d0f1df2c1dc4af57bf59caba27a12 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Feb 4 21:37:03 2022 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 9 08:43:53 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3445afea |
7 |
|
8 |
python-utils-r1.eclass: Use heredoc instead of "python -c" |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
eclass/python-utils-r1.eclass | 41 ++++++++++++++++++++++++++++++++++++----- |
13 |
1 file changed, 36 insertions(+), 5 deletions(-) |
14 |
|
15 |
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass |
16 |
index 29ff04d2892c..9e2ba0743f51 100644 |
17 |
--- a/eclass/python-utils-r1.eclass |
18 |
+++ b/eclass/python-utils-r1.eclass |
19 |
@@ -316,13 +316,23 @@ _python_export() { |
20 |
;; |
21 |
PYTHON_SITEDIR) |
22 |
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it" |
23 |
- PYTHON_SITEDIR=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_path("purelib"))') || die |
24 |
+ PYTHON_SITEDIR=$( |
25 |
+ "${PYTHON}" - <<-EOF || die |
26 |
+ import sysconfig |
27 |
+ print(sysconfig.get_path("purelib")) |
28 |
+ EOF |
29 |
+ ) |
30 |
export PYTHON_SITEDIR |
31 |
debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}" |
32 |
;; |
33 |
PYTHON_INCLUDEDIR) |
34 |
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it" |
35 |
- PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_path("platinclude"))') || die |
36 |
+ PYTHON_INCLUDEDIR=$( |
37 |
+ "${PYTHON}" - <<-EOF || die |
38 |
+ import sysconfig |
39 |
+ print(sysconfig.get_path("platinclude")) |
40 |
+ EOF |
41 |
+ ) |
42 |
export PYTHON_INCLUDEDIR |
43 |
debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}" |
44 |
|
45 |
@@ -333,7 +343,17 @@ _python_export() { |
46 |
;; |
47 |
PYTHON_LIBPATH) |
48 |
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it" |
49 |
- 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 |
50 |
+ PYTHON_LIBPATH=$( |
51 |
+ "${PYTHON}" - <<-EOF || die |
52 |
+ import os.path, sysconfig |
53 |
+ print( |
54 |
+ os.path.join( |
55 |
+ sysconfig.get_config_var("LIBDIR"), |
56 |
+ sysconfig.get_config_var("LDLIBRARY")) |
57 |
+ if sysconfig.get_config_var("LDLIBRARY") |
58 |
+ else "") |
59 |
+ EOF |
60 |
+ ) |
61 |
export PYTHON_LIBPATH |
62 |
debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}" |
63 |
|
64 |
@@ -383,7 +403,13 @@ _python_export() { |
65 |
case "${impl}" in |
66 |
python*) |
67 |
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it" |
68 |
- flags=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS") or "")') || die |
69 |
+ flags=$( |
70 |
+ "${PYTHON}" - <<-EOF || die |
71 |
+ import sysconfig |
72 |
+ print(sysconfig.get_config_var("ABIFLAGS") |
73 |
+ or "") |
74 |
+ EOF |
75 |
+ ) |
76 |
val=${PYTHON}${flags}-config |
77 |
;; |
78 |
*) |
79 |
@@ -574,7 +600,12 @@ python_optimize() { |
80 |
if [[ ${f} == /* && -d ${D%/}${f} ]]; then |
81 |
set -- "${D%/}${f}" "${@}" |
82 |
fi |
83 |
- done < <("${PYTHON}" -c 'import sys; print("".join(x + "\0" for x in sys.path))' || die) |
84 |
+ done < <( |
85 |
+ "${PYTHON}" - <<-EOF || die |
86 |
+ import sys |
87 |
+ print("".join(x + "\0" for x in sys.path)) |
88 |
+ EOF |
89 |
+ ) |
90 |
|
91 |
debug-print "${FUNCNAME}: using sys.path: ${*/%/;}" |
92 |
fi |