aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.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/build.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/build.py')
-rw-r--r--mesonbuild/build.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index fbc1618..4f569a6 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -463,7 +463,7 @@ class StructuredSources(HoldableObject):
represent the required filesystem layout.
"""
- sources: T.DefaultDict[str, T.List[T.Union[str, File, CustomTarget, CustomTargetIndex, GeneratedList]]] = field(
+ sources: T.DefaultDict[str, T.List[T.Union[File, CustomTarget, CustomTargetIndex, GeneratedList]]] = field(
default_factory=lambda: defaultdict(list))
def __add__(self, other: StructuredSources) -> StructuredSources:
@@ -475,30 +475,26 @@ class StructuredSources(HoldableObject):
def __bool__(self) -> bool:
return bool(self.sources)
- def first_file(self) -> T.Union[str, File, CustomTarget, CustomTargetIndex, GeneratedList]:
+ def first_file(self) -> T.Union[File, CustomTarget, CustomTargetIndex, GeneratedList]:
"""Get the first source in the root
:return: The first source in the root
"""
return self.sources[''][0]
- def as_list(self) -> T.List[T.Union[str, File, CustomTarget, CustomTargetIndex, GeneratedList]]:
+ def as_list(self) -> T.List[T.Union[File, CustomTarget, CustomTargetIndex, GeneratedList]]:
return list(itertools.chain.from_iterable(self.sources.values()))
- def needs_copy(self, target: BuildTarget) -> bool:
+ def needs_copy(self) -> bool:
"""Do we need to create a structure in the build directory.
This allows us to avoid making copies if the structures exists in the
source dir. Which could happen in situations where a generated source
only exists in some configurations
"""
- p = pathlib.Path(target.subdir)
for files in self.sources.values():
for f in files:
- if isinstance(f, str):
- if not (target.environment.source_dir / p / f).exists():
- return True
- elif isinstance(f, File):
+ if isinstance(f, File):
if f.is_built:
return True
else: