replace ExternalProgram.from_cross_info with from_bin_list

This more generic method will also be used to check a config file for
binary information.
pull/4216/head
Dylan Baker 7 years ago
parent 5a9c9c70df
commit 95403cb615
  1. 9
      mesonbuild/dependencies/base.py
  2. 2
      mesonbuild/dependencies/ui.py
  3. 3
      mesonbuild/environment.py
  4. 2
      mesonbuild/interpreter.py
  5. 4
      mesonbuild/modules/windows.py

@ -500,7 +500,8 @@ class PkgConfigDependency(ExternalDependency):
if self.required:
raise DependencyException('Pkg-config binary missing from cross file')
else:
potential_pkgbin = ExternalProgram.from_cross_info(environment.cross_info, 'pkgconfig')
potential_pkgbin = ExternalProgram.from_bin_list(
environment.cross_info.config['binaries'], 'pkgconfig')
if potential_pkgbin.found():
self.pkgbin = potential_pkgbin
else:
@ -1076,10 +1077,10 @@ class ExternalProgram:
return ' '.join(self.command)
@staticmethod
def from_cross_info(cross_info, name):
if name not in cross_info.config['binaries']:
def from_bin_list(bins, name):
if name not in bins:
return NonExistingExternalProgram()
command = cross_info.config['binaries'][name]
command = bins[name]
if not isinstance(command, (list, str)):
raise MesonException('Invalid type {!r} for binary {!r} in cross file'
''.format(command, name))

@ -303,7 +303,7 @@ class QtBaseDependency(ExternalDependency):
# Even when cross-compiling, if a cross-info qmake is not specified, we
# fallback to using the qmake in PATH because that's what we used to do
if self.env.is_cross_build() and 'qmake' in self.env.cross_info.config['binaries']:
return ExternalProgram.from_cross_info(self.env.cross_info, 'qmake')
return ExternalProgram.from_bin_list(self.env.cross_info.config['binaries'], 'qmake')
return ExternalProgram(qmake, silent=True)
def _qmake_detect(self, mods, kwargs):

@ -340,7 +340,8 @@ class Environment:
self.cross_info = CrossBuildInfo(self.coredata.cross_file)
if 'exe_wrapper' in self.cross_info.config['binaries']:
from .dependencies import ExternalProgram
self.exe_wrapper = ExternalProgram.from_cross_info(self.cross_info, 'exe_wrapper')
self.exe_wrapper = ExternalProgram.from_bin_list(
self.cross_info.config['binaries'], 'exe_wrapper')
if 'host_machine' in self.cross_info.config:
self.machines.host = MachineInfo.from_literal(
self.cross_info.config['host_machine'])

@ -2757,7 +2757,7 @@ external dependencies (including libraries) must go to "dependencies".''')
continue # Always points to a local (i.e. self generated) file.
if not isinstance(p, str):
raise InterpreterException('Executable name must be a string')
prog = ExternalProgram.from_cross_info(cross_info, p)
prog = ExternalProgram.from_bin_list(bins, p)
if prog.found():
return ExternalProgramHolder(prog)
return None

@ -49,8 +49,8 @@ class WindowsModule(ExtensionModule):
if state.environment.is_cross_build():
# If cross compiling see if windres has been specified in the
# cross file before trying to find it another way.
cross_info = state.environment.cross_info
rescomp = ExternalProgram.from_cross_info(cross_info, 'windres')
bins = state.environment.cross_info.config['binaries']
rescomp = ExternalProgram.from_bin_list(bins, 'windres')
if not rescomp or not rescomp.found():
if 'WINDRES' in os.environ:

Loading…
Cancel
Save