Inline check_compilers

This function is used just once. It also seems all policy and no
mechanism (it raises, it calls the same function to do all the work
twice in a simple way). This makes it seem to be as a good candidate for
inlining.

`environment` and `coredata` are woefully intertwined and while this
change doesn't fix that, but at least it makes it easier to follow.
pull/4924/head
John Ericson 6 years ago committed by Jussi Pakkanen
parent 4e5edff60f
commit 3037ade41d
  1. 8
      mesonbuild/environment.py
  2. 6
      mesonbuild/interpreter.py

@ -1127,14 +1127,6 @@ class Environment:
return comp, cross_comp
def check_compilers(self, lang: str, comp: Compiler, cross_comp: Compiler):
if comp is None:
raise EnvironmentException('Tried to use unknown language "%s".' % lang)
comp.sanity_check(self.get_scratch_dir(), self)
if cross_comp:
cross_comp.sanity_check(self.get_scratch_dir(), self)
def detect_compilers(self, lang: str, need_cross_compiler: bool):
(comp, cross_comp) = self.compilers_from_language(lang, need_cross_compiler)
if comp is not None:

@ -2696,7 +2696,11 @@ external dependencies (including libraries) must go to "dependencies".''')
else:
try:
(comp, cross_comp) = self.environment.detect_compilers(lang, need_cross_compiler)
self.environment.check_compilers(lang, comp, cross_comp)
if comp is None:
raise InvalidArguments('Tried to use unknown language "%s".' % lang)
comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
if cross_comp:
cross_comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
except Exception:
if not required:
mlog.log('Compiler for language', mlog.bold(lang), 'not found.')

Loading…
Cancel
Save