mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-06 05:38:15 +02:00
tests: adjust test-gir.py to allow extra elements in section name
(cherry picked from commit 9b8220c9fa)
This commit is contained in:
parent
2976e4c3b7
commit
56e19bdf68
1 changed files with 5 additions and 13 deletions
|
|
@ -7,6 +7,7 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
import argparse
|
import argparse
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
C_NS = "http://www.gtk.org/introspection/c/1.0"
|
C_NS = "http://www.gtk.org/introspection/c/1.0"
|
||||||
|
|
@ -60,17 +61,6 @@ def str_removesuffix(string, suffix):
|
||||||
return string
|
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):
|
def syms_from_ver(verfile):
|
||||||
c_syms = {}
|
c_syms = {}
|
||||||
for line in open(verfile).readlines():
|
for line in open(verfile).readlines():
|
||||||
|
|
@ -78,8 +68,10 @@ def syms_from_ver(verfile):
|
||||||
|
|
||||||
if line.endswith("{"):
|
if line.endswith("{"):
|
||||||
line = str_removesuffix(line, " {")
|
line = str_removesuffix(line, " {")
|
||||||
line = str_removeprefix(line, "libnm_")
|
m = re.search(r"^libnm_([0-9]+)_([0-9]+)_([0-9]+)$", line)
|
||||||
(major, minor, micro) = line.split("_")
|
if not m:
|
||||||
|
continue
|
||||||
|
(major, minor, micro) = m.groups()
|
||||||
if int(major) > 1 or int(minor) > 0:
|
if int(major) > 1 or int(minor) > 0:
|
||||||
if int(micro) > 0:
|
if int(micro) > 0:
|
||||||
# Snap to next major version. Perhaps not
|
# Snap to next major version. Perhaps not
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue