Commit 2a635b4
committed
Use portable $(python,...) preprocessor for Kconfig detection
Replace all $(shell,...) calls with the portable $(python,...) preprocessor
function from Kconfiglib. The $(python,...) built-in evaluates Python code
in-process and returns "y"/"n" without spawning a shell, eliminating POSIX
shell dependencies (2>/dev/null, ||, echo) for cross-platform portability.
Simple checks (SDL2, SDL2_mixer) are inlined directly using the run() and
shutil.which() helpers available in the $(python,...) namespace. Complex
checks (compiler type, LLVM 18, RISC-V toolchain) delegate to detect-env.py
via run(sys.executable, ...) with exit-code signaling. COMPILER_TYPE is
derived from the CC_IS_CLANG/CC_IS_GCC/CC_IS_EMCC booleans using pure
Kconfig conditionals, eliminating the last $(shell,...) call.
detect-env.py changes:
- Boolean flags now use exit codes (0/1) via bool_exit() instead of
printing "y"/"n", matching the run() convention in $(python,...).
- Compiler probing is lazy: --have-sdl2, --have-llvm18, etc. no longer
pay the cost of running CC --version when they don't need it.
- get_compiler_version() captures both stdout and stderr to handle
emcc variants that emit version info on stderr.
Reference: sysprog21/Kconfiglib#471 parent 47cf03d commit 2a635b4
2 files changed
Lines changed: 59 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
8 | 13 | | |
9 | 14 | | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
13 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
14 | 22 | | |
15 | 23 | | |
16 | 24 | | |
17 | | - | |
| 25 | + | |
18 | 26 | | |
19 | 27 | | |
20 | | - | |
| 28 | + | |
21 | 29 | | |
22 | 30 | | |
23 | | - | |
| 31 | + | |
24 | 32 | | |
25 | 33 | | |
26 | 34 | | |
| |||
76 | 84 | | |
77 | 85 | | |
78 | 86 | | |
79 | | - | |
| 87 | + | |
80 | 88 | | |
81 | 89 | | |
82 | 90 | | |
83 | 91 | | |
84 | | - | |
| 92 | + | |
85 | 93 | | |
86 | 94 | | |
87 | 95 | | |
88 | | - | |
| 96 | + | |
89 | 97 | | |
90 | 98 | | |
91 | 99 | | |
92 | | - | |
| 100 | + | |
93 | 101 | | |
94 | 102 | | |
95 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | | - | |
59 | | - | |
| 59 | + | |
| 60 | + | |
60 | 61 | | |
61 | | - | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | | - | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
186 | 187 | | |
187 | 188 | | |
188 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
189 | 206 | | |
190 | 207 | | |
191 | 208 | | |
192 | 209 | | |
193 | 210 | | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | 211 | | |
199 | 212 | | |
| 213 | + | |
200 | 214 | | |
201 | | - | |
| 215 | + | |
| 216 | + | |
202 | 217 | | |
203 | | - | |
| 218 | + | |
204 | 219 | | |
205 | | - | |
| 220 | + | |
206 | 221 | | |
207 | | - | |
| 222 | + | |
| 223 | + | |
208 | 224 | | |
209 | | - | |
| 225 | + | |
210 | 226 | | |
211 | | - | |
| 227 | + | |
212 | 228 | | |
213 | | - | |
| 229 | + | |
214 | 230 | | |
215 | | - | |
| 231 | + | |
216 | 232 | | |
217 | | - | |
| 233 | + | |
218 | 234 | | |
219 | 235 | | |
220 | 236 | | |
| |||
0 commit comments