This is deprecated in python 3.12. Also, improve file handling
Putting the git information into a generated sourcefile prevents recompiling the whole project after each commit.