diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-12-30 10:40:25 +0100 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-01-10 21:48:23 +0000 |
commit | 8f1d9bb7b0cca265276c46caf928c047870b34f1 (patch) | |
tree | 01e3192d369e532f48ad054be5feca51abec7ea4 /mesonbuild/dependencies/base.py | |
parent | a8c138ebc1f9005f7c32c78eae67a6289130e9c4 (diff) | |
download | meson-8f1d9bb7b0cca265276c46caf928c047870b34f1.zip meson-8f1d9bb7b0cca265276c46caf928c047870b34f1.tar.gz meson-8f1d9bb7b0cca265276c46caf928c047870b34f1.tar.bz2 |
cmake: add PATH logic to preliminary dep check (fixes #8133)
Diffstat (limited to 'mesonbuild/dependencies/base.py')
-rw-r--r-- | mesonbuild/dependencies/base.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index e359219..9ddf6db 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -1186,7 +1186,12 @@ class CMakeDependency(ExternalDependency): return None def process_paths(l: T.List[str]) -> T.Set[str]: - l = [x.split(':') for x in l] + if mesonlib.is_windows(): + # Cannot split on ':' on Windows because its in the drive letter + l = [x.split(os.pathsep) for x in l] + else: + # https://github.com/mesonbuild/meson/issues/7294 + l = [re.split(r':|;', x) for x in l] l = [x for sublist in l for x in sublist] return set(l) @@ -1290,8 +1295,17 @@ class CMakeDependency(ExternalDependency): if search_lib_dirs(i): return True + # Check PATH + system_env = [] # type: T.List[str] + for i in os.environ.get('PATH', '').split(os.pathsep): + if i.endswith('/bin') or i.endswith('\\bin'): + i = i[:-4] + if i.endswith('/sbin') or i.endswith('\\sbin'): + i = i[:-5] + system_env += [i] + # Check the system paths - for i in self.cmakeinfo['module_paths']: + for i in self.cmakeinfo['module_paths'] + system_env: if find_module(i): return True |