summaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorCharles Brunet <charles.brunet@optelgroup.com>2023-04-19 08:52:21 -0400
committerEli Schwartz <eschwartz93@gmail.com>2023-05-02 17:52:10 -0400
commit51b9f2f1a5cd43d903033f4738a4235fe656cb07 (patch)
treeff342dd376e8cf24af6553348730520bf26dd839 /mesonbuild
parent107f933b528cdaf23c038cbc99f5248c9ca666bd (diff)
downloadmeson-51b9f2f1a5cd43d903033f4738a4235fe656cb07.tar.gz
Find python3.xx on windows
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/modules/python.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index 239c68af7..178f1bdce 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -300,12 +300,12 @@ class PythonModule(ExtensionModule):
# https://www.python.org/dev/peps/pep-0397/
@staticmethod
def _get_win_pythonpath(name_or_path: str) -> T.Optional[str]:
- if name_or_path not in ['python2', 'python3']:
+ if not name_or_path.startswith(('python2', 'python3')):
return None
if not shutil.which('py'):
# program not installed, return without an exception
return None
- ver = {'python2': '-2', 'python3': '-3'}[name_or_path]
+ ver = f'-{name_or_path[6:]}'
cmd = ['py', ver, '-c', "import sysconfig; print(sysconfig.get_config_var('BINDIR'))"]
_, stdout, _ = mesonlib.Popen_safe(cmd)
directory = stdout.strip()