aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2019-03-28 08:56:10 -0700
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2019-03-29 21:27:54 +0000
commitf2d4a32370bb94e0f63ddb5f9f38d93dcab8687b (patch)
treee4443e5741c65ac3a34eda402a72e450409d53c0
parent023fe1423890bf27f537e315246a95c0b6fa382e (diff)
downloadmeson-f2d4a32370bb94e0f63ddb5f9f38d93dcab8687b.zip
meson-f2d4a32370bb94e0f63ddb5f9f38d93dcab8687b.tar.gz
meson-f2d4a32370bb94e0f63ddb5f9f38d93dcab8687b.tar.bz2
dependencies/base: Pass correct arguments to subdependencies
Currently InternalDependency.get_partial_dependency shadows the the input variables names, and then passes those new copies to the final object returned. It also passes them to the arguments of of get_partial_dependency for each subdependency, which is wrong. The code is supposed to proxy the original argumetn values to that instead of the shadowing values. To avoid that this patch renames the new values.
-rw-r--r--docs/markdown/Reference-manual.md3
-rw-r--r--mesonbuild/dependencies/base.py19
2 files changed, 13 insertions, 9 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index 7668fa0..490ccf0 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -2148,6 +2148,9 @@ an external dependency with the following methods:
dep3 will add `['-Werror=foo', '-Werror=bar']` to the compiler args
of any target it is added to, but libfoo will not be added to the
link_args.
+
+ *Note*: A bug present until 0.51.0 results in the above behavior
+ not working correctly.
The following arguments will add the following attributes:
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 1b8818d..a08a677 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -204,18 +204,19 @@ class InternalDependency(Dependency):
def get_partial_dependency(self, *, compile_args: bool = False,
link_args: bool = False, links: bool = False,
includes: bool = False, sources: bool = False):
- compile_args = self.compile_args.copy() if compile_args else []
- link_args = self.link_args.copy() if link_args else []
- libraries = self.libraries.copy() if links else []
- whole_libraries = self.whole_libraries.copy() if links else []
- sources = self.sources.copy() if sources else []
- includes = self.include_directories.copy() if includes else []
- deps = [d.get_partial_dependency(
+ final_compile_args = self.compile_args.copy() if compile_args else []
+ final_link_args = self.link_args.copy() if link_args else []
+ final_libraries = self.libraries.copy() if links else []
+ final_whole_libraries = self.whole_libraries.copy() if links else []
+ final_sources = self.sources.copy() if sources else []
+ final_includes = self.include_directories.copy() if includes else []
+ final_deps = [d.get_partial_dependency(
compile_args=compile_args, link_args=link_args, links=links,
includes=includes, sources=sources) for d in self.ext_deps]
return InternalDependency(
- self.version, includes, compile_args, link_args, libraries,
- whole_libraries, sources, deps)
+ self.version, final_includes, final_compile_args,
+ final_link_args, final_libraries, final_whole_libraries,
+ final_sources, final_deps)
class ExternalDependency(Dependency):