/
dieoska
/
ddnet
Обзор
Документация
Войти
/
dieoska
/
ddnet
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
scripts/git_revision.py
14 строк
458 B
heinrich5991
Format the world with ruff
17 дек 2025, 17:07
17 дек 2025, 17:07
3788112
Код
Авторство
О чём код?
import os import subprocess git_hash = os.environ.get("DDNET_GIT_SHORTREV_HASH") try: git_hash = git_hash or subprocess.check_output(["git", "rev-parse", "--short=16", "HEAD"], stderr=subprocess.DEVNULL).decode().strip() except (FileNotFoundError, subprocess.CalledProcessError): pass if git_hash is not None: definition = f'"{git_hash}"' else: definition = "0" print("#include <game/version.h>") print(f"const char *GIT_SHORTREV_HASH = {definition};")