diff options
author | Ross Burton <ross.burton@intel.com> | 2019-09-11 11:42:24 +0100 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-09-12 15:09:40 +0300 |
commit | ad368cfc07b1bac1aa00e51038e749040cc2dea0 (patch) | |
tree | 50ff706a87ca85e6287a092f9b9de6e425f5378b /mesonbuild/modules | |
parent | d768a76ab21f01fe34119d79d5b4b580d9fe564f (diff) | |
download | meson-ad368cfc07b1bac1aa00e51038e749040cc2dea0.zip meson-ad368cfc07b1bac1aa00e51038e749040cc2dea0.tar.gz meson-ad368cfc07b1bac1aa00e51038e749040cc2dea0.tar.bz2 |
modules/python: improve log when probing Python binary
If the Python binary that we find doesn't return valid JSON when asked to run a
small script, show the command being ran and stdout/stderr in meson-log.txt.
Fixes: #5914
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r-- | mesonbuild/modules/python.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 3a221f8..fc9ec9b 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -41,14 +41,6 @@ mod_kwargs = set(['subdir']) mod_kwargs.update(known_shmod_kwargs) mod_kwargs -= set(['name_prefix', 'name_suffix']) - -def run_command(python, command): - cmd = python.get_command() + ['-c', command] - _, stdout, _ = mesonlib.Popen_safe(cmd) - - return stdout.strip() - - class PythonDependency(ExternalDependency): def __init__(self, python_holder, environment, kwargs): @@ -568,9 +560,16 @@ class PythonModule(ExtensionModule): else: # Sanity check, we expect to have something that at least quacks in tune try: - info = json.loads(run_command(python, INTROSPECT_COMMAND)) + cmd = python.get_command() + ['-c', INTROSPECT_COMMAND] + p, stdout, stderr = mesonlib.Popen_safe(cmd) + info = json.loads(stdout) except json.JSONDecodeError: info = None + mlog.debug('Could not introspect Python (%s): exit code %d' % (str(p.args), p.returncode)) + mlog.debug('Program stdout:\n') + mlog.debug(stdout) + mlog.debug('Program stderr:\n') + mlog.debug(stderr) if isinstance(info, dict) and 'version' in info and self._check_version(name_or_path, info['version']): res = PythonInstallation(interpreter, python, info) |