|
|
@ -14,6 +14,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
import os |
|
|
|
import os |
|
|
|
import json |
|
|
|
import json |
|
|
|
|
|
|
|
import shutil |
|
|
|
|
|
|
|
|
|
|
|
from pathlib import Path |
|
|
|
from pathlib import Path |
|
|
|
from .. import mesonlib |
|
|
|
from .. import mesonlib |
|
|
@ -468,6 +469,9 @@ class PythonModule(ExtensionModule): |
|
|
|
def _get_win_pythonpath(self, name_or_path): |
|
|
|
def _get_win_pythonpath(self, name_or_path): |
|
|
|
if name_or_path not in ['python2', 'python3']: |
|
|
|
if name_or_path not in ['python2', 'python3']: |
|
|
|
return None |
|
|
|
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 = {'python2': '-2', 'python3': '-3'}[name_or_path] |
|
|
|
cmd = ['py', ver, '-c', "import sysconfig; print(sysconfig.get_config_var('BINDIR'))"] |
|
|
|
cmd = ['py', ver, '-c', "import sysconfig; print(sysconfig.get_config_var('BINDIR'))"] |
|
|
|
_, stdout, _ = mesonlib.Popen_safe(cmd) |
|
|
|
_, stdout, _ = mesonlib.Popen_safe(cmd) |
|
|
|