diff options
-rw-r--r-- | mesonbuild/mconf.py | 4 | ||||
-rw-r--r-- | mesonbuild/modules/python.py | 17 | ||||
-rwxr-xr-x | run_unittests.py | 4 |
3 files changed, 14 insertions, 11 deletions
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index cac9d61..4f80140 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -181,7 +181,7 @@ class Conf: core_options = {k: o for k, o in self.coredata.builtins.items() if k in core_option_names} self.print_options('Core options', core_options) - if self.build.environment.is_cross_build(): + if self.default_values_only or self.build.environment.is_cross_build(): self.print_options('Core options (for host machine)', self.coredata.builtins_per_machine.host) self.print_options( 'Core options (for build machine)', @@ -190,7 +190,7 @@ class Conf: self.print_options('Core options', self.coredata.builtins_per_machine.host) self.print_options('Backend options', self.coredata.backend_options) self.print_options('Base options', self.coredata.base_options) - if self.build.environment.is_cross_build(): + if self.default_values_only or self.build.environment.is_cross_build(): self.print_options('Compiler options (for host machine)', self.coredata.compiler_options.host) self.print_options( 'Compiler options (for build machine)', 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) diff --git a/run_unittests.py b/run_unittests.py index f06be23..8cc9811 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -3624,6 +3624,10 @@ recommended as it is not supported on some platforms''') self.maxDiff = None self.assertListEqual(res_nb, res_wb) + def test_meson_configure_from_source_does_not_crash(self): + testdir = os.path.join(self.unit_test_dir, '59 introspect buildoptions') + self._run(self.mconf_command + [testdir]) + def test_introspect_json_dump(self): testdir = os.path.join(self.unit_test_dir, '57 introspection') self.init(testdir) |