Commits

Anthony Tuininga committed 07e031c Merge

Merged in takluyver/cx_freeze/mac-iconfile (pull request #13)

Add iconfile option for bdist_mac

  • Participants
  • Parent commits 65e5e3d, a9cf946

Comments (0)

Files changed (2)

File cx_Freeze/macdist.py

 <plist version="1.0">
 <dict>
 	<key>CFBundleIconFile</key>
-	<string>%(bundle_iconfile)s</string>
+	<string>icon.icns</string>
 	<key>CFBundleDevelopmentRegion</key>
 	<string>English</string>
 	<key>CFBundleExecutable</key>
     description = "create a Mac application bundle"
 
     user_options = [
-        ('bundle-iconfile=', None, 'Name of the application bundle icon ' \
-                'file as stored in the Info.plist file'),
+        ('iconfile=', None, 'Path to an icns icon file for the application.'),
         ('qt-menu-nib=', None, 'Location of qt_menu.nib folder for Qt ' \
                 'applications. Will be auto-detected by default.')
     ]
 
     def initialize_options(self):
-        self.bundle_iconfile = 'icon.icns'
+        self.iconfile = None
         self.qt_menu_nib = False
 
     def finalize_options(self):
             path = os.path.join(libpath, subpath)
             if os.path.exists(path):
                 return path
-
+            
+        # Last resort: fixed paths (macports)
+        for path in ['/opt/local/Library/Frameworks/QtGui.framework/Versions/4/Resources/qt_menu.nib']:
+            if os.path.exists(path):
+                return path
+        
+        print ("Could not find qt_menu.nib")
         raise IOError("Could not find qt_menu.nib")
 
     def prepare_qt_app(self):
         self.mkpath(self.binDir)
 
         self.copy_tree(build.build_exe, self.binDir)
+        
+        # Copy the icon
+        if self.iconfile:
+            self.copy_file(self.iconfile, os.path.join(self.resourcesDir, 'icon.icns'))
 
         # Create the Info.plist file
         self.execute(self.create_plist,())

File doc/distutils.rst

 +-----------------------+-----------------------------------------------------+
 | option name           | description                                         |
 +=======================+=====================================================+
-| bundle-iconfile       | Name of the application bundle icon file as stored  |
-|                       | in the Info.plist file.                             |
+| iconfile              | Path to an icns icon file for the application. This |
+|                       | will be copied into the bundle.                     |
++-----------------------+-----------------------------------------------------+
+| qt-menu-nib           | Path to the qt-menu.nib file for Qt applications.   |
+|                       | By default, it will be auto-detected.               |
 +-----------------------+-----------------------------------------------------+
 
  .. versionadded:: 4.3
+ 
+ .. versionchanged:: 4.3.2
+    Added the ``iconfile`` option.
 
 bdist_dmg
 `````````