21 lines
815 B
Python
21 lines
815 B
Python
"""Check common desktop prerequisites before Qt can abort the process."""
|
|
import ctypes
|
|
import os
|
|
import sys
|
|
|
|
|
|
def desktop_error():
|
|
if not sys.platform.startswith('linux'):
|
|
return None
|
|
backend = os.environ.get('QT_QPA_PLATFORM', '').split(':')[0]
|
|
uses_xcb = backend == 'xcb' or (not backend and os.environ.get('DISPLAY') and not os.environ.get('WAYLAND_DISPLAY'))
|
|
if uses_xcb:
|
|
try:
|
|
ctypes.CDLL('libxcb-cursor.so.0')
|
|
except OSError:
|
|
return ('Samsara needs the Qt X11 cursor library. On Debian-based desktops run:\n'
|
|
' sudo apt install libxcb-cursor0\n'
|
|
'Then retry: python -m samsara.main\n'
|
|
'For other Linux distributions install the package providing libxcb-cursor.so.0.')
|
|
return None
|