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
def GlobDirs(env, pattern): ret = [] for path in env.Glob(pattern): if os.path.isdir(path.srcnode().abspath): ret.append(path) return ret
def GlobFiles(env, pattern): ret = [] for path in env.Glob(pattern): if os.path.isfile(path.srcnode().abspath): ret.append(path) return ret
def GlobDirs(env, pattern): for path in env.Glob(pattern): if os.path.isdir(path.srcnode().abspath): yield path