mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-04 03:27:00 -05:00 
			
		
		
		
	macOS: Add headless support: calibre command-line utilities can now run on macOS machines without a screen
This commit is contained in:
		
							parent
							
								
									9768d16334
								
							
						
					
					
						commit
						eafd29fc42
					
				@ -1282,7 +1282,7 @@ def ensure_app(headless=True):
 | 
				
			|||||||
    with _ea_lock:
 | 
					    with _ea_lock:
 | 
				
			||||||
        if _store_app is None and QApplication.instance() is None:
 | 
					        if _store_app is None and QApplication.instance() is None:
 | 
				
			||||||
            args = sys.argv[:1]
 | 
					            args = sys.argv[:1]
 | 
				
			||||||
            has_headless = islinux or isbsd
 | 
					            has_headless = isosx or islinux or isbsd
 | 
				
			||||||
            if headless and has_headless:
 | 
					            if headless and has_headless:
 | 
				
			||||||
                args += ['-platformpluginpath', sys.extensions_location, '-platform', 'headless']
 | 
					                args += ['-platformpluginpath', sys.extensions_location, '-platform', 'headless']
 | 
				
			||||||
            _store_app = QApplication(args)
 | 
					            _store_app = QApplication(args)
 | 
				
			||||||
 | 
				
			|||||||
@ -163,7 +163,7 @@ class BuildTest(unittest.TestCase):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        from calibre.gui2 import Application
 | 
					        from calibre.gui2 import Application
 | 
				
			||||||
        os.environ.pop('DISPLAY', None)
 | 
					        os.environ.pop('DISPLAY', None)
 | 
				
			||||||
        has_headless = islinux
 | 
					        has_headless = isosx or islinux
 | 
				
			||||||
        app = Application([], headless=has_headless)
 | 
					        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')
 | 
					        self.assertGreaterEqual(len(QFontDatabase().families()), 5, 'The QPA headless plugin is not able to locate enough system fonts via fontconfig')
 | 
				
			||||||
        if has_headless:
 | 
					        if has_headless:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user