Ensure DevHelp symbol sections have stable ordering
It was discovered through NixOS reproducible build initiative that gi-docgen introduces non-determinism in the ordering of some DevHelp files and index.json. It turns out this is caused by concurrent generation of the various symbol sections, a performance optimization that inserts into a 'sections' dict as threaded workers complete, which is by nature not a reproducible task. In the case of the index, I was not able to find the source of the randomness, but it's likely caused by file enumerations.
This commit adds a final sort on relevant dicts and lists to restore determinism in how these structures are iterated on between runs of the program. The exact iteration order does not matter, only the fact that it is stable given the same input. Since Python 3.7, dict iteration order is guaranteed to be insertion order, so this is working as intended.
This introduces no performance penalty since Python does not copy the dict items, which are (str, list) tuples, and sorts lists in-place.