aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/modules/python.py4
-rwxr-xr-xrun_unittests.py8
-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
4 files changed, 16 insertions, 2 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index 954220b..3b2bf07 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -480,7 +480,9 @@ class PythonModule(ExtensionModule):
if len(args) > 1:
raise InvalidArguments('find_installation takes zero or one positional argument.')
- if args:
+ if 'python' in state.environment.config_info.binaries:
+ name_or_path = state.environment.config_info.binaries['python']
+ elif args:
name_or_path = args[0]
if not isinstance(name_or_path, str):
raise InvalidArguments('find_installation argument must be a string.')
diff --git a/run_unittests.py b/run_unittests.py
index fc4e82b..05a8457 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -4557,6 +4557,14 @@ class NativeFileTests(BasePlatformTests):
def test_python3_module(self):
self._simple_test('python3', 'python3')
+ def test_python_module(self):
+ if is_windows():
+ # Bat adds extra crap to stdout, so the version check logic in the
+ # python module breaks. This is fine on other OSes because they
+ # don't need the extra indirection.
+ raise unittest.SkipTest('bat indirection breaks internal sanity checks.')
+ self._simple_test('python', 'python')
+
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 76d6983..4489ac1 100644
--- a/test cases/unit/46 native file binary/meson.build
+++ b/test cases/unit/46 native file binary/meson.build
@@ -14,4 +14,8 @@ 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')
+elif case == 'python'
+ prog = import('python').find_installation()
+ result = run_command(prog, ['--version'])
+ assert(result.stdout().strip().endswith('12345'), 'Didn\'t load python 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 ef7fe02..651da0e 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', 'python3']
+ choices : ['find_program', 'config_dep', 'python3', 'python']
)