I'm now working on how to get the list of the available modules. As you know gnulib-tool.sh uses combination of find and echo commands. It seems that it is the fastest way to do the job, may be it would be better to do it using subprocess? I could do it in this way:
0. Create empty list to store strings. 1. Make recursive cycle using os.walk. 2. For every string: 2a. Don't append string if it is a directory; 2b. Don't append string if it is a special filename.
3. Sort list using list.sort() method, which depends on current locale.
I could do it in the way described above, but it takes too much time to complete. So I think the best way is to do this: 1. Run subprocess `find modules -type f -print` and get output.
2. Send stdout to sed command with some arguments (func_sanitize_modulelist), then get output. 3. Split output by lines, then sort it using list.sort() method, which depends on current locale.
BTW, why we set `LC_ALL=C` before we run `sort -u`? Is it necessary to use exactly C locale?