示例#1
0
文件: engine.py 项目: SerekKiri/moban
def verify_the_existence_of_directories(dirs):
    if not isinstance(dirs, list):
        dirs = [dirs]
    for directory in dirs:
        if os.path.exists(directory):
            continue
        should_I_ignore = (constants.DEFAULT_CONFIGURATION_DIRNAME in directory
                           or constants.DEFAULT_TEMPLATE_DIRNAME in directory)
        if should_I_ignore:
            # ignore
            pass
        else:
            raise exceptions.DirectoryNotFound(
                constants.MESSAGE_DIR_NOT_EXIST % os.path.abspath(directory))
示例#2
0
def verify_the_existence_of_directories(dirs):
    LOG.debug("Verifying the existence: %s", dirs)
    if not isinstance(dirs, list):
        dirs = [dirs]

    results = []

    for directory in dirs:

        if file_system.exists(directory):
            results.append(directory)
            continue
        should_I_ignore = (constants.DEFAULT_CONFIGURATION_DIRNAME in directory
                           or constants.DEFAULT_TEMPLATE_DIRNAME in directory)
        if should_I_ignore:
            # ignore
            pass
        else:
            raise exceptions.DirectoryNotFound(
                constants.MESSAGE_DIR_NOT_EXIST % directory)
    return results