aboutsummaryrefslogtreecommitdiff
path: root/scripts/codeconverter/converter.py
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2020-09-16 14:25:15 -0400
committerEduardo Habkost <ehabkost@redhat.com>2020-09-18 14:12:32 -0400
commit4a15e5bef8ec4322d4192dc4ab0b6149d415b990 (patch)
tree7200625d72f5a5188d4c38ade13d426d85991ede /scripts/codeconverter/converter.py
parentf62192a2fddb65e7e6e8955a29eee2fe6f0916a8 (diff)
scripts/codeconverter: Update to latest version
I'm not documenting every single change in the codeconverter script because most of that code will be deleted once we finish the QOM code conversion. This patch updates the script to the latest version that was used to perform changes in the QOM code. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20200916182519.415636-2-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'scripts/codeconverter/converter.py')
-rwxr-xr-xscripts/codeconverter/converter.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/codeconverter/converter.py b/scripts/codeconverter/converter.py
index ebaf9b57ce..75cb515d93 100755
--- a/scripts/codeconverter/converter.py
+++ b/scripts/codeconverter/converter.py
@@ -42,7 +42,7 @@ def process_all_files(parser: argparse.ArgumentParser, args: argparse.Namespace)
for t in f.matches_of_type(TypeInfoVar):
assert isinstance(t, TypeInfoVar)
values = [f.filename, t.name] + \
- [t.get_initializer_value(f).raw
+ [t.get_raw_initializer_value(f)
for f in TI_FIELDS]
DBG('values: %r', values)
assert all('\t' not in v for v in values)
@@ -55,18 +55,18 @@ def process_all_files(parser: argparse.ArgumentParser, args: argparse.Namespace)
parser.error("--pattern is required")
classes = [p for arg in args.patterns
- for p in re.split(r'[\s,]', arg)]
+ for p in re.split(r'[\s,]', arg)
+ if p.strip()]
for c in classes:
- if c not in match_classes:
+ if c not in match_classes \
+ or not match_classes[c].regexp:
print("Invalid pattern name: %s" % (c), file=sys.stderr)
print("Valid patterns:", file=sys.stderr)
print(PATTERN_HELP, file=sys.stderr)
sys.exit(1)
DBG("classes: %r", classes)
- for f in files:
- DBG("patching contents of %s", f.filename)
- f.patch_content(max_passes=args.passes, class_names=classes)
+ files.patch_content(max_passes=args.passes, class_names=classes)
for f in files:
#alltypes.extend(f.type_infos)