ulfalizer / Kconfiglib

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

Support recursive globs for source statement #102

Open tlammi opened 3 years ago

tlammi commented 3 years ago

I tested the tool a bit and detected that the glob passed to source does not support recursive globs. Would it be feasible to implement that behavior? It would simplify searching for Kconfigs down the file hierarchy.

I tested the behavior with adding an extra recursive=True parameter to iglob in kconfiglib.py with Python 3.9. This allowed me to use recursive globs in the statement but broke the recursive self-sourcing check causing an exception to be raised and not caught. I.e. rsource "./*/**/Kconfig" works as intended but rsource "./**/Kconfig" causes a recursive self-sourcing.

Seems like the recursive option is available at least since Python 3.5 but not in Python 2.7, so the implementation would be a bit more complicated if 2.7 support is to be kept.