# Path: mod/log.py
# RED = '\033[1;31m'
# GREEN = '\033[1;32m'
# YELLOW = '\033[1;33m'
# BLUE = '\033[1;36m'
# DEF = '\033[0;0m'
# def error(msg, fatal=True) :
# def warn(msg) :
# def ok(item, status) :
# def failed(item, status) :
# def optional(item, status) :
# def info(msg) :
# def colored(color, msg) :


import subprocess
from mod import log
"""wrapper for cmake tool"""


name = 'cmake'
platforms = ['linux', 'osx', 'win']
optional = False
not_found = 'please install cmake 2.8 or newer'

#------------------------------------------------------------------------------
def check_exists(fips_dir, major=2, minor=8) :
    """test if cmake is in the path and has the required version

    :returns:   True if cmake found and is the required version
    """
    try:
        out = subprocess.check_output(['cmake', '--version']).decode("utf-8")
        ver = out.split()[2].split('.')
        if int(ver[0]) > major or (int(ver[0]) == major and int(ver[1]) >= minor):
            return True
        else :
            log.info('{}NOTE{}: cmake must be at least version {}.{} (found: {}.{}.{})'.format(

# Path: mod/log.py
# RED = '\033[1;31m'
# GREEN = '\033[1;32m'
# YELLOW = '\033[1;33m'
# BLUE = '\033[1;36m'
# DEF = '\033[0;0m'
# def error(msg, fatal=True) :
# def warn(msg) :
# def ok(item, status) :
# def failed(item, status) :
# def optional(item, status) :
# def info(msg) :
# def colored(color, msg) :


# Path: mod/tools/cmake.py
import subprocess
from mod import log

"""wrapper for cmake tool"""


name = 'cmake'
platforms = ['linux', 'osx', 'win']
optional = False
not_found = 'please install cmake 2.8 or newer'

#------------------------------------------------------------------------------
def check_exists(fips_dir, major=2, minor=8) :
    """test if cmake is in the path and has the required version

    :returns:   True if cmake found and is the required version
    """
    try:
        out = subprocess.check_output(['cmake', '--version']).decode("utf-8")
        ver = out.split()[2].split('.')
        if int(ver[0]) > major or (int(ver[0]) == major and int(ver[1]) >= minor):
            return True
        else :
            log.info('{}NOTE{}: cmake must be at least version {}.{} (found: {}.{}.{})'.format(

                    log.RED, log.DEF, major, minor, ver[0],ver[1],ver[2]))