diff options
author | Fernando Fernandez Mancera <ffmancera@riseup.net> | 2023-05-10 18:18:18 +0200 |
---|---|---|
committer | Fernando Fernandez Mancera <ffmancera@riseup.net> | 2023-05-15 15:16:49 +0200 |
commit | 9b8220c9fa6c26257fe809171355b29219efe26a (patch) | |
tree | 273b4dcc35a1fbd7403e6581067c8c25bd1959b2 | |
parent | a235bb3c6f03e93b92dda231f32a5fbc178d8328 (diff) |
tests: adjust test-gir.py to allow extra elements in section name
-rwxr-xr-x | src/libnm-client-impl/tests/test-gir.py | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/libnm-client-impl/tests/test-gir.py b/src/libnm-client-impl/tests/test-gir.py index d91849b8fe..f8e06c59b4 100755 --- a/src/libnm-client-impl/tests/test-gir.py +++ b/src/libnm-client-impl/tests/test-gir.py @@ -7,6 +7,7 @@ from __future__ import print_function import xml.etree.ElementTree as ET import argparse +import re import sys C_NS = "http://www.gtk.org/introspection/c/1.0" @@ -60,17 +61,6 @@ def str_removesuffix(string, suffix): return string -# Older Python doesn't have str.removeprefix() -def str_removeprefix(string, prefix): - try: - return string.removeprefix(prefix) - except AttributeError: - if string.startswith(prefix): - return string[len(prefix) :] - else: - return string - - def syms_from_ver(verfile): c_syms = {} for line in open(verfile).readlines(): @@ -78,8 +68,10 @@ def syms_from_ver(verfile): if line.endswith("{"): line = str_removesuffix(line, " {") - line = str_removeprefix(line, "libnm_") - (major, minor, micro) = line.split("_") + m = re.search(r"^libnm_([0-9]+)_([0-9]+)_([0-9]+)$", line) + if not m: + continue + (major, minor, micro) = m.groups() if int(major) > 1 or int(minor) > 0: if int(micro) > 0: # Snap to next major version. Perhaps not |