macOS: Add headless support: calibre command-line utilities can now run on macOS machines without a screen

This commit is contained in:
Kovid Goyal 2017-06-26 16:31:42 +05:30
parent 9768d16334
commit eafd29fc42
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 2 deletions

View File

@ -1282,7 +1282,7 @@ def ensure_app(headless=True):
with _ea_lock:
if _store_app is None and QApplication.instance() is None:
args = sys.argv[:1]
has_headless = islinux or isbsd
has_headless = isosx or islinux or isbsd
if headless and has_headless:
args += ['-platformpluginpath', sys.extensions_location, '-platform', 'headless']
_store_app = QApplication(args)

View File

@ -163,7 +163,7 @@ class BuildTest(unittest.TestCase):
from calibre.gui2 import Application
os.environ.pop('DISPLAY', None)
has_headless = islinux
has_headless = isosx or islinux
app = Application([], headless=has_headless)
self.assertGreaterEqual(len(QFontDatabase().families()), 5, 'The QPA headless plugin is not able to locate enough system fonts via fontconfig')
if has_headless: