use list unpacking to simplify for loop references
@@ -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()
