diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2019-04-04 22:11:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-04 22:11:33 +0300 |
commit | 4f0f618fa92ed3afd9cdf11e8518c04d7b3c2c31 (patch) | |
tree | 51481cd542c27f4725873d23da75af0beff157e2 /mesonbuild/modules/python.py | |
parent | 690dd723f48b4130dcab960bf21a803ad6e5b2ee (diff) | |
parent | a710b83a677428e4cef29e86aead7f66ee8d183d (diff) | |
download | meson-4f0f618fa92ed3afd9cdf11e8518c04d7b3c2c31.zip meson-4f0f618fa92ed3afd9cdf11e8518c04d7b3c2c31.tar.gz meson-4f0f618fa92ed3afd9cdf11e8518c04d7b3c2c31.tar.bz2 |
Merge pull request #5205 from dcbaker/python-module-log
Python module log which python is found
Diffstat (limited to 'mesonbuild/modules/python.py')
-rw-r--r-- | mesonbuild/modules/python.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 34fe5a5..bd69244 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -131,7 +131,7 @@ class PythonDependency(ExternalDependency): if self.is_found: mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.green('YES ({})'.format(py_lookup_method))) 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): if python_holder.is_pypy: @@ -498,9 +498,6 @@ class PythonModule(ExtensionModule): def find_installation(self, interpreter, state, args, kwargs): feature_check = FeatureNew('Passing "feature" option to find_installation', '0.48.0') disabled, required, feature = extract_required_kwarg(kwargs, state.subproject, feature_check) - if disabled: - mlog.log('find_installation skipped: feature', mlog.bold(feature), 'disabled') - return ExternalProgramHolder(NonExistingExternalProgram()) if len(args) > 1: raise InvalidArguments('find_installation takes zero or one positional argument.') @@ -511,9 +508,12 @@ class PythonModule(ExtensionModule): if not isinstance(name_or_path, str): raise InvalidArguments('find_installation argument must be a string.') + if disabled: + mlog.log('Program', name_or_path or 'python', 'found:', mlog.red('NO'), '(disabled by:', mlog.bold(feature), ')') + return ExternalProgramHolder(NonExistingExternalProgram()) + if not name_or_path: - mlog.log("Using meson's python {}".format(mesonlib.python_command)) - python = ExternalProgram('python3', mesonlib.python_command, silent=True) + python = ExternalProgram('python3', mesonlib.python_command) else: python = ExternalProgram.from_entry('python3', name_or_path) @@ -521,14 +521,17 @@ class PythonModule(ExtensionModule): pythonpath = self._get_win_pythonpath(name_or_path) if pythonpath is not None: name_or_path = pythonpath - python = ExternalProgram(name_or_path, silent = True) + python = ExternalProgram(name_or_path, silent=True) # Last ditch effort, python2 or python3 can be named python # on various platforms, let's not give up just yet, if an executable # named python is available and has a compatible version, let's use # it 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 required: |