52 lines
1.3 KiB
Python
Executable File
52 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Patch an iOS Info.plist: set bundle identity, white launch screen, icons."""
|
|
import plistlib
|
|
import sys
|
|
import os
|
|
|
|
def main():
|
|
plist_path = sys.argv[1]
|
|
app_name = sys.argv[2]
|
|
bundle_id = sys.argv[3]
|
|
version = sys.argv[4]
|
|
|
|
with open(plist_path, 'rb') as f:
|
|
plist = plistlib.load(f)
|
|
|
|
# Set identity
|
|
plist['CFBundleDisplayName'] = app_name
|
|
plist['CFBundleName'] = app_name
|
|
plist['CFBundleIdentifier'] = bundle_id
|
|
plist['CFBundleShortVersionString'] = version
|
|
plist['CFBundleVersion'] = version
|
|
|
|
# White launch screen
|
|
plist.pop('UILaunchStoryboardName', None)
|
|
plist['UILaunchScreen'] = {}
|
|
|
|
# Icon references (loose PNGs)
|
|
plist['CFBundleIcons'] = {
|
|
'CFBundlePrimaryIcon': {
|
|
'CFBundleIconName': 'AppIcon',
|
|
'CFBundleIconFiles': ['AppIcon60x60'],
|
|
}
|
|
}
|
|
plist['CFBundleIcons~ipad'] = {
|
|
'CFBundlePrimaryIcon': {
|
|
'CFBundleIconFiles': [
|
|
'AppIcon60x60@2x',
|
|
'AppIcon60x60@3x',
|
|
'AppIcon76x76@2x~ipad',
|
|
],
|
|
'CFBundleIconName': 'AppIcon',
|
|
}
|
|
}
|
|
|
|
with open(plist_path, 'wb') as f:
|
|
plistlib.dump(plist, f)
|
|
|
|
print(f"OK: patched {plist_path}")
|
|
|
|
if __name__ == '__main__':
|
|
main()
|