-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "lsource" for sourcing a list of files #75
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
Maybe it could be included as a provisional feature for now, in case I think of some drawback or other way to do things.
It's a bit inconsistent in that there's no relative lsource
, but at the same time I don't want to put in too much stuff that would never get used, so that might be fine.
Will look more tomorrow. Busy times lately with some other code.
Thank you @ulfalizer for your suggestions and for the will to work toward this feature. I corrected the commit as per your suggestions.
Would you like more the idea that |
Thanks!
One disadvantage is that it breaks paths with spaces in them. Probably very rare to have those, but you never know what people might depend on. I'm fine with Will look more over the weekend. Sorry for slowness. Should calm down soon. |
Yes, poor Windows users. :-) I forgot about those spaces. However, the list items could be separated with something else, e.g. semicolon.
Thank you for your time! |
I discovered an incompability with Python 2. /~https://github.com/ulfalizer/Kconfiglib/blob/master/kconfiglib.py#L2472 token is EDIT: |
Weird. I wonder how you ended up with Could you check if The recommended syntax nowadays is this btw:
That's using the new Kconfig preprocessor. The |
I wonder if It should really be @dobairoland In that case, maybe you could do something like this instead:
Line 458 in f2ce282
kconfigfunctions.py :
import os
import kconfiglib
def has_component(kconf, _, name):
components = os.getenv("ESP_IDF_COMPONENTS")
if components is None:
raise kconfiglib.KconfigError(
"{}:{}: $(has-component) requires the env. var. "
"ESP_IDF_COMPONENTS to be set to a space-separated list of "
"component names".format(kconf.filename, kconf.linenr))
return "y" if name in components.split() else "n"
functions = {
"has-component": (has_component, 1, 1)
} Thoughts? It's a bit more work on the esp-idf side, but on the upside, it makes it easy to |
Hi @ulfalizer. Thank you for taking the time and looking at this again.
Yes, it is unicode. Unicode characters in paths are not supported in Kconfiglib?
I can remove it from there if you prefer that solution.
Yes, that seems to be too much.
Unfortunately, no they are not. There are other frameworks which depend on ESP-IDF which has their components. Our customers have their own private components. I cannot even compile a complete list. I've tried to add def source_list(kconf, name, path_list):
return '\n'.join(['source "{}"'.format(path) for path in path_list[1:-1].split()])
functions = {
"source-list": (source_list, 1, 1),
} The function returns:
But unfortunately, this isn't working. |
They are supported in the sense that Kconfiglib just avoids decoding any strings on Python 2, and I haven't seen
That's why I'm wondering how you ended up with Curious how it happened, so I can see if it's worth fixing. :)
Might be best if there's only gone be one variant.
Yeah, that makes it a bit messier. Another option might be to generate a Kconfig file with a bunch of Any chance that might work?
Nah, the preprocessor works at the single token level, so that won't work. It was designed like that when it was added to the C tools to prevent too much anarchy, though it'd be semi-handy here. |
Sorry for stalling, but I'm a bit afraid that someone will come along in the future and say "hey, I need to source a bunch of glob patterns from an environment variable, why isn't this globbing like everything else?", or "why isn't there a relative (or required) version of this?" At that point, it's hard to come up with a good reason why not, even though it starts to get into messy feature creep. :) Maybe generating a FWIW, I know you just want to get it in and get on with the work, so sorry about that. I have to make it work with everything that comes after it though, and deal with issues people have with it. :) |
It is getting de-serialized from a JSON object: /~https://github.com/espressif/esp-idf/blob/master/tools/kconfig_new/confgen.py#L224 and
Thank you, I'll try this option.
I understand your point. Thank you for your suggestions and your work on this library! |
I'll look into it. Thanks for the report! Found theskumar/python-dotenv#176, though I can't find anything in the Python 2 Do you still depend on Python 2? |
Yes, we have to support 2.7 in all of our active releases. |
Dug around a bit. I think it might be best to encode the strings on the esp-idf side before storing them into
Maybe doing something similar to what this PR does in ESP-IDF would make sense. |
I solved my issue by creating a temporary file with a list of source item. Thank you for your help and kind suggestions. |
Here is the PR I mentioned here: #71 (comment)
I hope it is worth of adding to your great library. I'm ready to make any necessary adjustments.