Use portable $(python) preprocessor for Kconfig#719
Merged
Conversation
jserv
commented
Mar 1, 2026
Contributor
Author
There was a problem hiding this comment.
Benchmarks
Details
| Benchmark suite | Current: 2a635b4 | Previous: 8092c66 | Ratio |
|---|---|---|---|
Dhrystone |
1554 DMIPS |
1535.333 DMIPS |
0.99 |
CoreMark |
1108.112 iterations/sec |
1110.937 iterations/sec |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
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#47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This replaces
$(shell,...)call with portable$(python,...)preprocessor function from Kconfiglib for boolean environment detection. $(python) built-in evaluates Python code in-process and returns "y"/"n" without spawning a shell, eliminating POSIX shell dependencies (2>/dev/null, || echo) and improving Windows portability.Simple checks (SDL2, SDL2_mixer) are inlined directly using the run()/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.
Summary by cubic
Switch Kconfig detection to the portable $(python,...) preprocessor to remove POSIX shell dependencies and improve Windows support. Simple checks run in-process; complex checks call detect-env.py and signal results via exit codes.
Written for commit 2a635b4. Summary will update on new commits.