Hi all,
I did a major refactoring of lib/init/grass.py file [1]. I believe that the file is now much easier to understand and maintain. The changes were necessary to implement #2579 without hacks and workarounds but it goes beyond that. Now we can actually review the code, fix some bugs and remove some dead code.
I actually removed a lot of dead code already such as repetitive cleanups. Function calls are now clearer (better names + parameters + return values) and it seems that some of the calls are not in the right order. And this is where I want you to ask for help, there is several places I don’t completely understand or I’m unsure what it the desired behavior.
There is still few issues which prevents an implementation of things such as alternative command line interfaces and reuse of the code in general. However, in general it is much easier to introduce new features or change existing ones (I just don’t have a time to continue in it).
I put TODO comments in the source code, so this places can be found. If you contributed to this file or you understand what is there, it would be great if you can go through the TODO comments and see which you can resolve or comment on. There is also some low hanging fruit for people who would like to get familiar with the code.
I have also discovered some bugs when looking at the code or testing. I will send separate emails about those.
Thanks Martin for the improvements already contributed and for catching the bug with tmp dir I made.
Best,
Vaclav
[1] https://trac.osgeo.org/grass/browser/grass/trunk/lib/init/grass.py
[2] https://trac.osgeo.org/grass/ticket/2579