File indexing completed on 2024-11-10 04:57:14

0001 #!/usr/bin/env python3
0002 # SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0003 # SPDX-FileCopyrightText: 2022 Alex Richardson <arichardson.kde@gmail.com>
0004 # SPDX-License-Identifier: GPL-2.0-or-later
0005 #
0006 # This little helper strips unnecessary information from builtin effect metadata files to
0007 # reduce the size of kwin executables and json parsing runtime overhead.
0008 
0009 import argparse
0010 import json
0011 
0012 def main():
0013     parser = argparse.ArgumentParser(prog="kwin-strip-effect-metadata")
0014     parser.add_argument("--source", help="input file", required=True)
0015     parser.add_argument("--output", help="output file", required=True)
0016     args = parser.parse_args()
0017     stripped_json = dict(KPlugin=dict())
0018     with open(args.source, "r") as src:
0019         original_json = json.load(src)
0020         stripped_json["KPlugin"]["EnabledByDefault"] = original_json["KPlugin"]["EnabledByDefault"]
0021 
0022     with open(args.output, "w") as dst:
0023         json.dump(stripped_json, dst)
0024 
0025 
0026 if __name__ == "__main__":
0027     main()