aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter/interpreter.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2022-03-21 23:16:41 +0200
committerGitHub <noreply@github.com>2022-03-21 23:16:41 +0200
commit42af1f7092c9cfdcffd2b7ba021dc8e5d392aa8c (patch)
treef66d713eed1e6b63b2523f91dca1d67fa47a28f6 /mesonbuild/interpreter/interpreter.py
parentadc509ed98694d3c7a7b0c578c94cb3a886c21eb (diff)
parentcf4d02d82a2e9d455a3d40ced6f7a07d6467fd98 (diff)
downloadmeson-42af1f7092c9cfdcffd2b7ba021dc8e5d392aa8c.zip
meson-42af1f7092c9cfdcffd2b7ba021dc8e5d392aa8c.tar.gz
meson-42af1f7092c9cfdcffd2b7ba021dc8e5d392aa8c.tar.bz2
Merge pull request #10147 from dcbaker/submit/structured-sources-subdir
structured_sources: fix subdir handling
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)