Support Python3.8
authorOlivier Dion <odion@efficios.com>
Tue, 27 Feb 2024 19:54:42 +0000 (14:54 -0500)
committerOlivier Dion <odion@efficios.com>
Tue, 27 Feb 2024 19:54:42 +0000 (14:54 -0500)
Signed-off-by: Olivier Dion <odion@efficios.com>
scripts/lttng-ust-auto-api

index 845a33f626f7ec312a81fcd0bf30d5add679d76a..ed40675a612ad0105f748b74eff6039dcef5e6da 100755 (executable)
@@ -30,6 +30,12 @@ PROVIDER      = None
 # exception of the IDs -- will be passed through a data structure instead.
 MAX_TP_ARGS_COUNT = 8
 
+# Compatibility layer.
+def remove_prefix(string, prefix):
+    if string.startswith(prefix):
+        return string[len(prefix):]
+    return string
+
 class EnumValue:
 
     def __init__(self, ev):
@@ -109,7 +115,7 @@ class ArgumentType:
         elif self.kind() in ArgumentType.float_set:
             return f"lttng_ust_field_float({self.type_name()}, {self.name_prefix}{self.name()}, {self.expr_prefix}{self.name()})"
         elif self.kind() == clang.cindex.TypeKind.ENUM:
-            enum_name = self.type_name().removeprefix("enum ")
+            enum_name = remove_prefix(self.type_name(), "enum ")
             return f"lttng_ust_field_enum({PROVIDER}, {enum_name}, int, {self.name_prefix}{self.name()}, {self.expr_prefix}{self.name()})"
         elif self.kind() == clang.cindex.TypeKind.RECORD:
             return [
This page took 0.025859 seconds and 4 git commands to generate.