def METHOD_NAME(target, source, env):
    target_file = target[0]
    src_dir = source[0].dir.abspath
    try:
        _invoke_git(
            ["fetch", "--tags"],
            source_dir=src_dir,
        )
    except (subprocess.CalledProcessError, EnvironmentError):
        # Not great, not terrible
        print(fg.boldred("Git: fetch failed"))
    try:
        git_describe = _invoke_git(
            ["describe", "--tags", "--abbrev=0"],
            source_dir=src_dir,
        )
    except (subprocess.CalledProcessError, EnvironmentError):
        raise StopError("Git: describe failed")
    git_major, git_minor = git_describe.split(".")
    version_file_data = (
        "#pragma once",
        f"#define PROTOBUF_MAJOR_VERSION {git_major}",
        f"#define PROTOBUF_MINOR_VERSION {git_minor}",
        "",
    )
    with open(str(target_file), "wt") as file:
        file.write("\n".join(version_file_data))