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.
pull/5178/head
Dylan Baker 6 years ago committed by Nirbheek Chauhan
parent 023fe14238
commit f2d4a32370
  1. 3
      docs/markdown/Reference-manual.md
  2. 19
      mesonbuild/dependencies/base.py

@ -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:

@ -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):

Loading…
Cancel
Save