fenrir/check-dependencies.py

233 lines
5.7 KiB
Python
Raw Normal View History

2024-12-06 01:08:46 -05:00
#!/usr/bin/env python3
2017-05-03 12:15:05 -04:00
import os, sys
# default installation
# core
# speech: speech-dispatcher
# sound: sox
# braille: brltty:
2020-03-03 15:56:44 -05:00
defaultInstallation = ['FenrirCore','vcsaDriver','dummyDriver (braille)','evdevDriver','genericDriver (speech)', 'genericDriver (sound)']
2017-05-03 12:15:05 -04:00
currentInstallation = []
print('checking dependencys...')
# CORE
print('')
print('fenrir core:')
available = True
try:
from daemonize import Daemonize
print('python3-daemonize: OK')
except:
print('python3-daemonize: FAIL')
available = available and False
try:
import enchant
print('pyenchant: OK')
except:
print('pyenchant: FAIL')
available = available and False
if available:
currentInstallation.append('FenrirCore')
# SCREEN
2018-06-08 17:53:52 -04:00
print('--------------------')
2017-05-03 12:15:05 -04:00
print('screen driver')
2020-03-03 15:56:44 -05:00
# dummy and debug
print('dummyDriver (screen): OK')
currentInstallation.append('dummyDriver (screen)')
2017-05-03 12:15:05 -04:00
# VCSA (screen driver)
print('vcsaDriver')
available = True
try:
import dbus
print('python3-dbus: OK')
except:
print('python3-dbus: FAIL')
available = available and False
if os.path.exists('/dev/vcsa'):
print('VCSA Device: OK')
else:
print('VCSA Device: FAIL')
available = available and False
if available:
currentInstallation.append('vcsaDriver')
2018-06-08 17:53:52 -04:00
print('')
2018-05-15 03:23:11 -04:00
# pty emulation (screen driver)
2018-05-15 16:41:07 -04:00
print('ptyDriver')
2018-05-15 03:23:11 -04:00
available = True
try:
import pyte
print('pyte: OK')
except:
print('pyte: FAIL')
available = available and False
if available:
2018-05-15 16:41:07 -04:00
currentInstallation.append('ptyDriver (screen)')
2018-05-15 03:23:11 -04:00
2017-05-03 12:15:05 -04:00
# BRAILLE
2018-06-08 17:53:52 -04:00
print('--------------------')
2017-05-03 12:15:05 -04:00
print('braille driver')
2020-03-03 15:56:44 -05:00
# dummy and debug
print('dummyDriver (braille): OK')
currentInstallation.append('dummyDriver (braille)')
print('debugDriver (braille): OK')
currentInstallation.append('debugDriver (braille)')
2017-05-03 12:15:05 -04:00
# brltty (braille driver)
print('brlapiDriver')
available = True
try:
import brlapi
print('python3-brlapi: OK')
except:
print('python3-brlapi: FAIL')
available = available and False
if available:
currentInstallation.append('brlapiDriver')
# INPUT
2018-06-08 17:53:52 -04:00
print('--------------------')
2017-05-03 12:15:05 -04:00
print('input driver')
2020-03-03 15:56:44 -05:00
# dummy and debug
print('dummyDriver (input): OK')
currentInstallation.append('dummyDriver (input)')
print('debugDriver (input): OK')
currentInstallation.append('debugDriver (input)')
2017-05-03 12:15:05 -04:00
# evdev (input driver)
print('evdevDriver')
available = True
try:
import evdev
from evdev import InputDevice, UInput
print('python3-evdev: OK')
except:
print('python3-evdev: FAIL')
2020-03-03 15:56:44 -05:00
available = available and False
2017-07-12 07:01:05 -04:00
try:
import pyudev
print('python3-pyudev: OK')
except:
print('python3-pyudev: FAIL')
2020-03-03 15:56:44 -05:00
available = available and False
2017-05-03 12:15:05 -04:00
if available:
currentInstallation.append('evdevDriver')
2018-05-15 03:23:11 -04:00
# pty emulation (input driver)
2018-06-08 17:53:52 -04:00
print('')
2018-05-15 16:41:07 -04:00
print('ptyDriver')
2018-05-15 03:23:11 -04:00
available = True
try:
import pyte
print('pyte: OK')
except:
print('pyte: FAIL')
2020-03-03 15:56:44 -05:00
available = available and False
2018-05-15 03:23:11 -04:00
if available:
2020-03-03 15:56:44 -05:00
currentInstallation.append('ptyDriver (Input)')
2017-05-03 12:15:05 -04:00
# SOUND
2018-06-08 17:53:52 -04:00
print('--------------------')
2017-05-03 12:15:05 -04:00
print('sound driver')
2020-03-03 15:56:44 -05:00
# dummy and debug
print('dummyDriver (sound): OK')
currentInstallation.append('dummyDriver (sound)')
print('debugDriver (sound): OK')
currentInstallation.append('debugDriver (sound)')
2017-05-03 12:15:05 -04:00
print('genericDriver (uses sox by default)')
available = True
if os.path.exists('/usr/bin/play') and os.path.exists('/usr/bin/sox'):
print('sox: OK')
else:
print('sox: FAIL')
2020-03-03 15:56:44 -05:00
available = available and False
2017-05-03 12:15:05 -04:00
if available:
2018-06-08 17:53:52 -04:00
currentInstallation.append('genericDriver (sound)')
print('')
2017-05-03 12:15:05 -04:00
# gstreamer (sound driver)
print('gstreamerDriver')
available = True
try:
import gi
print('gi: OK')
except:
print('gi: FAIL')
2020-03-03 15:56:44 -05:00
available = available and False
2017-05-03 12:15:05 -04:00
try:
from gi.repository import GLib
print('gi GLib: OK')
except:
print('gi GLib: FAIL')
2020-03-03 15:56:44 -05:00
available = available and False
2017-05-03 12:15:05 -04:00
try:
gi.require_version('Gst', '1.0')
from gi.repository import Gst
print('gi Gst: OK')
except:
2020-03-03 15:56:44 -05:00
print('gi Gst: FAIL')
available = available and False
2017-05-03 12:15:05 -04:00
if available:
currentInstallation.append('gstreamerDriver')
# SPEECH
2018-06-08 17:53:52 -04:00
print('--------------------')
2017-05-03 12:15:05 -04:00
print('speech driver')
2020-03-03 15:56:44 -05:00
# dummy and debug
print('dummyDriver (speech): OK')
currentInstallation.append('dummyDriver (speech)')
print('debugDriver (speech): OK')
currentInstallation.append('debugDriver (speech)')
2017-05-03 12:15:05 -04:00
# speechd (speech driver)
print('speechdDriver')
available = True
try:
import speechd
print('python3-speechd: OK')
except:
print('python3-speechd: FAIL')
2020-03-03 15:56:44 -05:00
available = available and False
2017-05-03 12:15:05 -04:00
if available:
currentInstallation.append('speechdDriver')
2018-06-08 17:53:52 -04:00
print('')
2017-05-03 12:15:05 -04:00
# espeak (speech driver)
print('espeakDriver')
available = True
try:
from espeak import espeak
print('python3-espeak: OK')
except:
print('python3-espeak: FAIL')
2020-03-03 15:56:44 -05:00
available = available and False
2017-05-03 12:15:05 -04:00
if available:
2020-03-03 15:56:44 -05:00
currentInstallation.append('espeakDriver')
print('genericDriver (uses espeak-ng by default)')
2018-06-08 17:53:52 -04:00
available = True
if os.path.exists('/usr/bin/espeak-ng') or os.path.exists('/bin/espeak-ng'):
print('espeak-ng: OK')
2018-06-08 17:53:52 -04:00
else:
print('espeak-ng: FAIL')
2018-06-08 17:53:52 -04:00
available = available and False
if available:
2020-03-03 15:56:44 -05:00
currentInstallation.append('genericDriver (speech)')
2017-05-03 12:15:05 -04:00
# SUMMERY
2018-06-08 17:53:52 -04:00
print('====================')
2017-05-03 12:15:05 -04:00
available = True
missing = []
for element in defaultInstallation:
if not element in currentInstallation:
available = False
missing.append(element)
if available:
print('Default Setup: OK')
else:
print('Default Setup: FAIL')
print('Unavailable Default Modules:')
for e in missing:
print(e)
print('you may need to install the missing dependencys for the modules above or reconfigure fenrir to not use them')
print('')
print('Available Modules:')
for element in currentInstallation:
print(element)