def do_image_complete(d):
    from oe.utils import execute_pre_post_process
    from pathlib import Path
    import json

    post_process_cmds = d.getVar("IMAGE_POSTPROCESS_COMMAND")

    execute_pre_post_process(d, post_process_cmds)

    image_manifest_dir = Path(d.getVar('IMGMANIFESTDIR'))

    data = []

    for manifest_path in image_manifest_dir.glob("*.json"):
        with manifest_path.open("r") as f:
            data.extend(json.load(f))

    with open(d.getVar("IMAGE_OUTPUT_MANIFEST"), "w") as f:
        json.dump(data, f)

do_image_complete(d)

