コード例 #1
0
def reqdir(*paths):
    '''
    Return the absolute path of the joining of the arguments, raising an exception if a directory does not exist at
    the resulting path.

    Performs home directory(~) and environment variable expansion.

    Args:
        *paths ([str,...]): A list of path elements
    '''
    path = genpath(*paths)
    if not os.path.isdir(path):
        raise s_exc.NoSuchDir(path=path)
    return path
コード例 #2
0
ファイル: stemcell.py プロジェクト: vishalbelsare/synapse
def getStemCell(dirn):

    if not os.path.isdir(dirn):
        mesg = f'Directory {dirn} does not exist!'
        raise s_exc.NoSuchDir(mesg=mesg)

    ctorname = os.getenv('SYN_STEM_CELL_CTOR')

    cellyaml = os.path.join(dirn, 'cell.yaml')

    if os.path.isfile(cellyaml):
        conf = s_common.yamlload(cellyaml)
        ctorname = conf.get('cell:ctor', ctorname)

    if ctorname is not None:
        ctorname = ctorname.strip()
        ctor = s_dyndeps.getDynLocal(ctorname)
        if ctor is None:
            raise s_exc.NoSuchCtor(mesg=f'Unable to resolve ctor [{ctorname}]',
                                   ctor=ctorname)
        return ctor

    mesg = f'No such file: {cellyaml} and SYN_STEM_CELL_CTOR environmt variable is not set.'
    raise s_exc.NoSuchFile(mesg=mesg, path=cellyaml)
コード例 #3
0
def reqdir(*paths):
    path = genpath(*paths)
    if not os.path.isdir(path):
        raise s_exc.NoSuchDir(path=path)
    return path