aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/python.py4
-rw-r--r--mesonbuild/modules/python3.py5
-rw-r--r--mesonbuild/modules/qt.py9
-rw-r--r--mesonbuild/modules/qt4.py7
-rw-r--r--mesonbuild/modules/qt5.py7
-rw-r--r--mesonbuild/modules/windows.py11
6 files changed, 27 insertions, 16 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index 954220b..3b2bf07 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -480,7 +480,9 @@ class PythonModule(ExtensionModule):
if len(args) > 1:
raise InvalidArguments('find_installation takes zero or one positional argument.')
- if args:
+ if 'python' in state.environment.config_info.binaries:
+ name_or_path = state.environment.config_info.binaries['python']
+ elif args:
name_or_path = args[0]
if not isinstance(name_or_path, str):
raise InvalidArguments('find_installation argument must be a string.')
diff --git a/mesonbuild/modules/python3.py b/mesonbuild/modules/python3.py
index 5bda5ab..f664632 100644
--- a/mesonbuild/modules/python3.py
+++ b/mesonbuild/modules/python3.py
@@ -48,7 +48,10 @@ class Python3Module(ExtensionModule):
@noKwargs
def find_python(self, state, args, kwargs):
- py3 = dependencies.ExternalProgram('python3', mesonlib.python_command, silent=True)
+ options = [state.environment.config_info.binaries.get('python3')]
+ if not options[0]: # because this would be [None]
+ options = ['python3', mesonlib.python_command]
+ py3 = dependencies.ExternalProgram(*options, silent=True)
return ModuleReturnValue(py3, [py3])
@noKwargs
diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py
index 7a2c338..367b15b 100644
--- a/mesonbuild/modules/qt.py
+++ b/mesonbuild/modules/qt.py
@@ -18,7 +18,7 @@ from .. import build
from ..mesonlib import MesonException, Popen_safe, extract_as_list, File
from ..dependencies import Dependency, Qt4Dependency, Qt5Dependency
import xml.etree.ElementTree as ET
-from . import ModuleReturnValue, get_include_args
+from . import ModuleReturnValue, get_include_args, ExtensionModule
from ..interpreterbase import permittedKwargs, FeatureNewKwargs
_QT_DEPS_LUT = {
@@ -27,10 +27,11 @@ _QT_DEPS_LUT = {
}
-class QtBaseModule:
+class QtBaseModule(ExtensionModule):
tools_detected = False
- def __init__(self, qt_version=5):
+ def __init__(self, interpreter, qt_version=5):
+ ExtensionModule.__init__(self, interpreter)
self.qt_version = qt_version
def _detect_tools(self, env, method):
@@ -43,7 +44,7 @@ class QtBaseModule:
kwargs = {'required': 'true', 'modules': 'Core', 'silent': 'true', 'method': method}
qt = _QT_DEPS_LUT[self.qt_version](env, kwargs)
# Get all tools and then make sure that they are the right version
- self.moc, self.uic, self.rcc, self.lrelease = qt.compilers_detect()
+ self.moc, self.uic, self.rcc, self.lrelease = qt.compilers_detect(self.interpreter)
# Moc, uic and rcc write their version strings to stderr.
# Moc and rcc return a non-zero result when doing so.
# What kind of an idiot thought that was a good idea?
diff --git a/mesonbuild/modules/qt4.py b/mesonbuild/modules/qt4.py
index 29992d5..112e3e4 100644
--- a/mesonbuild/modules/qt4.py
+++ b/mesonbuild/modules/qt4.py
@@ -14,14 +14,13 @@
from .. import mlog
from .qt import QtBaseModule
-from . import ExtensionModule
-class Qt4Module(ExtensionModule, QtBaseModule):
+class Qt4Module(QtBaseModule):
def __init__(self, interpreter):
- QtBaseModule.__init__(self, qt_version=4)
- ExtensionModule.__init__(self, interpreter)
+ QtBaseModule.__init__(self, interpreter, qt_version=4)
+
def initialize(*args, **kwargs):
mlog.warning('rcc dependencies will not work properly until this upstream issue is fixed:',
diff --git a/mesonbuild/modules/qt5.py b/mesonbuild/modules/qt5.py
index 19623ac..96a7964 100644
--- a/mesonbuild/modules/qt5.py
+++ b/mesonbuild/modules/qt5.py
@@ -14,14 +14,13 @@
from .. import mlog
from .qt import QtBaseModule
-from . import ExtensionModule
-class Qt5Module(ExtensionModule, QtBaseModule):
+class Qt5Module(QtBaseModule):
def __init__(self, interpreter):
- QtBaseModule.__init__(self, qt_version=5)
- ExtensionModule.__init__(self, interpreter)
+ QtBaseModule.__init__(self, interpreter, qt_version=5)
+
def initialize(*args, **kwargs):
mlog.warning('rcc dependencies will not work reliably until this upstream issue is fixed:',
diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py
index 4d0f244..d185d89 100644
--- a/mesonbuild/modules/windows.py
+++ b/mesonbuild/modules/windows.py
@@ -49,8 +49,8 @@ class WindowsModule(ExtensionModule):
if state.environment.is_cross_build():
# If cross compiling see if windres has been specified in the
# cross file before trying to find it another way.
- cross_info = state.environment.cross_info
- rescomp = ExternalProgram.from_cross_info(cross_info, 'windres')
+ bins = state.environment.cross_info.config['binaries']
+ rescomp = ExternalProgram.from_bin_list(bins, 'windres')
if not rescomp or not rescomp.found():
if 'WINDRES' in os.environ:
@@ -59,6 +59,13 @@ class WindowsModule(ExtensionModule):
rescomp = ExternalProgram('windres', command=os.environ.get('WINDRES'), silent=True)
if not rescomp or not rescomp.found():
+ # Take windres from the config file after the environment, which is
+ # in keeping with the expectations on unix-like OSes that
+ # environment variables trump config files.
+ bins = state.environment.config_info.binaries
+ rescomp = ExternalProgram.from_bin_list(bins, 'windres')
+
+ if not rescomp or not rescomp.found():
comp = self.detect_compiler(state.compilers)
if comp.id == 'msvc' or comp.id == 'clang-cl':
rescomp = ExternalProgram('rc', silent=True)