mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 06:56:14 +01:00
tests: Fix gengiotypefuncs.py helper script
It seems this script has potentially never worked properly under Python 3. It’s supposed to list all the `_get_type()` functions it can find in the GIO headers, but since the regex string passed to `re.search()` was not a Python regex, nothing was matching. Fix that, and do another few small cleanups to the script. This makes the `defaultvalue` test not skip all the types. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
f977ddf34f
commit
8dde15a5b3
@ -25,10 +25,9 @@ for filename in in_files:
|
||||
with open(filename, "rb") as f:
|
||||
for line in f:
|
||||
line = line.rstrip(b"\n").rstrip(b"\r")
|
||||
# print line
|
||||
match = re.search(b"\bg_[a-zA-Z0-9_]*_get_type\b", line)
|
||||
match = re.search(br"\bg_[a-zA-Z0-9_]*_get_type\b", line)
|
||||
if match:
|
||||
func = match.group(0)
|
||||
func = match.group(0).decode('utf-8')
|
||||
if func not in funcs:
|
||||
funcs.append(func)
|
||||
if debug:
|
||||
@ -38,10 +37,23 @@ file_output = "G_GNUC_BEGIN_IGNORE_DEPRECATIONS\n"
|
||||
|
||||
funcs = sorted(funcs)
|
||||
|
||||
# These types generally emit critical warnings if constructed in the wrong
|
||||
# environment (for example, without D-Bus running), so skip them.
|
||||
ignored_types = [
|
||||
"g_io_extension_get_type",
|
||||
"g_settings_backend_get_type",
|
||||
"g_debug_controller_dbus_get_type",
|
||||
"g_file_icon_get_type",
|
||||
"g_unix_credentials_message_get_type",
|
||||
"g_unix_socket_address_get_type",
|
||||
]
|
||||
|
||||
for f in funcs:
|
||||
if f not in ["g_io_extension_get_type", "g_settings_backend_get_type"]:
|
||||
if f not in ignored_types:
|
||||
file_output += "*tp++ = {0} ();\n".format(f)
|
||||
|
||||
file_output += "G_GNUC_END_IGNORE_DEPRECATIONS\n"
|
||||
|
||||
if debug:
|
||||
print(len(funcs), "functions")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user