Пример #1
0
def required_depcheck():
    required = []

    status, version = depcheck.test_translate()
    if status:
        text = _('Translate Toolkit version %s installed.', version)
        state = 'good'
    else:
        text = _('Translate Toolkit version %(installed)s installed. Pootle requires version %(required)s.', {'installed': version, 'required': "1.7.0"})
        state = 'error'
    required.append({'dependency': 'translate', 'state': state, 'text': text })

    status, version = depcheck.test_django()
    if status:
        text = _('Django version %s is installed.', version)
        state = 'good'
    else:
        text = _('Django version %s is installed. Pootle only works with the 1.x series.')
        state = 'error'
    required.append({'dependency': 'django', 'state': state, 'text': text})

    status, version = depcheck.test_lxml()
    if status:
        text = _('lxml version %s installed.', version)
        state = 'good'
    elif version is not None:
        text = _('lxml version %(installed)s. Pootle requires version %(required)s for parsing and exporting XML translation formats', {'installed': version, 'required': "2.1.4"})
        state = 'error'
    else:
        text = _('lxml not installed, Pootle requires lxml for parsing and exporting XML translation formats')
        state = 'error'
    required.append({'dependency': 'lxml', 'state': state, 'text': text})
    return required
Пример #2
0
def required_depcheck():
    required = []

    status, version = depcheck.test_translate()
    if status:
        text = _('Translate Toolkit version %s installed.', version)
        state = 'good'
    else:
        text = _('Translate Toolkit version %(installed)s installed. Pootle requires at least version %(required)s.', {'installed': version, 'required': ".".join(depcheck.translate_required_ver)})
        state = 'error'
    required.append({'dependency': 'translate', 'state': state, 'text': text})

    status, version = depcheck.test_django()
    if status:
        text = _('Django version %s is installed.', version)
        state = 'good'
    else:
        text = _('Django version %s is installed, but a higher version is highly recommended.', version)
        state = 'error'
    required.append({'dependency': 'django', 'state': state, 'text': text})

    status, version = depcheck.test_lxml()
    if status:
        text = _('lxml version %s is installed.', version)
        state = 'good'
    elif version is not None:
        text = _('lxml version %(installed)s is installed. Pootle requires at least version %(required)s for XML format support.', {'installed': version, 'required': ".".join(depcheck.lxml_required_ver)})
        state = 'error'
    else:
        text = _('lxml is not installed. Pootle requires lxml for XML format support.')
        state = 'error'
    required.append({'dependency': 'lxml', 'state': state, 'text': text})
    return required
Пример #3
0
def required_depcheck():
    required = []

    status, version = depcheck.test_translate()
    if status:
        text = _('Translate Toolkit version %s installed.', version)
        state = 'tick'
    else:
        trans_vars = {
            'installed': version,
            'required':
            ".".join(str(i) for i in depcheck.translate_required_ver)
        }
        text = _(
            "Translate Toolkit version %(installed)s installed. Pootle "
            "requires at least version %(required)s.", trans_vars)
        state = 'error'
    required.append({'dependency': 'translate', 'state': state, 'text': text})

    status, version = depcheck.test_django()
    if status:
        text = _('Django version %s is installed.', version)
        state = 'tick'
    else:
        text = _(
            "Django version %s is installed, but a higher version is "
            "highly recommended.", version)
        state = 'error'
    required.append({'dependency': 'django', 'state': state, 'text': text})

    status, version = depcheck.test_lxml()
    if status:
        text = _('lxml version %s is installed.', version)
        state = 'tick'
    elif version is not None:
        required_ver = ".".join(str(i) for i in depcheck.lxml_required_ver)
        text = _(
            "lxml version %(installed)s is installed. Pootle requires at "
            "least version %(required)s.", {
                'installed': version,
                'required': required_ver,
            })
        state = 'error'
    else:
        text = _('lxml is not installed. Pootle requires lxml.')
        state = 'error'

    required.append({'dependency': 'lxml', 'state': state, 'text': text})

    return required
Пример #4
0
def required_depcheck():
    required = []

    status, version = depcheck.test_translate()
    if status:
        text = _('Translate Toolkit version %s installed.', version)
        state = 'tick'
    else:
        trans_vars = {
            'installed': version,
            'required': ".".join(str(i) for i in depcheck.translate_required_ver)
        }
        text = _("Translate Toolkit version %(installed)s installed. Pootle "
                 "requires at least version %(required)s.", trans_vars)
        state = 'error'
    required.append({'dependency': 'translate', 'state': state, 'text': text})

    status, version = depcheck.test_django()
    if status:
        text = _('Django version %s is installed.', version)
        state = 'tick'
    else:
        text = _("Django version %s is installed, but a higher version is "
                 "highly recommended.", version)
        state = 'error'
    required.append({'dependency': 'django', 'state': state, 'text': text})

    status, version = depcheck.test_lxml()
    if status:
        text = _('lxml version %s is installed.', version)
        state = 'tick'
    elif version is not None:
        required_ver = ".".join(str(i) for i in depcheck.lxml_required_ver)
        text = _("lxml version %(installed)s is installed. Pootle requires at "
                 "least version %(required)s.", {
                     'installed': version,
                     'required': required_ver,
                 })
        state = 'error'
    else:
        text = _('lxml is not installed. Pootle requires lxml.')
        state = 'error'

    required.append({'dependency': 'lxml', 'state': state, 'text': text})

    return required
Пример #5
0
def required_depcheck():
    required = []

    status, version = depcheck.test_translate()
    if status:
        text = _("Translate Toolkit version %s installed.", version)
        state = "tick"
    else:
        text = _(
            "Translate Toolkit version %(installed)s installed. Pootle requires at least version %(required)s.",
            {"installed": version, "required": ".".join(str(i) for i in depcheck.translate_required_ver)},
        )
        state = "error"
    required.append({"dependency": "translate", "state": state, "text": text})

    status, version = depcheck.test_django()
    if status:
        text = _("Django version %s is installed.", version)
        state = "tick"
    else:
        text = _("Django version %s is installed, but a higher version is highly recommended.", version)
        state = "error"
    required.append({"dependency": "django", "state": state, "text": text})

    status, version = depcheck.test_lxml()
    if status:
        text = _("lxml version %s is installed.", version)
        state = "tick"
    elif version is not None:
        required_ver = ".".join(str(i) for i in depcheck.lxml_required_ver)
        text = _(
            "lxml version %(installed)s is installed. Pootle requires " "at least version %(required)s.",
            {"installed": version, "required": required_ver},
        )
        state = "error"
    else:
        text = _("lxml is not installed. Pootle requires lxml.")
        state = "error"

    required.append({"dependency": "lxml", "state": state, "text": text})

    return required
Пример #6
0
def required_depcheck():
    required = []

    status, version = depcheck.test_translate()
    if status:
        text = _('Translate Toolkit version %s installed.', version)
        state = 'good'
    else:
        text = _('Translate Toolkit version %(installed)s installed. Pootle requires version %(required)s.', {'installed': version, 'required': "1.7.0"})
        state = 'error'
    required.append({'dependency': 'translate', 'state': state, 'text': text })

    status, version = depcheck.test_django()
    if status:
        text = _('Django version %s is installed.', version)
        state = 'good'
    else:
        text = _('Django version %s is installed. Pootle only works with the 1.x series.')
        state = 'error'
    required.append({'dependency': 'django', 'state': state, 'text': text})

    return required
Пример #7
0
def required_depcheck():
    required = []

    status, version = depcheck.test_translate()
    if status:
        text = _('Translate Toolkit version %s installed.', version)
        state = 'tick'
    else:
        trans_vars = {
            'installed': version,
            'required': ".".join([str(i) for i in
                                  depcheck.TTK_MINIMUM_REQUIRED_VERSION]),
        }
        text = _("Translate Toolkit version %(installed)s installed. Pootle "
                 "requires at least version %(required)s.", trans_vars)
        state = 'error'

    required.append({
        'dependency': 'translate',
        'state': state,
        'text': text,
    })

    status, version = depcheck.test_django()
    if status:
        text = _('Django version %s is installed.', version)
        state = 'tick'
    else:
        trans_vars = {
            'installed': version,
            'required': ".".join([str(i) for i in
                                  depcheck.DJANGO_MINIMUM_REQUIRED_VERSION]),
        }
        text = _("Django version %(installed)s is installed. Pootle requires "
                 "at least version %(required)s.", trans_vars)
        state = 'error'

    required.append({
        'dependency': 'django',
        'state': state,
        'text': text,
    })

    status, version = depcheck.test_lxml()
    if status:
        text = _('lxml version %s is installed.', version)
        state = 'tick'
    elif version is not None:
        trans_vars = {
            'installed': version,
            'required': ".".join([str(i) for i in
                                  depcheck.LXML_MINIMUM_REQUIRED_VERSION]),
        }
        text = _("lxml version %(installed)s is installed. Pootle requires at "
                 "least version %(required)s.", trans_vars)
        state = 'error'
    else:
        text = _('lxml is not installed. Pootle requires lxml.')
        state = 'error'

    required.append({
        'dependency': 'lxml',
        'state': state,
        'text': text,
    })

    return required
Пример #8
0
def required_depcheck():
    required = []

    status, version = depcheck.test_translate()
    if status:
        text = _('Translate Toolkit version %s installed.', version)
        state = 'tick'
    else:
        trans_vars = {
            'installed':
            version,
            'required':
            ".".join([str(i) for i in depcheck.TTK_MINIMUM_REQUIRED_VERSION]),
        }
        text = _(
            "Translate Toolkit version %(installed)s installed. Pootle "
            "requires at least version %(required)s.", trans_vars)
        state = 'error'

    required.append({
        'dependency': 'translate',
        'state': state,
        'text': text,
    })

    status, version = depcheck.test_django()
    if status:
        text = _('Django version %s is installed.', version)
        state = 'tick'
    else:
        trans_vars = {
            'installed':
            version,
            'required':
            ".".join(
                [str(i) for i in depcheck.DJANGO_MINIMUM_REQUIRED_VERSION]),
        }
        text = _(
            "Django version %(installed)s is installed. Pootle requires "
            "at least version %(required)s.", trans_vars)
        state = 'error'

    required.append({
        'dependency': 'django',
        'state': state,
        'text': text,
    })

    status, version = depcheck.test_lxml()
    if status:
        text = _('lxml version %s is installed.', version)
        state = 'tick'
    elif version is not None:
        trans_vars = {
            'installed':
            version,
            'required':
            ".".join([str(i) for i in depcheck.LXML_MINIMUM_REQUIRED_VERSION]),
        }
        text = _(
            "lxml version %(installed)s is installed. Pootle requires at "
            "least version %(required)s.", trans_vars)
        state = 'error'
    else:
        text = _('lxml is not installed. Pootle requires lxml.')
        state = 'error'

    required.append({
        'dependency': 'lxml',
        'state': state,
        'text': text,
    })

    return required
Пример #9
0
def required_depcheck():
    required = []

    status, version = depcheck.test_translate()
    if status:
        text = _('Translate Toolkit version %s installed.', version)
        state = 'tick'
    else:
        trans_vars = {
            'installed':
            version,
            'required':
            ".".join([str(i) for i in depcheck.TTK_MINIMUM_REQUIRED_VERSION]),
        }
        text = _(
            "Translate Toolkit version %(installed)s installed. Pootle "
            "requires at least version %(required)s.", trans_vars)
        state = 'error'

    required.append({
        'dependency': 'translate',
        'state': state,
        'text': text,
    })

    status, version = depcheck.test_django()
    if status:
        text = _('Django version %s is installed.', version)
        state = 'tick'
    else:
        trans_vars = {
            'installed':
            version,
            'required':
            ".".join(
                [str(i) for i in depcheck.DJANGO_MINIMUM_REQUIRED_VERSION]),
        }
        text = _(
            "Django version %(installed)s is installed. Pootle requires "
            "at least version %(required)s.", trans_vars)
        state = 'error'

    required.append({
        'dependency': 'django',
        'state': state,
        'text': text,
    })

    status, version = depcheck.test_lxml()
    if status:
        text = _('lxml version %s is installed.', version)
        state = 'tick'
    elif version is not None:
        trans_vars = {
            'installed':
            version,
            'required':
            ".".join([str(i) for i in depcheck.LXML_MINIMUM_REQUIRED_VERSION]),
        }
        text = _(
            "lxml version %(installed)s is installed. Pootle requires at "
            "least version %(required)s.", trans_vars)
        state = 'error'
    else:
        text = _('lxml is not installed. Pootle requires lxml.')
        state = 'error'

    required.append({
        'dependency': 'lxml',
        'state': state,
        'text': text,
    })

    status_redis_available, connection_settings = depcheck.test_redis_server_available(
    )
    if status_redis_available:
        status_redis_version, version = depcheck.test_redis_server_version()
        if status_redis_version:
            text = _(
                'Redis server accepting connections on '
                '%(host)s:%(port)s.', connection_settings)
            state = 'tick'
        else:
            trans_vars = {
                'installed':
                version,
                'required':
                ".".join([
                    str(i)
                    for i in depcheck.REDIS_MINIMUM_REQUIRED_SERVER_VERSION
                ]),
            }
            text = _(
                "Redis server version %(installed)s installed. Pootle "
                "requires at least version %(required)s.", trans_vars)
            state = 'error'
    else:
        text = _('Redis server is not available on %(host)s:%(port)s.',
                 connection_settings)
        state = 'error'

    required.append({
        'dependency': 'redis',
        'state': state,
        'text': text,
    })

    status_workers, connection_settings[
        'num'] = depcheck.test_rq_workers_running()
    if status_workers:
        text = ungettext('%(num)d RQ worker running.',
                         '%(num)d RQ workers running.',
                         connection_settings['num'], connection_settings)
        state = 'tick'
    else:
        text = _('No RQ workers are running.')
        state = 'error'
    required.append({
        'dependency': 'rq',
        'state': state,
        'text': text,
    })

    if depcheck.test_cache():
        if not depcheck.test_cache_server_connection():
            # Server configured but connection failing
            required.append({
                'dependency':
                'cache',
                'state':
                'error',
                'text':
                _("Pootle is configured to use Redis as a caching "
                  "backend, but can't connect to the cache.")
            })
        else:
            required.append({
                'dependency': 'cache',
                'state': 'tick',
                'text': _("Caching configured and running.")
            })
    else:
        required.append({
            'dependency': 'cache',
            'state': 'error',
            'text': _("Redis is required as the caching backend.")
        })

    return required