Browse Source

deploy-ng: add icon support for macOS (#468)

Mitchell Stokes 6 years ago
parent
commit
d3c9199d9f
1 changed files with 9 additions and 0 deletions
  1. 9 0
      direct/src/dist/commands.py

+ 9 - 0
direct/src/dist/commands.py

@@ -506,6 +506,15 @@ class build_apps(setuptools.Command):
             'CFBundleSignature': '', #TODO
             'CFBundleSignature': '', #TODO
             'CFBundleExecutable': self.macos_main_app,
             'CFBundleExecutable': self.macos_main_app,
         }
         }
+
+        icon = self.icon_objects.get(
+            self.macos_main_app,
+            self.icon_objects.get('*', None)
+        )
+        if icon is not None:
+            plist['CFBundleIconFile'] = 'iconfile'
+            icon.makeICNS(os.path.join(resdir, 'iconfile.icns'))
+
         with open(os.path.join(contentsdir, 'Info.plist'), 'wb') as f:
         with open(os.path.join(contentsdir, 'Info.plist'), 'wb') as f:
             if hasattr(plistlib, 'dump'):
             if hasattr(plistlib, 'dump'):
                 plistlib.dump(plist, f)
                 plistlib.dump(plist, f)