Fix regression that caused calibre running in debug mode on OS X to not have a menubar or dock icon

This commit is contained in:
Kovid Goyal 2014-09-08 20:40:45 +05:30
parent eac34e2ba7
commit f6e42f4cc1
2 changed files with 9 additions and 6 deletions

View File

@ -612,7 +612,7 @@ class Py2App(object):
@flush
def create_gui_apps(self):
info('\nCreating launcher apps for viewer and editor')
for launcher in ('ebook-viewer', 'ebook-edit'):
for launcher in ('ebook-viewer', 'ebook-edit', 'calibre-debug'):
cc_dir = os.path.join(self.contents_dir, launcher + '.app', 'Contents')
os.makedirs(cc_dir)
for x in os.listdir(self.contents_dir):
@ -620,9 +620,12 @@ class Py2App(object):
continue
if x == 'Info.plist':
plist = plistlib.readPlist(join(self.contents_dir, x))
plist['CFBundleDisplayName'] = plist['CFBundleName'] = {'ebook-viewer':'E-book Viewer', 'ebook-edit':'Edit Book'}[launcher]
plist['CFBundleExecutable'] = launcher
plist['CFBundleIconFile'] = launcher + '.icns'
plist['CFBundleDisplayName'] = plist['CFBundleName'] = {
'ebook-viewer':'E-book Viewer', 'ebook-edit':'Edit Book', 'calibre-debug': 'calibre (debug)',
}[launcher]
if launcher != 'calibre-debug':
plist['CFBundleExecutable'] = launcher
plist['CFBundleIconFile'] = launcher + '.icns'
plist['CFBundleIdentifier'] = 'com.calibre-ebook.' + launcher
plist.pop('CFBundleDocumentTypes')
plistlib.writePlist(plist, join(cc_dir, x))

View File

@ -294,8 +294,8 @@ def get_debug_executable():
e = sys.executable if getattr(sys, 'frozen', False) else sys.argv[0]
if hasattr(sys, 'frameworks_dir'):
base = os.path.dirname(sys.frameworks_dir)
if 'console.app' not in base:
base = os.path.join(base, 'console.app', 'Contents')
if 'calibre-debug.app' not in base:
base = os.path.join(base, 'calibre-debug.app', 'Contents')
exe = os.path.basename(e)
if '-debug' not in exe:
exe += '-debug'