modules/python: Report program found in find_installation()

Currently find_installation is silent, which is pretty annoying. Let's
log it.
pull/5205/head
Dylan Baker 6 years ago
parent 3d04e5a150
commit 82346a2bd2
  1. 8
      mesonbuild/modules/python.py
  2. 2
      test cases/python/1 basic/meson.build

@ -131,7 +131,7 @@ class PythonDependency(ExternalDependency):
if self.is_found: if self.is_found:
mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.green('YES ({})'.format(py_lookup_method))) mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.green('YES ({})'.format(py_lookup_method)))
else: else:
mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.red('NO')) mlog.log('Dependency', mlog.bold(self.name), 'found:', [mlog.red('NO')])
def _find_libpy(self, python_holder, environment): def _find_libpy(self, python_holder, environment):
if python_holder.is_pypy: if python_holder.is_pypy:
@ -512,8 +512,7 @@ class PythonModule(ExtensionModule):
raise InvalidArguments('find_installation argument must be a string.') raise InvalidArguments('find_installation argument must be a string.')
if not name_or_path: if not name_or_path:
mlog.log("Using meson's python {}".format(mesonlib.python_command)) python = ExternalProgram('python3', mesonlib.python_command)
python = ExternalProgram('python3', mesonlib.python_command, silent=True)
else: else:
python = ExternalProgram.from_entry('python3', name_or_path) python = ExternalProgram.from_entry('python3', name_or_path)
@ -530,6 +529,9 @@ class PythonModule(ExtensionModule):
if not python.found() and name_or_path in ['python2', 'python3']: if not python.found() and name_or_path in ['python2', 'python3']:
python = ExternalProgram('python', silent=True) python = ExternalProgram('python', silent=True)
mlog.log('Program', python.name, 'found:',
*[mlog.green('YES'), '({})'.format(' '.join(python.command))] if python.found() else [mlog.red('NO')])
if not python.found(): if not python.found():
if required: if required:
raise mesonlib.MesonException('{} not found'.format(name_or_path or 'python')) raise mesonlib.MesonException('{} not found'.format(name_or_path or 'python'))

@ -1,7 +1,7 @@
project('python sample', 'c') project('python sample', 'c')
py_mod = import('python') py_mod = import('python')
py = py_mod.find_installation() py = py_mod.find_installation('python3')
py_version = py.language_version() py_version = py.language_version()
if py_version.version_compare('< 3.2') if py_version.version_compare('< 3.2')

Loading…
Cancel
Save