acknowledgements.py (Source)

import os
import sys
import plistlib
from pathlib import Path
os.chdir(sys.path[0])
plist = {'PreferenceSpecifiers': [], 'StringsTable': 'Acknowledgements'}
for filename in os.listdir("."):
    if filename.endswith(".license"):
        current_file = open(filename, 'r')
        title = filename.split(".license")[0]
        file_content = current_file.read().strip()
        group = {'Type': 'PSGroupSpecifier', 'Title': title, 'FooterText': file_content} #noqa
        plist['PreferenceSpecifiers'].append(group)
filepath = Path('../Settings.bundle/Acknowledgements.plist')
filepath.unlink()
with open(filepath.absolute(), "wb") as outfile:
    plistlib.dump(plist, outfile)