# 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 os.path
import sys
import platform
import multiprocessing
import yaml
from mod import log
    from mod import settings
    from mod import settings
    target_cwd = None
    dic = load_fips_yml(proj_dir)
    if 'run' in dic :
        if target in dic['run'] :
            if 'cwd' in dic['run'][target] :
                target_cwd = proj_dir + '/' + dic['run'][target]['cwd']
    return target_cwd

#-------------------------------------------------------------------------------
def is_valid_project_dir(proj_dir) :
    """test if the provided directory is a valid fips project (has a
    fips.yml file)

    :param proj_dir:    absolute project directory to check
    :returns:           True if a valid fips project
    """
    if os.path.isdir(proj_dir) :
        if not os.path.isfile(proj_dir + '/fips.yml') :
            return False
        return True
    else :
        return False

#-------------------------------------------------------------------------------
def ensure_valid_project_dir(proj_dir) :
    """test if project dir is valid, if not, dump error and abort

    :param proj_dir:    absolute project directory to check
    """
    if not is_valid_project_dir(proj_dir) :

# 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/util.py
import os.path
import sys
import platform
import multiprocessing
import yaml
from mod import log
    from mod import settings
    from mod import settings

    target_cwd = None
    dic = load_fips_yml(proj_dir)
    if 'run' in dic :
        if target in dic['run'] :
            if 'cwd' in dic['run'][target] :
                target_cwd = proj_dir + '/' + dic['run'][target]['cwd']
    return target_cwd

#-------------------------------------------------------------------------------
def is_valid_project_dir(proj_dir) :
    """test if the provided directory is a valid fips project (has a
    fips.yml file)

    :param proj_dir:    absolute project directory to check
    :returns:           True if a valid fips project
    """
    if os.path.isdir(proj_dir) :
        if not os.path.isfile(proj_dir + '/fips.yml') :
            return False
        return True
    else :
        return False

#-------------------------------------------------------------------------------
def ensure_valid_project_dir(proj_dir) :
    """test if project dir is valid, if not, dump error and abort

    :param proj_dir:    absolute project directory to check
    """
    if not is_valid_project_dir(proj_dir) :

        log.error("'{}' is not a valid project directory".format(proj_dir))