From 645c88744f2c07df11c0859a25e7f15e7e61cf15 Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Fri, 19 Jul 2024 07:22:16 -0400 Subject: [PATCH] bugfix: fixing how previous versions are parsed for the symbols map generator --- tools/symbols_map_generator/main.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/symbols_map_generator/main.py b/tools/symbols_map_generator/main.py index d0b5376df91..2a8b2c71f13 100755 --- a/tools/symbols_map_generator/main.py +++ b/tools/symbols_map_generator/main.py @@ -41,8 +41,18 @@ class LibraryInfo(TypedDict): header_directories: list[HeaderDirectory] map_file: str +def get_version_from_library_version_str(version: str) -> str: + """ + Given a string like MIR_SERVER_INTERNAL_5.0.0, returns the version + string (e.g. 5.0.0) + """ + return version.split("_")[-1] + def get_major_version_from_str(version: str) -> int: + """ + Given a string like 5.0.0, returns the major version (e.g. 5). + """ return int(version.split('.')[0]) @@ -482,7 +492,7 @@ def main(): # Remake the stanzas for the previous symbols for symbol in previous_symbols: - major = get_major_version_from_str(symbol.version) + major = get_major_version_from_str(get_version_from_library_version_str(symbol.version)) # If we are going up by a major version, then we should add # all existing symbols to the new stanza