From eafed4b8ad3ebbc56a1545e0b2e85bdef2bf0173 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 5 Oct 2021 09:35:55 -0700 Subject: [PATCH] modules: use IncludeDirs.to_string_list instead of open coding This both allows more cod re-use, and simplifies the code. --- mesonbuild/modules/__init__.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/mesonbuild/modules/__init__.py b/mesonbuild/modules/__init__.py index 53f166003..7eab2cbc4 100644 --- a/mesonbuild/modules/__init__.py +++ b/mesonbuild/modules/__init__.py @@ -72,18 +72,9 @@ class ModuleState: for dirs in include_dirs: if isinstance(dirs, str): dirs_str += [f'{prefix}{dirs}'] - continue - - # Should be build.IncludeDirs object. - basedir = dirs.get_curdir() - for d in dirs.get_incdirs(): - expdir = os.path.join(basedir, d) - srctreedir = os.path.join(srcdir, expdir) - buildtreedir = os.path.join(builddir, expdir) - dirs_str += [f'{prefix}{buildtreedir}', - f'{prefix}{srctreedir}'] - for d in dirs.get_extra_build_dirs(): - dirs_str += [f'{prefix}{d}'] + else: + dirs_str.extend([f'{prefix}{i}' for i in dirs.to_string_list(srcdir, builddir)]) + dirs_str.extend([f'{prefix}{i}' for i in dirs.get_extra_build_dirs()]) return dirs_str