def setup_fife(): log_paths() log_sys_info() if not find_fife(): #TODO useful error message anyone? exit_with_error('Failed to find and/or load FIFE', 'Failed to find and/or load FIFE.') from fife import fife fife_version_major = fife.getMajor() if hasattr(fife, 'getMajor') else 'unknown' fife_version_minor = fife.getMinor() if hasattr(fife, 'getMinor') else 'unknown' fife_version_patch = fife.getPatch() if hasattr(fife, 'getPatch') else 'unknown' from horizons.constants import VERSION if (fife_version_major, fife_version_minor, fife_version_patch) < VERSION.REQUIRED_FIFE_VERSION: log().warning( 'Unsupported fife version %s.%s.%s, at least %d.%d.%d required', fife_version_major, fife_version_minor, fife_version_patch, VERSION.REQUIRED_FIFE_MAJOR_VERSION, VERSION.REQUIRED_FIFE_MINOR_VERSION, VERSION.REQUIRED_FIFE_PATCH_VERSION) else: log().debug('Using fife version %s.%s.%s, at least %d.%d.%d required', fife_version_major, fife_version_minor, fife_version_patch, VERSION.REQUIRED_FIFE_MAJOR_VERSION, VERSION.REQUIRED_FIFE_MINOR_VERSION, VERSION.REQUIRED_FIFE_PATCH_VERSION)
def getVersion(cls): """ Returns a tuple including the Major, Minor and Patch version of the current running Fife. """ if (hasattr(fife, 'getMajor') and hasattr(fife, 'getMinor') and hasattr(fife, 'getPatch')): return (fife.getMajor(), fife.getMinor(), fife.getPatch()) else: cls.log.warning('Can not determine the version of the running Fife') return (0,0,0)
def getVersion(cls): """ Returns a tuple including the Major, Minor and Patch version of the current running Fife. """ if (hasattr(fife, 'getMajor') and hasattr(fife, 'getMinor') and hasattr(fife, 'getPatch')): return (fife.getMajor(), fife.getMinor(), fife.getPatch()) else: cls.log.warning( 'Can not determine the version of the running Fife') return (0, 0, 0)
def setup_fife(): log_paths() log_sys_info() if not find_fife(): #TODO useful error message anyone? exit_with_error('Failed to find and/or load FIFE', 'Failed to find and/or load FIFE.') from fife import fife fife_version_major = fife.getMajor() if hasattr(fife, 'getMajor') else 'unknown' fife_version_minor = fife.getMinor() if hasattr(fife, 'getMinor') else 'unknown' fife_version_patch = fife.getPatch() if hasattr(fife, 'getPatch') else 'unknown' from horizons.constants import VERSION if VERSION.REQUIRED_FIFE_MAJOR_VERSION > fife_version_major or VERSION.REQUIRED_FIFE_MINOR_VERSION > fife_version_minor or VERSION.REQUIRED_FIFE_PATCH_VERSION > fife_version_patch: log().warning('Unsupported fife version %s.%s.%s, at least %d.%d.%d required', fife_version_major, fife_version_minor, fife_version_patch, VERSION.REQUIRED_FIFE_MAJOR_VERSION, VERSION.REQUIRED_FIFE_MINOR_VERSION, VERSION.REQUIRED_FIFE_PATCH_VERSION) else: log().debug('Using fife version %s.%s.%s, at least %d.%d.%d required', fife_version_major, fife_version_minor, fife_version_patch, VERSION.REQUIRED_FIFE_MAJOR_VERSION, VERSION. REQUIRED_FIFE_MINOR_VERSION, VERSION.REQUIRED_FIFE_PATCH_VERSION)
def setup_fife(): log_paths() log_sys_info() paths = get_fife_paths() if not find_fife(paths): try: from fife import fife except ImportError: directories = '\n'.join(paths) exit_with_error( 'Failed to load module fife', 'Below directory paths were tested:\n' + directories) from fife import fife fife_version_major = fife.getMajor() if hasattr(fife, 'getMajor') else 'unknown' fife_version_minor = fife.getMinor() if hasattr(fife, 'getMinor') else 'unknown' fife_version_patch = fife.getPatch() if hasattr(fife, 'getPatch') else 'unknown' from horizons.constants import VERSION if (fife_version_major, fife_version_minor, fife_version_patch) < VERSION.REQUIRED_FIFE_VERSION: log().warning( 'Unsupported fife version %s.%s.%s, at least %d.%d.%d required', fife_version_major, fife_version_minor, fife_version_patch, VERSION.REQUIRED_FIFE_MAJOR_VERSION, VERSION.REQUIRED_FIFE_MINOR_VERSION, VERSION.REQUIRED_FIFE_PATCH_VERSION) else: log().debug('Using fife version %s.%s.%s, at least %d.%d.%d required', fife_version_major, fife_version_minor, fife_version_patch, VERSION.REQUIRED_FIFE_MAJOR_VERSION, VERSION.REQUIRED_FIFE_MINOR_VERSION, VERSION.REQUIRED_FIFE_PATCH_VERSION)
def getVersion(cls): """Returns a tuple (Major, Minor, Patch) version of the current running Fife.""" try: return (fife.getMajor(), fife.getMinor(), fife.getPatch()) except AttributeError: return (0, 0, 0)