def test_requirements(): if not os.access(settings.CONF_PATH, os.W_OK): logging.fatal('config directory "%s" does not exist or is not writable' % settings.CONF_PATH) sys.exit(-1) if not os.access(settings.RUN_PATH, os.W_OK): logging.fatal('pid directory "%s" does not exist or is not writable' % settings.RUN_PATH) sys.exit(-1) if not os.access(settings.LOG_PATH, os.W_OK): logging.fatal('log directory "%s" does not exist or is not writable' % settings.LOG_PATH) sys.exit(-1) if not os.access(settings.MEDIA_PATH, os.W_OK): logging.fatal('media directory "%s" does not exist or is not writable' % settings.MEDIA_PATH) sys.exit(-1) if os.geteuid() != 0: if settings.SMB_SHARES: logging.fatal('smb shares require root privileges') sys.exit(-1) if settings.ENABLE_REBOOT: logging.fatal('reboot requires root privileges') sys.exit(-1) try: import tornado # @UnusedImport except ImportError: logging.fatal('please install tornado version 3.1 or greater') sys.exit(-1) try: import jinja2 # @UnusedImport except ImportError: logging.fatal('please install jinja2') sys.exit(-1) try: import PIL.Image # @UnusedImport except ImportError: logging.fatal('please install pillow or PIL') sys.exit(-1) try: import pycurl # @UnusedImport except ImportError: logging.fatal('please install pycurl') sys.exit(-1) import motionctl has_motion = motionctl.find_motion() is not None import mediafiles has_ffmpeg = mediafiles.find_ffmpeg() is not None import v4l2ctl has_v4lutils = v4l2ctl.find_v4l2_ctl() is not None import smbctl if settings.SMB_SHARES and smbctl.find_mount_cifs() is None: logging.fatal('please install cifs-utils') sys.exit(-1) if not has_motion: logging.info('motion not installed') if not has_ffmpeg: if has_motion: logging.warn('you have motion installed, but no ffmpeg') else: logging.info('ffmpeg not installed') if not has_v4lutils: if has_motion: logging.warn('you have motion installed, but no v4l-utils') else: logging.info('v4l-utils not installed')
def test_requirements(): if not os.access(settings.CONF_PATH, os.W_OK): logging.fatal( 'config directory "%s" does not exist or is not writable' % settings.CONF_PATH) sys.exit(-1) if not os.access(settings.RUN_PATH, os.W_OK): logging.fatal('pid directory "%s" does not exist or is not writable' % settings.RUN_PATH) sys.exit(-1) if not os.access(settings.LOG_PATH, os.W_OK): logging.fatal('log directory "%s" does not exist or is not writable' % settings.LOG_PATH) sys.exit(-1) if not os.access(settings.MEDIA_PATH, os.W_OK): logging.fatal( 'media directory "%s" does not exist or is not writable' % settings.MEDIA_PATH) sys.exit(-1) if os.geteuid() != 0: if settings.SMB_SHARES: logging.fatal('smb shares require root privileges') sys.exit(-1) try: import tornado # @UnusedImport except ImportError: logging.fatal('please install tornado version 3.1 or greater') sys.exit(-1) try: import jinja2 # @UnusedImport except ImportError: logging.fatal('please install jinja2') sys.exit(-1) try: import PIL.Image # @UnusedImport except ImportError: logging.fatal('please install pillow or PIL') sys.exit(-1) try: import pycurl # @UnusedImport except ImportError: logging.fatal('please install pycurl') sys.exit(-1) import motionctl has_motion = motionctl.find_motion()[0] is not None import mediafiles has_ffmpeg = mediafiles.find_ffmpeg() is not None import v4l2ctl has_v4lutils = v4l2ctl.find_v4l2_ctl() is not None import smbctl if settings.SMB_SHARES and smbctl.find_mount_cifs() is None: logging.fatal('please install cifs-utils') sys.exit(-1) if not has_motion: logging.info('motion not installed') if not has_ffmpeg: if has_motion: logging.warn('you have motion installed, but no ffmpeg') else: logging.info('ffmpeg not installed') if not has_v4lutils: if has_motion: logging.warn('you have motion installed, but no v4l-utils') else: logging.info('v4l-utils not installed')
def _test_requirements(): if os.geteuid() != 0: if settings.SMB_SHARES: print("SMB_SHARES require root privileges") return False if settings.ENABLE_REBOOT: print("reboot requires root privileges") return False try: import tornado # @UnusedImport has_tornado = True except ImportError: has_tornado = False if update.compare_versions(tornado.version, "3.1") < 0: has_tornado = False try: import jinja2 # @UnusedImport has_jinja2 = True except ImportError: has_jinja2 = False try: import PIL.Image # @UnusedImport has_pil = True except ImportError: has_pil = False try: import pycurl # @UnusedImport has_pycurl = True except ImportError: has_pycurl = False import mediafiles has_ffmpeg = mediafiles.find_ffmpeg() is not None import motionctl has_motion = motionctl.find_motion() is not None import v4l2ctl has_v4lutils = v4l2ctl.find_v4l2_ctl() is not None has_mount_cifs = smbctl.find_mount_cifs() is not None ok = True if not has_tornado: print("please install tornado (python-tornado), version 3.1 or greater") ok = False if not has_jinja2: print("please install jinja2 (python-jinja2)") ok = False if not has_pil: print("please install PIL (python-imaging)") ok = False if not has_pycurl: print("please install pycurl (python-pycurl)") ok = False if not has_ffmpeg: print("please install ffmpeg") ok = False if not has_motion: print("please install motion") ok = False if not has_v4lutils: print("please install v4l-utils") ok = False if settings.SMB_SHARES and not has_mount_cifs: print("please install cifs-utils") ok = False return ok