aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-10-05 09:35:55 -0700
committerDylan Baker <dylan@pnwbakers.com>2021-11-01 12:24:25 -0700
commiteafed4b8ad3ebbc56a1545e0b2e85bdef2bf0173 (patch)
treea75712486fbfaa761b985d6d71ab687ccce4e0a4 /mesonbuild
parent68c1669ae6a7715b11e7e7859c659ce286d08890 (diff)
downloadmeson-eafed4b8ad3ebbc56a1545e0b2e85bdef2bf0173.zip
meson-eafed4b8ad3ebbc56a1545e0b2e85bdef2bf0173.tar.gz
meson-eafed4b8ad3ebbc56a1545e0b2e85bdef2bf0173.tar.bz2
modules: use IncludeDirs.to_string_list instead of open coding
This both allows more cod re-use, and simplifies the code.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/modules/__init__.py15
1 files changed, 3 insertions, 12 deletions
diff --git a/mesonbuild/modules/__init__.py b/mesonbuild/modules/__init__.py
index 53f1660..7eab2cb 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