def is_update_required(current_version, starting_condition): """Check that Firefox update is required. :param current_version: Current Firefox version. :param starting_condition: Input string. Examples of accepted formats: '60', '>60', '<60', '>=60', '<=60', '!=60', '60-63'. A '60' version will automatically be converted into '60.0.0'. :return: Call the check_version() method. """ return check_version(current_version, starting_condition)
def verify_test_compat(test, app): not_excluded = True exclude = [test.exclude] if isinstance(test.exclude, str) else [i for i in test.exclude] for item in exclude: if item in app.fx_channel or item in app.os or item in app.args.locale: not_excluded = False correct_version = True if test.fx_version == '' else check_version(app.version, test.fx_version) correct_channel = app.fx_channel in test.channel correct_locale = app.args.locale in test.locale correct_platform = app.os in test.platform result = True == correct_platform == correct_version == correct_channel == correct_locale == not_excluded return result
def verify_test_compat(test, browser): if browser.channel is None or browser.version is None: return False not_excluded = True exclude = [test.exclude] if isinstance(test.exclude, str) else [i for i in test.exclude] for item in exclude: if item in browser.channel or item in get_os() or item in browser.locale: not_excluded = False correct_version = True if test.fx_version == '' else check_version(browser.version, test.fx_version) correct_channel = browser.channel in test.channel correct_locale = parse_args().locale in test.locale correct_platform = get_os() in test.platform result = True == correct_platform == correct_version == correct_channel == correct_locale == not_excluded return result
def get_rule_for_current_channel(channel, current_version): """ :param channel: Firefox channel. :param current_version: Current Firefox version. :return: Channel's list of rules. """ result_list = filter( lambda x: x['channel'] == channel and Settings.get_os() in x['os'] and check_version(current_version, x['starting_condition']), get_update_rules()) if len(result_list) == 0: return None elif len(result_list) > 1: logger.warning('Multiple rules for "%s" channel' % channel) return result_list[0] return result_list[0]