aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/modules/python3.py5
-rw-r--r--mesonbuild/modules/windows.py5
-rwxr-xr-xrun_unittests.py3
-rw-r--r--test cases/unit/46 native file binary/meson.build4
-rw-r--r--test cases/unit/46 native file binary/meson_options.txt2
5 files changed, 14 insertions, 5 deletions
diff --git a/mesonbuild/modules/python3.py b/mesonbuild/modules/python3.py
index 5bda5ab..f664632 100644
--- a/mesonbuild/modules/python3.py
+++ b/mesonbuild/modules/python3.py
@@ -48,7 +48,10 @@ class Python3Module(ExtensionModule):
@noKwargs
def find_python(self, state, args, kwargs):
- py3 = dependencies.ExternalProgram('python3', mesonlib.python_command, silent=True)
+ options = [state.environment.config_info.binaries.get('python3')]
+ if not options[0]: # because this would be [None]
+ options = ['python3', mesonlib.python_command]
+ py3 = dependencies.ExternalProgram(*options, silent=True)
return ModuleReturnValue(py3, [py3])
@noKwargs
diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py
index 96f3a7e..d185d89 100644
--- a/mesonbuild/modules/windows.py
+++ b/mesonbuild/modules/windows.py
@@ -62,9 +62,8 @@ class WindowsModule(ExtensionModule):
# Take windres from the config file after the environment, which is
# in keeping with the expectations on unix-like OSes that
# environment variables trump config files.
- _win = state.environment.config_info.binaries.get('windres')
- if _win:
- rescomp = ExternalProgram('windres', command=_win, silent=True)
+ bins = state.environment.config_info.binaries
+ rescomp = ExternalProgram.from_bin_list(bins, 'windres')
if not rescomp or not rescomp.found():
comp = self.detect_compiler(state.compilers)
diff --git a/run_unittests.py b/run_unittests.py
index cd1bf62..fc4e82b 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -4554,6 +4554,9 @@ class NativeFileTests(BasePlatformTests):
raise unittest.SkipTest('No llvm-installed, cannot test')
self._simple_test('config_dep', 'llvm-config')
+ def test_python3_module(self):
+ self._simple_test('python3', 'python3')
+
def unset_envs():
# For unit tests we must fully control all command lines
diff --git a/test cases/unit/46 native file binary/meson.build b/test cases/unit/46 native file binary/meson.build
index 3754dfa..76d6983 100644
--- a/test cases/unit/46 native file binary/meson.build
+++ b/test cases/unit/46 native file binary/meson.build
@@ -10,4 +10,8 @@ elif case == 'config_dep'
add_languages('cpp')
dep = dependency('llvm')
assert(dep.get_configtool_variable('version').endswith('12345'), 'Didn\'t load llvm from config file')
+elif case == 'python3'
+ prog = import('python3').find_python()
+ result = run_command(prog, ['--version'])
+ assert(result.stdout().strip().endswith('12345'), 'Didn\'t load python3 from config file')
endif
diff --git a/test cases/unit/46 native file binary/meson_options.txt b/test cases/unit/46 native file binary/meson_options.txt
index 5663ab3..ef7fe02 100644
--- a/test cases/unit/46 native file binary/meson_options.txt
+++ b/test cases/unit/46 native file binary/meson_options.txt
@@ -1,5 +1,5 @@
option(
'case',
type : 'combo',
- choices : ['find_program', 'config_dep']
+ choices : ['find_program', 'config_dep', 'python3']
)