Navigation Menu

Skip to content

Commit

Permalink
Build: OSX: Automatically set Info.plist LSBackgroundOnly=True when c…
Browse files Browse the repository at this point in the history
…onsole=True
  • Loading branch information
BoboTiG committed Jun 15, 2018
1 parent d63a0bb commit b387398
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 2 additions & 0 deletions PyInstaller/building/api.py
Expand Up @@ -628,6 +628,7 @@ def __init__(self, *args, **kws):
from ..config import CONF
Target.__init__(self)
self.strip_binaries = kws.get('strip', False)
self.console = True

if CONF['hasUPX']:
self.upx_binaries = kws.get('upx', False)
Expand All @@ -650,6 +651,7 @@ def __init__(self, *args, **kws):
elif isinstance(arg, Target):
self.toc.append((os.path.basename(arg.name), arg.name, arg.typ))
if isinstance(arg, EXE):
self.console = arg.console
for tocnm, fnm, typ in arg.toc:
if tocnm == os.path.basename(arg.name) + ".manifest":
self.toc.append((tocnm, fnm, typ))
Expand Down
15 changes: 7 additions & 8 deletions PyInstaller/building/osx.py
Expand Up @@ -46,6 +46,7 @@ def __init__(self, *args, **kws):
self.toc = TOC()
self.strip = False
self.upx = False
self.console = True

# .app bundle identifier for Code Signing
self.bundle_identifier = kws.get('bundle_identifier')
Expand All @@ -61,6 +62,7 @@ def __init__(self, *args, **kws):
self.toc.extend(arg.dependencies)
self.strip = arg.strip
self.upx = arg.upx
self.console = arg.console
elif isinstance(arg, TOC):
self.toc.extend(arg)
# TOC doesn't have a strip or upx attribute, so there is no way for us to
Expand All @@ -69,6 +71,7 @@ def __init__(self, *args, **kws):
self.toc.extend(arg.toc)
self.strip = arg.strip_binaries
self.upx = arg.upx_binaries
self.console = arg.console
else:
logger.info("unsupported entry %s", arg.__class__.__name__)
# Now, find values for app filepath (name), app name (appname), and name
Expand Down Expand Up @@ -137,20 +140,16 @@ def assemble(self):
"CFBundlePackageType": "APPL",
"CFBundleShortVersionString": self.version,

# Setting this to 1 will cause Mac OS X *not* to show
# a dock icon for the PyInstaller process which
# decompresses the real executable's contents. As a
# side effect, the main application doesn't get one
# as well, but at startup time the loader will take
# care of transforming the process type.
"LSBackgroundOnly": False,

}

# Merge info_plist settings from spec file
if isinstance(self.info_plist, dict) and self.info_plist:
info_plist_dict.update(self.info_plist)

# Setting EXE console=True implicitely sets LSBackgroundOnly to True
if self.console:
info_plist_dict['LSBackgroundOnly'] = True

plist_filename = os.path.join(self.name, "Contents", "Info.plist")
try:
# python >= 3.4
Expand Down

0 comments on commit b387398

Please sign in to comment.