mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
cpu_map: sync_qemu_i386.py: Use regex to look for begin mark
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
51ff124d9c
commit
360b8eb2d2
@ -196,7 +196,7 @@ def read_builtin_x86_defs(filename):
|
|||||||
"""Extract content between begin_mark and end_mark from file `filename` as
|
"""Extract content between begin_mark and end_mark from file `filename` as
|
||||||
string, while expanding shorthand macros like "I486_FEATURES"."""
|
string, while expanding shorthand macros like "I486_FEATURES"."""
|
||||||
|
|
||||||
begin_mark = "static X86CPUDefinition builtin_x86_defs[] = {\n"
|
begin_mark = re.compile("^static X86CPUDefinition builtin_x86_defs\\[\\] = {$")
|
||||||
end_mark = "};\n"
|
end_mark = "};\n"
|
||||||
shorthand = re.compile("^#define ([A-Z0-9_]+_FEATURES) (.*)$")
|
shorthand = re.compile("^#define ([A-Z0-9_]+_FEATURES) (.*)$")
|
||||||
lines = list()
|
lines = list()
|
||||||
@ -205,10 +205,11 @@ def read_builtin_x86_defs(filename):
|
|||||||
with open(filename, "rt") as f:
|
with open(filename, "rt") as f:
|
||||||
while True:
|
while True:
|
||||||
line = readline_cont(f)
|
line = readline_cont(f)
|
||||||
if line == begin_mark:
|
|
||||||
break
|
|
||||||
if not line:
|
if not line:
|
||||||
raise RuntimeError("begin mark not found")
|
raise RuntimeError("begin mark not found")
|
||||||
|
match = begin_mark.match(line)
|
||||||
|
if match:
|
||||||
|
break;
|
||||||
match = shorthand.match(line)
|
match = shorthand.match(line)
|
||||||
if match:
|
if match:
|
||||||
# TCG definitions are irrelevant for cpu models
|
# TCG definitions are irrelevant for cpu models
|
||||||
|
Loading…
Reference in New Issue
Block a user