| 1 |
|
| 2 |
|
| 3 |
"""Remove all brand icons from the MDI charmaps. |
| 4 |
|
| 5 |
These icons have been removed from the source package. |
| 6 |
|
| 7 |
This overwrites the existing charmap, so should only be used on |
| 8 |
the installed version. |
| 9 |
|
| 10 |
""" |
| 11 |
|
| 12 |
import json |
| 13 |
import os.path |
| 14 |
import sys |
| 15 |
|
| 16 |
|
| 17 |
with open( |
| 18 |
os.path.join(os.path.dirname(__file__), "mdi-excluded.list"), |
| 19 |
encoding="utf-8", |
| 20 |
) as excfile: |
| 21 |
excludeds = set(e.strip() for e in excfile.readlines()) |
| 22 |
|
| 23 |
metafile = sys.argv[1] |
| 24 |
|
| 25 |
with open(metafile, encoding="utf-8") as meta: |
| 26 |
icons = json.load(meta) |
| 27 |
|
| 28 |
icons_dfsg = dict(icon for icon in icons.items() if icon[0] not in excludeds) |
| 29 |
|
| 30 |
with open(metafile, "w", encoding="utf-8") as meta_dfsg: |
| 31 |
json.dump(icons_dfsg, meta_dfsg, indent=4) |