Minor fixes for code review
This commit is contained in:
parent
b7fa161cb9
commit
719730ff14
|
@ -33,7 +33,7 @@ from pathlib import Path, PurePath
|
||||||
from .. import mlog
|
from .. import mlog
|
||||||
from .. import mesonlib
|
from .. import mesonlib
|
||||||
from ..compilers import clib_langs
|
from ..compilers import clib_langs
|
||||||
from ..environment import BinaryTable, Environment
|
from ..environment import BinaryTable, Environment, MachineInfo
|
||||||
from ..mesonlib import MachineChoice, MesonException, OrderedSet, PerMachine
|
from ..mesonlib import MachineChoice, MesonException, OrderedSet, PerMachine
|
||||||
from ..mesonlib import Popen_safe, version_compare_many, version_compare, listify
|
from ..mesonlib import Popen_safe, version_compare_many, version_compare, listify
|
||||||
from ..mesonlib import Version
|
from ..mesonlib import Version
|
||||||
|
@ -1030,7 +1030,7 @@ class CMakeDependency(ExternalDependency):
|
||||||
cm_path = [x if os.path.isabs(x) else os.path.join(environment.get_source_dir(), x) for x in cm_path]
|
cm_path = [x if os.path.isabs(x) else os.path.join(environment.get_source_dir(), x) for x in cm_path]
|
||||||
if cm_path:
|
if cm_path:
|
||||||
cm_args += ['-DCMAKE_MODULE_PATH={}'.format(';'.join(cm_path))]
|
cm_args += ['-DCMAKE_MODULE_PATH={}'.format(';'.join(cm_path))]
|
||||||
if not self._preliminary_find_check(name, cm_path):
|
if not self._preliminary_find_check(name, cm_path, environment.machines[for_machine]):
|
||||||
return
|
return
|
||||||
self._detect_dep(name, modules, cm_args)
|
self._detect_dep(name, modules, cm_args)
|
||||||
|
|
||||||
|
@ -1064,6 +1064,7 @@ class CMakeDependency(ExternalDependency):
|
||||||
|
|
||||||
# Current generator was successful
|
# Current generator was successful
|
||||||
if ret1 == 0:
|
if ret1 == 0:
|
||||||
|
CMakeDependency.class_working_generator = i
|
||||||
break
|
break
|
||||||
|
|
||||||
mlog.debug('CMake failed to gather system information for generator {} with error code {}'.format(i, ret1))
|
mlog.debug('CMake failed to gather system information for generator {} with error code {}'.format(i, ret1))
|
||||||
|
@ -1085,7 +1086,7 @@ class CMakeDependency(ExternalDependency):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Extract the variables and sanity check them
|
# Extract the variables and sanity check them
|
||||||
module_paths = list(sorted(list(set(self.get_cmake_var('MESON_PATHS_LIST')))))
|
module_paths = sorted(set(self.get_cmake_var('MESON_PATHS_LIST')))
|
||||||
module_paths = list(filter(lambda x: os.path.isdir(x), module_paths))
|
module_paths = list(filter(lambda x: os.path.isdir(x), module_paths))
|
||||||
archs = self.get_cmake_var('MESON_ARCH_LIST')
|
archs = self.get_cmake_var('MESON_ARCH_LIST')
|
||||||
|
|
||||||
|
@ -1125,7 +1126,7 @@ class CMakeDependency(ExternalDependency):
|
||||||
except OSError:
|
except OSError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _preliminary_find_check(self, name: str, module_path: List[str]) -> bool:
|
def _preliminary_find_check(self, name: str, module_path: List[str], machine: MachineInfo) -> bool:
|
||||||
lname = str(name).lower()
|
lname = str(name).lower()
|
||||||
|
|
||||||
# Checks <path>, <path>/cmake, <path>/CMake
|
# Checks <path>, <path>/cmake, <path>/CMake
|
||||||
|
@ -1184,10 +1185,11 @@ class CMakeDependency(ExternalDependency):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Mac framework support
|
# Mac framework support
|
||||||
|
if machine.is_darwin():
|
||||||
for j in ['{}.framework', '{}.app']:
|
for j in ['{}.framework', '{}.app']:
|
||||||
j = j.format(lname)
|
j = j.format(lname)
|
||||||
if j in content:
|
if j in content:
|
||||||
if find_module(os.path.join(i, j[0], 'Resources')):
|
if find_module(os.path.join(i, j[0], 'Resources')) or find_module(os.path.join(i, j[0], 'Version')):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Check the environment path
|
# Check the environment path
|
||||||
|
|
Loading…
Reference in New Issue