#!/usr/bin/python3

"""Remove all brand icons from meta.json.

This produces a new meta.json with the brand icons removed.
"""

import json
import os.path


with open(
        os.path.join(os.path.dirname(__file__), "excluded.list"),
        encoding="utf-8",
) as excfile:
    excludeds = set(e.strip() for e in excfile.readlines())

with open("meta.json") as meta:
    icons = json.load(meta)

icons_dfsg = [icon for icon in icons if icon["name"] not in excludeds]

with open("meta-dfsg.json", "w") as meta_dfsg:
    json.dump(icons_dfsg, meta_dfsg, separators=(",", ":"))
