From 35ae8dc7420b7a0ea5363a61d7f0bec3f98ef8a0 Mon Sep 17 00:00:00 2001 From: Romain Thomas Date: Thu, 12 Dec 2024 21:05:51 +0100 Subject: [PATCH] Don't fail on a `.x` versioning --- api/python/backend/versioning.py | 3 +++ cmake/LIEFGit.cmake | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/api/python/backend/versioning.py b/api/python/backend/versioning.py index 6aca3ec06b..833b4cc6d2 100644 --- a/api/python/backend/versioning.py +++ b/api/python/backend/versioning.py @@ -59,6 +59,9 @@ def format_version(self, version: str, fmt: str, is_dev: bool = False): if branch is not None and branch.startswith("release/"): _, version = branch.split("release/") + major, minor, patch = version.split('.') + if patch == 'x': + return f"{major}.{minor}" return version parts = version.split('-') diff --git a/cmake/LIEFGit.cmake b/cmake/LIEFGit.cmake index dfc6adc3db..0295f7cf7d 100644 --- a/cmake/LIEFGit.cmake +++ b/cmake/LIEFGit.cmake @@ -54,11 +54,15 @@ else() endif() message(STATUS "Current branch: ${LIEF_GIT_BRANCH}") - if (VERSION_STRING) + list(LENGTH VERSION_STRING VERSION_STRING_LEN) list(GET VERSION_STRING 0 LIEF_VERSION_MAJOR) list(GET VERSION_STRING 1 LIEF_VERSION_MINOR) - list(GET VERSION_STRING 2 LIEF_VERSION_PATCH) + if (VERSION_STRING_LEN GREATER 2) + list(GET VERSION_STRING 2 LIEF_VERSION_PATCH) + else() + set(LIEF_VERSION_PATCH 0) + endif() if (NOT ${LIEF_IS_TAGGED}) if(LIEF_GIT_BRANCH MATCHES "^release[-/]")