How to use the errbot.utils.version2tuple function in errbot

To help you get started, we’ve selected a few errbot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github errbotio / errbot / errbot / plugin_info.py View on Github external
try:
                    python_version = tuple(version2tuple(python_version)[0:3])  # We can ignore the alpha/beta part.
                except ValueError as ve:
                    raise ConfigParserError(f'Invalid Python Version format: {python_version} ({ve})')

        min_version = config.get('Errbot', 'Min', fallback=None)
        max_version = config.get('Errbot', 'Max', fallback=None)
        try:
            if min_version:
                min_version = version2tuple(min_version)
        except ValueError as ve:
            raise ConfigParserError(f'Invalid Errbot min version format: {min_version} ({ve})')

        try:
            if max_version:
                max_version = version2tuple(max_version)
        except ValueError as ve:
            raise ConfigParserError(f'Invalid Errbot max version format: {max_version} ({ve})')
        depends_on = config.get('Core', 'DependsOn', fallback=None)
        deps = [name.strip() for name in depends_on.split(',')] if depends_on else []

        return PluginInfo(name, module, doc, core, python_version, min_version, max_version, deps)
github errbotio / errbot / errbot / plugin_info.py View on Github external
if python_version:
            if python_version in ('2+', '3'):
                python_version = (3, 0, 0)
            elif python_version == '2':
                python_version = (2, 0, 0)
            else:
                try:
                    python_version = tuple(version2tuple(python_version)[0:3])  # We can ignore the alpha/beta part.
                except ValueError as ve:
                    raise ConfigParserError(f'Invalid Python Version format: {python_version} ({ve})')

        min_version = config.get('Errbot', 'Min', fallback=None)
        max_version = config.get('Errbot', 'Max', fallback=None)
        try:
            if min_version:
                min_version = version2tuple(min_version)
        except ValueError as ve:
            raise ConfigParserError(f'Invalid Errbot min version format: {min_version} ({ve})')

        try:
            if max_version:
                max_version = version2tuple(max_version)
        except ValueError as ve:
            raise ConfigParserError(f'Invalid Errbot max version format: {max_version} ({ve})')
        depends_on = config.get('Core', 'DependsOn', fallback=None)
        deps = [name.strip() for name in depends_on.split(',')] if depends_on else []

        return PluginInfo(name, module, doc, core, python_version, min_version, max_version, deps)
github errbotio / errbot / errbot / plugin_info.py View on Github external
"""
        name = config.get('Core', 'Name')
        module = config.get('Core', 'Module')
        core = config.get('Core', 'Core', fallback='false').lower() == 'true'
        doc = config.get('Documentation', 'Description', fallback=None)

        python_version = config.get('Python', 'Version', fallback=None)
        # Old format backward compatibility
        if python_version:
            if python_version in ('2+', '3'):
                python_version = (3, 0, 0)
            elif python_version == '2':
                python_version = (2, 0, 0)
            else:
                try:
                    python_version = tuple(version2tuple(python_version)[0:3])  # We can ignore the alpha/beta part.
                except ValueError as ve:
                    raise ConfigParserError(f'Invalid Python Version format: {python_version} ({ve})')

        min_version = config.get('Errbot', 'Min', fallback=None)
        max_version = config.get('Errbot', 'Max', fallback=None)
        try:
            if min_version:
                min_version = version2tuple(min_version)
        except ValueError as ve:
            raise ConfigParserError(f'Invalid Errbot min version format: {min_version} ({ve})')

        try:
            if max_version:
                max_version = version2tuple(max_version)
        except ValueError as ve:
            raise ConfigParserError(f'Invalid Errbot max version format: {max_version} ({ve})')
github errbotio / errbot / errbot / plugin_manager.py View on Github external
def check_errbot_version(plugin_info: PluginInfo):
    """ Checks if a plugin version between min_version and max_version is ok
    for this errbot.
    Raises IncompatiblePluginException if not.
    """
    name, min_version, max_version = plugin_info.name, plugin_info.errbot_minversion, plugin_info.errbot_maxversion
    current_version = version2tuple(VERSION)
    if min_version and min_version > current_version:
        raise IncompatiblePluginException(f'The plugin {name} asks for Errbot with a minimal version of '
                                          f'{min_version} while Errbot is version {VERSION}.')

    if max_version and max_version < current_version:
        raise IncompatiblePluginException(f'The plugin {name} asks for Errbot with a maximum version of {max_version} '
                                          f'while Errbot is version {VERSION}')