1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 04:34:43 +04:00

Merge branch 'ofw_dev' into nfcrefactoring

This commit is contained in:
MX
2023-11-11 20:18:55 +04:00
29 changed files with 669 additions and 412 deletions

View File

@@ -80,22 +80,35 @@ def __invoke_git(args, source_dir):
def _proto_ver_generator(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")
def fetch(unshallow=False):
git_args = ["fetch", "--tags"]
if unshallow:
git_args.append("--unshallow")
try:
__invoke_git(git_args, source_dir=src_dir)
except (subprocess.CalledProcessError, EnvironmentError):
# Not great, not terrible
print(fg.boldred("Git: fetch failed"))
def describe():
try:
return __invoke_git(
["describe", "--tags", "--abbrev=0"],
source_dir=src_dir,
)
except (subprocess.CalledProcessError, EnvironmentError):
return None
fetch()
git_describe = describe()
if not git_describe:
fetch(unshallow=True)
git_describe = describe()
if not git_describe:
raise StopError("Failed to process git tags for protobuf versioning")
git_major, git_minor = git_describe.split(".")
version_file_data = (