Example #1
0
def get_user_includes(environ):
    """Returns all user includes in the given environment."""

    # '#/a/b/c' and '#a/b/c' both need to be 'a/b/c'
    re_sconstruct_dir = re.compile(r'(#[%s]?)?(.*)' % re.escape(os.path.sep))

    def normalize(path):
        sconstruct_dir = re_sconstruct_dir.split(path)
        return path if len(sconstruct_dir) < 3 else os.path.abspath(sconstruct_dir[2])

    includes = set()
    for path in environ['CPPPATH']:
        if isinstance(path, str):
            new_path = normalize(environ.subst(path))
            if os.path.isdir(new_path):
                includes.add(new_path)
        else:
            includes.add(normalize(path.srcnode().abspath))
    return includes
def get_user_includes(environ):
    """Returns all user includes in the given environment."""

    # '#/a/b/c' and '#a/b/c' both need to be 'a/b/c'
    re_sconstruct_dir = re.compile(r'(#[%s]?)?(.*)' % re.escape(os.path.sep))

    def normalize(path):
        sconstruct_dir = re_sconstruct_dir.split(path)
        return path if len(sconstruct_dir) < 3 else os.path.abspath(
            sconstruct_dir[2])

    includes = set()
    for path in environ['CPPPATH']:
        if isinstance(path, str):
            new_path = normalize(environ.subst(path))
            if os.path.isdir(new_path):
                includes.add(new_path)
        else:
            includes.add(normalize(path.srcnode().abspath))
    return includes
Example #3
0
File: fs.py Project: qaws01395/roc
def GlobDirs(env, pattern):
    ret = []
    for path in env.Glob(pattern):
        if os.path.isdir(path.srcnode().abspath):
            ret.append(path)
    return ret
Example #4
0
File: fs.py Project: qaws01395/roc
def GlobFiles(env, pattern):
    ret = []
    for path in env.Glob(pattern):
        if os.path.isfile(path.srcnode().abspath):
            ret.append(path)
    return ret
Example #5
0
def GlobDirs(env, pattern):
    for path in env.Glob(pattern):
        if os.path.isdir(path.srcnode().abspath):
            yield path