aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-01-06 19:22:56 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2017-01-06 19:22:56 +0200
commit570c9b150b9c604b3c221d7684a5cee3494d3d7a (patch)
treec2c304b2e052fd3d09622a1313ba2afa95b4b9e8
parentde24fddbd149d465dc737d707fed204bdf8d06cc (diff)
downloadmeson-570c9b150b9c604b3c221d7684a5cee3494d3d7a.zip
meson-570c9b150b9c604b3c221d7684a5cee3494d3d7a.tar.gz
meson-570c9b150b9c604b3c221d7684a5cee3494d3d7a.tar.bz2
Fix a few more modules.
-rw-r--r--mesonbuild/interpreter.py35
-rw-r--r--mesonbuild/modules/i18n.py7
-rw-r--r--mesonbuild/modules/qt4.py3
-rw-r--r--mesonbuild/modules/qt5.py3
4 files changed, 37 insertions, 11 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index d4aacbd..19e73de 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -420,11 +420,9 @@ class Headers(InterpreterObject):
return self.custom_install_dir
class DataHolder(InterpreterObject):
- def __init__(self, sources, install_dir):
+ def __init__(self, data):
super().__init__()
- if not isinstance(install_dir, str):
- raise InterpreterException('Custom_install_dir must be a string.')
- self.held_object = build.Data(sources, install_dir)
+ self.held_object = data
def get_source_subdir(self):
return self.held_object.source_subdir
@@ -1231,6 +1229,29 @@ class Interpreter(InterpreterBase):
'join_paths': self.func_join_paths,
})
+ def holderify(self, item):
+ if isinstance(item, list):
+ return [self.holderify(x) for x in item]
+ if isinstance(item, build.CustomTarget):
+ return CustomTargetHolder(item, self)
+ elif isinstance(item, (int, str)) or item is None:
+ return item
+ elif isinstance(item, build.Executable):
+ return ExecutableHolder(item, self)
+ elif isinstance(item, build.GeneratedList):
+ return GeneratedListHolder(item)
+ elif isinstance(item, build.RunTarget):
+ raise RuntimeError('This is not a pipe.')
+ elif isinstance(item, build.RunScript):
+ raise RuntimeError('Do not do this.')
+ elif isinstance(item, build.Data):
+ return DataHolder(item)
+ elif isinstance(item, dependencies.InternalDependency):
+ return InternalDependencyHolder(item)
+ else:
+ print(item)
+ raise InterpreterException('Module returned a value of unknown type.')
+
def module_method_callback(self, return_object):
if not isinstance(return_object, ModuleReturnValue):
raise InterpreterException('Bug in module, it returned an invalid object')
@@ -1271,7 +1292,7 @@ class Interpreter(InterpreterBase):
raise InterpreterException('Module returned a value of unknown type.')
if len(outvalues) == 1 and unwrap_single:
return outvalues[0]
- return return_object.return_value
+ return self.holderify(return_object.return_value)
def get_build_def_files(self):
return self.build_def_files
@@ -2109,7 +2130,7 @@ requirements use the version keyword argument instead.''')
source_strings.append(s)
sources += self.source_strings_to_files(source_strings)
install_dir = kwargs.get('install_dir', None)
- data = DataHolder(sources, install_dir)
+ data = DataHolder(build.Data(sources, install_dir))
self.build.data.append(data.held_object)
return data
@@ -2169,7 +2190,7 @@ requirements use the version keyword argument instead.''')
idir = kwargs.get('install_dir', None)
if isinstance(idir, str):
cfile = mesonlib.File.from_built_file(ofile_path, ofile_fname)
- self.build.data.append(DataHolder([cfile], idir).held_object)
+ self.build.data.append(build.Data([cfile], idir))
return mesonlib.File.from_built_file(self.subdir, output)
@stringArgs
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py
index 4b4ae3d..fa52463 100644
--- a/mesonbuild/modules/i18n.py
+++ b/mesonbuild/modules/i18n.py
@@ -15,6 +15,8 @@
from os import path
from .. import coredata, mesonlib, build
from ..mesonlib import MesonException
+from . import ModuleReturnValue
+
import sys
import shutil
@@ -59,7 +61,8 @@ class I18nModule:
kwargs['command'] = ['msgfmt', '--' + file_type,
'--template', '@INPUT@', '-d', podir, '-o', '@OUTPUT@']
- return build.CustomTarget(kwargs['output'] + '_merge', state.subdir, kwargs)
+ ct = build.CustomTarget(kwargs['output'] + '_merge', state.subdir, kwargs)
+ return ModuleReturnValue(ct, [ct])
def gettext(self, state, args, kwargs):
if len(args) != 1:
@@ -114,7 +117,7 @@ class I18nModule:
args.append(lang_arg)
iscript = build.RunScript(script, args)
- return [pottarget, gmotarget, iscript, updatepotarget]
+ return ModuleReturnValue(None, [pottarget, gmotarget, iscript, updatepotarget])
def initialize():
return I18nModule()
diff --git a/mesonbuild/modules/qt4.py b/mesonbuild/modules/qt4.py
index beb7ca5..6759270 100644
--- a/mesonbuild/modules/qt4.py
+++ b/mesonbuild/modules/qt4.py
@@ -18,6 +18,7 @@ from .. import build
from ..mesonlib import MesonException, Popen_safe
from ..dependencies import Qt4Dependency
import xml.etree.ElementTree as ET
+from . import ModuleReturnValue
class Qt4Module():
tools_detected = False
@@ -153,7 +154,7 @@ class Qt4Module():
moc_gen = build.Generator([self.moc], moc_kwargs)
moc_output = moc_gen.process_files('Qt4 moc source', moc_sources, state)
sources.append(moc_output)
- return sources
+ return ModuleReturnValue(sources, sources)
def initialize():
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 2e348db..53f1cb5 100644
--- a/mesonbuild/modules/qt5.py
+++ b/mesonbuild/modules/qt5.py
@@ -18,6 +18,7 @@ from .. import build
from ..mesonlib import MesonException, Popen_safe
from ..dependencies import Qt5Dependency
import xml.etree.ElementTree as ET
+from . import ModuleReturnValue
class Qt5Module():
tools_detected = False
@@ -159,7 +160,7 @@ class Qt5Module():
moc_gen = build.Generator([self.moc], moc_kwargs)
moc_output = moc_gen.process_files('Qt5 moc source', moc_sources, state)
sources.append(moc_output)
- return sources
+ return ModuleReturnValue(sources, sources)
def initialize():
mlog.warning('rcc dependencies will not work reliably until this upstream issue is fixed:',