The re.sub() call replaces every hyphen in 'what' with the system module infix. This produces broken filenames for multi-hyphen names (e.g. 'qapi-type-infos' becomes 'qapi-builtin-type-builtin-infos').
Add count=1 so only the first hyphen is replaced. Signed-off-by: Marc-André Lureau <[email protected]> --- scripts/qapi/gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index 0c9b8db3b02..690187d4280 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -300,7 +300,7 @@ def _module_basename(self, what: str, name: str) -> str: ret += '-' + os.path.splitext(basename)[0] else: assert QAPISchemaModule.is_system_module(name) - ret += re.sub(r'-', '-' + name[2:] + '-', what) + ret += re.sub(r'-', '-' + name[2:] + '-', what, count=1) return ret def _module_filename(self, what: str, name: str) -> str: -- 2.54.0
