import os with open("xenrom/data/version.inc", "w") as f: version = os.getenv("NIX_SEMVER", "(unknown version)") git_sha = os.getenv("NIX_GIT_SHA_SHORT", "(unknown git hash)") f.write(f'version_str: data.str "{version}" data.8 0\n') f.write(f'sha_str: data.str "{git_sha}" data.8 0\n')