aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-12-20 20:33:48 -0500
committerDaniel Mensinger <daniel@mensinger-ka.de>2021-12-21 12:17:10 +0100
commitee0baa97cd0411e15bd8f47e3874f217887d0a7a (patch)
tree10f998a9c969070edaf3171dd987008022e1a392
parent6be258137ebfea474533ab7a855d4a1e817aeedc (diff)
downloadmeson-ee0baa97cd0411e15bd8f47e3874f217887d0a7a.zip
meson-ee0baa97cd0411e15bd8f47e3874f217887d0a7a.tar.gz
meson-ee0baa97cd0411e15bd8f47e3874f217887d0a7a.tar.bz2
modules: use find_program implementation to find programs
Do not use ExternalProgram as that is too low-level and doesn't handle e.g. machine file overrides. Fixes #9733
-rw-r--r--mesonbuild/modules/cmake.py7
-rw-r--r--mesonbuild/modules/dlang.py11
2 files changed, 8 insertions, 10 deletions
diff --git a/mesonbuild/modules/cmake.py b/mesonbuild/modules/cmake.py
index 67fdd0c..fd831e6 100644
--- a/mesonbuild/modules/cmake.py
+++ b/mesonbuild/modules/cmake.py
@@ -34,7 +34,6 @@ from ..interpreterbase import (
InvalidArguments,
InterpreterException,
)
-from ..programs import ExternalProgram
COMPATIBILITIES = ['AnyNewerVersion', 'SameMajorVersion', 'SameMinorVersion', 'ExactVersion']
@@ -233,11 +232,11 @@ class CmakeModule(ExtensionModule):
return compiler.sizeof('void *', '', env)
- def detect_cmake(self):
+ def detect_cmake(self, state):
if self.cmake_detected:
return True
- cmakebin = ExternalProgram('cmake', silent=False)
+ cmakebin = state.find_program('cmake', silent=False)
if not cmakebin.found():
return False
@@ -272,7 +271,7 @@ class CmakeModule(ExtensionModule):
if compatibility not in COMPATIBILITIES:
raise mesonlib.MesonException('compatibility must be either AnyNewerVersion, SameMajorVersion or ExactVersion.')
- if not self.detect_cmake():
+ if not self.detect_cmake(state):
raise mesonlib.MesonException('Unable to find cmake')
pkgroot = pkgroot_name = kwargs.get('install_dir', None)
diff --git a/mesonbuild/modules/dlang.py b/mesonbuild/modules/dlang.py
index 60d2885..ddb780b 100644
--- a/mesonbuild/modules/dlang.py
+++ b/mesonbuild/modules/dlang.py
@@ -22,7 +22,6 @@ from . import ExtensionModule
from .. import dependencies
from .. import mlog
from ..mesonlib import Popen_safe, MesonException
-from ..programs import ExternalProgram
class DlangModule(ExtensionModule):
class_dubbin = None
@@ -34,7 +33,7 @@ class DlangModule(ExtensionModule):
'generate_dub_file': self.generate_dub_file,
})
- def _init_dub(self):
+ def _init_dub(self, state):
if DlangModule.class_dubbin is None:
self.dubbin = dependencies.DubDependency.class_dubbin
DlangModule.class_dubbin = self.dubbin
@@ -42,7 +41,7 @@ class DlangModule(ExtensionModule):
self.dubbin = DlangModule.class_dubbin
if DlangModule.class_dubbin is None:
- self.dubbin = self.check_dub()
+ self.dubbin = self.check_dub(state)
DlangModule.class_dubbin = self.dubbin
else:
self.dubbin = DlangModule.class_dubbin
@@ -53,7 +52,7 @@ class DlangModule(ExtensionModule):
def generate_dub_file(self, state, args, kwargs):
if not DlangModule.init_dub:
- self._init_dub()
+ self._init_dub(state)
if len(args) < 2:
raise MesonException('Missing arguments')
@@ -109,8 +108,8 @@ class DlangModule(ExtensionModule):
p, out = Popen_safe(self.dubbin.get_command() + args, env=env)[0:2]
return p.returncode, out.strip()
- def check_dub(self):
- dubbin = ExternalProgram('dub', silent=True)
+ def check_dub(self, state):
+ dubbin = state.find_program('dub', silent=True)
if dubbin.found():
try:
p, out = Popen_safe(dubbin.get_command() + ['--version'])[0:2]