mirror of
https://github.com/seL4/seL4.git
synced 2026-03-27 10:29:57 +00:00
invocations_all.json: define remove_prefix()
We relied on str.removeprefix(), which is only available in python >= 3.9. To make this script more portable, we add our own implementation. Signed-off-by: Alwin Joshy <joshyalwin@gmail.com>
This commit is contained in:
committed by
Gerwin Klein
parent
ca0edeaeab
commit
9080b6844b
@@ -42,6 +42,12 @@ def condition_to_cpp(conditions):
|
||||
return helper(children[0])
|
||||
|
||||
|
||||
def remove_prefix(text, prefix) -> str:
|
||||
if text.startswith(prefix):
|
||||
return text[len(prefix):]
|
||||
return text
|
||||
|
||||
|
||||
def expr_to_bool(expr, values) -> bool:
|
||||
if expr.tagName == "and":
|
||||
for child in expr.childNodes:
|
||||
@@ -61,7 +67,7 @@ def expr_to_bool(expr, values) -> bool:
|
||||
if not cfg_var:
|
||||
raise Exception("Missing or empty config variable")
|
||||
|
||||
return values[cfg_var.removeprefix("CONFIG_")]
|
||||
return values[remove_prefix(cfg_var, "CONFIG_")]
|
||||
raise Exception("Unrecognized element `{}` in condition".format(expr.tagName))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user