build: Convert git_sha1_gen script to Python.