This commit is contained in:
Kovid Goyal 2020-03-21 08:50:57 +05:30
commit 04488ada06
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -858,11 +858,24 @@ def macos_info_plist() -> bytes:
def create_macos_app_icon(where: str = 'Resources') -> None: def create_macos_app_icon(where: str = 'Resources') -> None:
logo_dir = os.path.abspath(os.path.join('logo', appname + '.iconset')) iconset_dir = os.path.abspath(os.path.join('logo', appname + '.iconset'))
subprocess.check_call([ icns_dir = os.path.join(where, appname + '.icns')
'iconutil', '-c', 'icns', logo_dir, '-o', try:
os.path.join(where, os.path.basename(logo_dir).partition('.')[0] + '.icns') subprocess.check_call([
]) 'iconutil', '-c', 'icns', iconset_dir, '-o', icns_dir
])
except FileNotFoundError:
print(error('iconutil not found') + ', using png2icns (without retina support) to convert the logo', file=sys.stderr)
subprocess.check_call([
'png2icns', icns_dir
] + [os.path.join(iconset_dir, logo) for logo in [
# png2icns does not support retina icons, so only pass the non-retina icons
'icon_16x16.png',
'icon_32x32.png',
'icon_128x128.png',
'icon_256x256.png',
'icon_512x512.png',
]])
def create_minimal_macos_bundle(args: Options, where: str) -> None: def create_minimal_macos_bundle(args: Options, where: str) -> None: