# Path: toolbox/config/common.py
# BUTTON_CONFIG_KEYS = {'text', 'hidden'}
# 
# CRP_TYPES = {'docker', 'gce', 'static'}
# 
# CURRENT_MAX_VERSION = 'v3.2'
# 
# CURRENT_MIN_VERSION = 'v3.1'
# 
# PROTOCOLS = {'udp', 'tcp', 'ssh', 'http', 'ws', CONTROLLER_PROTOCOL}
# 
# Path: toolbox/utils/utils.py
# def counted_error(*args, **kwargs) -> None:
#     """
#     Wrapper for logging.error that will increase the error_counter
#     """
#     global _error_counter  # pylint: disable=global-statement
#     _error_counter += 1
#     logging.error(*args, **kwargs)
# 
# def fatal_error(*args, **kwargs) -> None:
#     """
#     Abort execution with a fatal error
#     """
#     counted_error(*args, **kwargs)
#     counted_error_at_exit()


import os
import re
import yaml
    from packaging.version import parse as parse_version
    from pkg_resources import parse_version
from toolbox.config.common import BUTTON_CONFIG_KEYS, CRP_TYPES, CURRENT_MAX_VERSION, CURRENT_MIN_VERSION, PROTOCOLS
from .utils import counted_error, fatal_error


try:
except ImportError:




def compare_version(config: dict, min_version: str, max_version: str):
    version = parse_version(config['version'])

    if version < parse_version(min_version):
        return -1
    if version > parse_version(max_version):
        return 1
    return 0


def validate_version(config: dict):
    cmp = compare_version(config, CURRENT_MIN_VERSION, CURRENT_MAX_VERSION)
    if cmp < 0:

# Path: toolbox/config/common.py
# BUTTON_CONFIG_KEYS = {'text', 'hidden'}
# 
# CRP_TYPES = {'docker', 'gce', 'static'}
# 
# CURRENT_MAX_VERSION = 'v3.2'
# 
# CURRENT_MIN_VERSION = 'v3.1'
# 
# PROTOCOLS = {'udp', 'tcp', 'ssh', 'http', 'ws', CONTROLLER_PROTOCOL}
# 
# Path: toolbox/utils/utils.py
# def counted_error(*args, **kwargs) -> None:
#     """
#     Wrapper for logging.error that will increase the error_counter
#     """
#     global _error_counter  # pylint: disable=global-statement
#     _error_counter += 1
#     logging.error(*args, **kwargs)
# 
# def fatal_error(*args, **kwargs) -> None:
#     """
#     Abort execution with a fatal error
#     """
#     counted_error(*args, **kwargs)
#     counted_error_at_exit()


# Path: toolbox/utils/config.py
import os
import re
import yaml
    from packaging.version import parse as parse_version
    from pkg_resources import parse_version
from toolbox.config.common import BUTTON_CONFIG_KEYS, CRP_TYPES, CURRENT_MAX_VERSION, CURRENT_MIN_VERSION, PROTOCOLS
from .utils import counted_error, fatal_error



try:
except ImportError:




def compare_version(config: dict, min_version: str, max_version: str):
    version = parse_version(config['version'])

    if version < parse_version(min_version):
        return -1
    if version > parse_version(max_version):
        return 1
    return 0


def validate_version(config: dict):
    cmp = compare_version(config, CURRENT_MIN_VERSION, CURRENT_MAX_VERSION)
    if cmp < 0:

        fatal_error('Please, upgrade to version %s with upgrade.py!', CURRENT_MIN_VERSION)