From 95403cb61520978c52b3693a9bf0119e8348c20b Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 18 Sep 2018 10:28:14 -0700 Subject: replace ExternalProgram.from_cross_info with from_bin_list This more generic method will also be used to check a config file for binary information. --- mesonbuild/modules/windows.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mesonbuild/modules') diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py index 4d0f244..85cc3bc 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: -- cgit v1.1 From f159735c3b82849d0c5d33345b7b07a5f5024428 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 11 May 2018 09:07:34 -0700 Subject: modules/windows: Allow getting windres from native file --- mesonbuild/modules/windows.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mesonbuild/modules') diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py index 85cc3bc..96f3a7e 100644 --- a/mesonbuild/modules/windows.py +++ b/mesonbuild/modules/windows.py @@ -59,6 +59,14 @@ 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. + _win = state.environment.config_info.binaries.get('windres') + if _win: + rescomp = ExternalProgram('windres', command=_win, silent=True) + + 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) -- cgit v1.1 From 091452f8cd886dedc2bc5d3ec292dcf899989a24 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 11 May 2018 09:14:18 -0700 Subject: modules/python3: allow specifying in the native file --- mesonbuild/modules/python3.py | 5 ++++- mesonbuild/modules/windows.py | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'mesonbuild/modules') 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/windows.py b/mesonbuild/modules/windows.py index 96f3a7e..d185d89 100644 --- a/mesonbuild/modules/windows.py +++ b/mesonbuild/modules/windows.py @@ -62,9 +62,8 @@ class WindowsModule(ExtensionModule): # 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. - _win = state.environment.config_info.binaries.get('windres') - if _win: - rescomp = ExternalProgram('windres', command=_win, silent=True) + 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) -- cgit v1.1 From 71a5f990d09f04d8eb8d636abf7e2b446fdf826a Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 18 Sep 2018 15:17:31 -0700 Subject: modules/python: Allow use of the native file Currently this just allows setting a "python" variable that always overrides, probably we want to have the option for "python2" and "python3" as well. --- mesonbuild/modules/python.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mesonbuild/modules') 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.') -- cgit v1.1 From aa04147a4a2a37aee197ebc0ed179c6fb582b3e9 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 24 Oct 2018 14:17:44 -0700 Subject: dependencies/ui: Allow qt compilers and qmake to be specified in native file --- mesonbuild/modules/qt.py | 9 +++++---- mesonbuild/modules/qt4.py | 7 +++---- mesonbuild/modules/qt5.py | 7 +++---- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'mesonbuild/modules') 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:', -- cgit v1.1