# -*- coding: utf-8 -*- import sys import os from hardware import Hardware def check_dependencies(): """ Check for needed external dependencies. """ print("Check dependencies…") check_os() check_user() check_connected_hardware() print("… checked.\n") def check_user(): """ Check for running user. SU should not be run as root. """ if os.getuid() == 0: print("Do not run SU as root") sys.exit() else: print(" * user id %s" % os.getuid()) def check_os(): """ We do not support Windows """ if os.name != "posix": print("Only Linux is supported at the moment!") sys.exit() else: print(" * posix system") def check_connected_hardware(): """ Output connected and supported rf hardware. """ devices = Hardware().get_connected_supported_devices() if len(devices) == 0: print(" * no rf hardware connected") else: print(" * connected rf hardware:") for device in devices: print(" - %s (%s)" % (device['name'], device['id']))