aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-01-06 11:29:54 -0800
committerDylan Baker <dylan@pnwbakers.com>2021-02-06 10:27:04 -0800
commit5f624657a0238157e7786478335e25e3fe9c2ca0 (patch)
treee1fa1464257cc5e568c79cd18b8ce27ed98dbb12
parent4082a3db454469bbc9dbef85cd31d1133ff24065 (diff)
downloadmeson-5f624657a0238157e7786478335e25e3fe9c2ca0.zip
meson-5f624657a0238157e7786478335e25e3fe9c2ca0.tar.gz
meson-5f624657a0238157e7786478335e25e3fe9c2ca0.tar.bz2
Add a method to IncludeDirs to convert to string list
I'm going to use this in the rust module as well, so having a single source of truth is useful.
-rw-r--r--mesonbuild/build.py7
-rw-r--r--mesonbuild/interpreter.py4
2 files changed, 8 insertions, 3 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 36bce1c..8968b18 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -323,6 +323,13 @@ class IncludeDirs:
def get_extra_build_dirs(self):
return self.extra_build_dirs
+ def to_string_list(self, sourcedir: str) -> T.List[str]:
+ """Convert IncludeDirs object to a list of strings."""
+ strlist: T.List[str] = []
+ for idir in self.incdirs:
+ strlist.append(os.path.join(sourcedir, self.curdir, idir))
+ return strlist
+
class ExtractedObjects:
'''
Holds a list of sources for which the objects must be extracted
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index e5404c2..5a7a604 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1132,9 +1132,7 @@ class CompilerHolder(InterpreterObject):
for i in incdirs:
if not isinstance(i, IncludeDirsHolder):
raise InterpreterException('Include directories argument must be an include_directories object.')
- for idir in i.held_object.get_incdirs():
- idir = os.path.join(self.environment.get_source_dir(),
- i.held_object.get_curdir(), idir)
+ for idir in i.held_object.to_string_list(self.environment.get_source_dir()):
args += self.compiler.get_include_args(idir, False)
if not nobuiltins:
opts = self.environment.coredata.options