Fix a few more modules.
This commit is contained in:
parent
de24fddbd1
commit
570c9b150b
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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:',
|
||||
|
|
|
@ -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:',
|
||||
|
|
Loading…
Reference in New Issue