ulfalizer / Kconfiglib

A flexible Python 2/3 Kconfig implementation and library
ISC License
448 stars 160 forks source link

Add oldaskconfig the default conf program #134

Open afbjorklund opened 11 months ago

afbjorklund commented 11 months ago

Closes #133

This is the default option, for kconfig-conf.

Just a small modification to the "oldconfig":

@@ -82,9 +81,7 @@
     if isinstance(node.item, Symbol):
         sym = node.item

-        # Skip symbols that already have a user value
-        if sym.user_value is not None:
-            return
+        new = sym.user_value is None

         # Skip symbols that can only have a single value, due to selects
         if len(sym.assignable) == 1:
@@ -98,9 +95,9 @@
         # Loop until the user enters a valid value or enters a blank string
         # (for the default value)
         while True:
-            val = input("{} ({}) [{}] ".format(
+            val = input("{} ({}) [{}]{} ".format(
                 node.prompt[0], _name_and_loc_str(sym),
-                _default_value_str(sym)))
+                _default_value_str(sym), _new_value_str(new)))

             if val == "?":
                 _print_help(node)
@@ -242,5 +239,11 @@
     return sym.str_value

+def _new_value_str(new):
+    if new:
+        return " (NEW)"
+    return ""
+
+
 if __name__ == "__main__":
     _main()
jackrosenthal commented 3 weeks ago

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: @afbjorklund Are you able to re-open your pull request on the new repository?

afbjorklund commented 3 weeks ago

Can't make a PR, since you didn't fork the same project. Would have to make a new clone...

carlescufi commented 3 weeks ago

Can't make a PR, since you didn't fork the same project. Would have to make a new clone...

You can just close this PR and open a new one agains the new repo. We did not make it a fork because we want it to become the new canonical upstream.