From 47ae0b82f0483960fa7a3eabc68700b982688834 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 3 Oct 2021 20:01:40 -0400 Subject: [PATCH] use list unpacking to simplify for loop references --- mesonbuild/mintro.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index ab668d530..c664abdab 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -492,14 +492,15 @@ updated_introspection_files = [] # type: T.List[str] def write_intro_info(intro_info: T.Sequence[T.Tuple[str, T.Union[dict, T.List[T.Any]]]], info_dir: str) -> None: global updated_introspection_files - for i in intro_info: - out_file = os.path.join(info_dir, 'intro-{}.json'.format(i[0])) + for kind, data in intro_info: + print(f'processing {kind}, {data}') + out_file = os.path.join(info_dir, f'intro-{kind}.json') tmp_file = os.path.join(info_dir, 'tmp_dump.json') with open(tmp_file, 'w', encoding='utf-8') as fp: - json.dump(i[1], fp) + json.dump(data, fp) fp.flush() # Not sure if this is needed os.replace(tmp_file, out_file) - updated_introspection_files += [i[0]] + updated_introspection_files += [kind] def generate_introspection_file(builddata: build.Build, backend: backends.Backend) -> None: coredata = builddata.environment.get_coredata()