aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter/interpreter.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-03-18 10:28:38 -0700
committerDylan Baker <dylan@pnwbakers.com>2022-03-18 19:46:24 -0700
commitf9445300b3015308fd6a3e0305cf8e5b7f002211 (patch)
treee63608c837b8d37b6924485cc7c8cf688355c449 /mesonbuild/interpreter/interpreter.py
parent7c20890a05481e97eee57a147f50237087a1c94e (diff)
downloadmeson-f9445300b3015308fd6a3e0305cf8e5b7f002211.zip
meson-f9445300b3015308fd6a3e0305cf8e5b7f002211.tar.gz
meson-f9445300b3015308fd6a3e0305cf8e5b7f002211.tar.bz2
structured_sources: fix subdir handling
We currently don't handle subdirectories correctly in structured_sources, which is problematic. To make this easier to handle correctly, I've simply changed `structured_sources` to only use Files and not strings as an implementation detail.
Diffstat (limited to 'mesonbuild/interpreter/interpreter.py')
-rw-r--r--mesonbuild/interpreter/interpreter.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index b5e990a..ecbfd7a 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -2122,11 +2122,13 @@ external dependencies (including libraries) must go to "dependencies".''')
args: T.Tuple[object, T.Optional[T.Dict[str, object]]],
kwargs: 'TYPE_kwargs') -> build.StructuredSources:
valid_types = (str, mesonlib.File, build.GeneratedList, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList)
- sources: T.Dict[str, T.List[T.Union['mesonlib.FileOrString', 'build.GeneratedTypes']]] = collections.defaultdict(list)
+ sources: T.Dict[str, T.List[T.Union[mesonlib.File, 'build.GeneratedTypes']]] = collections.defaultdict(list)
for arg in mesonlib.listify(args[0]):
if not isinstance(arg, valid_types):
raise InvalidArguments(f'structured_sources: type "{type(arg)}" is not valid')
+ if isinstance(arg, str):
+ arg = mesonlib.File.from_source_file(self.environment.source_dir, self.subdir, arg)
sources[''].append(arg)
if args[1]:
if '' in args[1]:
@@ -2135,6 +2137,8 @@ external dependencies (including libraries) must go to "dependencies".''')
for arg in mesonlib.listify(v):
if not isinstance(arg, valid_types):
raise InvalidArguments(f'structured_sources: type "{type(arg)}" is not valid')
+ if isinstance(arg, str):
+ arg = mesonlib.File.from_source_file(self.environment.source_dir, self.subdir, arg)
sources[k].append(arg)
return build.StructuredSources(sources)