Kconfiglib icon indicating copy to clipboard operation
Kconfiglib copied to clipboard

kconfiglib: check for empty strings on macro expansion

Open leandrolanzieri opened this issue 5 years ago • 3 comments

During macro expansion, bare macros on a line are accepted by the parser as long as they resolve to blank strings. The problem is that the script is currently checking using isspace, so it's actually not checking for blank strings.

This causes the parsing to fail when a macro is the last line of a file, and no newline character is added afterwards. This patch adds a check for the string itself being empty. It can be tested, for instance, by applying the following and running the tests:

diff --git a/tests/Kpreprocess b/tests/Kpreprocess
index 283a988..a30ba74 100644
--- a/tests/Kpreprocess
+++ b/tests/Kpreprocess
@@ -149,3 +149,5 @@ env_ref_3 += $(ENV_4)
 $(warning-if,$(ENV_5),$(ENV_UNDEFINED))
 source "$(ENV_6)"
 env_ref_4 = $(ENV_7)  # Never evaluated
+
+$(info,Information message)
\ No newline at end of file

leandrolanzieri avatar Oct 16 '20 12:10 leandrolanzieri

Rather unfortunately, it appears the original author of Kconfiglib disappeared. The Zephyr project has been granted ownership of the PyPI package via PEP-541 request, and I'm going to do a release based on a new repository in the zephyrproject-rtos organization here: https://github.com/zephyrproject-rtos/Kconfiglib

:arrow_right: Action required: @leandrolanzieri Are you able to re-open your pull request on the new repository?

jackrosenthal avatar Aug 14 '24 17:08 jackrosenthal

@jackrosenthal great that someone is taking over. Sure, I'll try re-opening these PRs on the new repo

leandrolanzieri avatar Aug 16 '24 07:08 leandrolanzieri

@jackrosenthal see https://github.com/zephyrproject-rtos/Kconfiglib/pull/3

leandrolanzieri avatar Aug 26 '24 10:08 leandrolanzieri