def __init__(self, filename): self.config = {} self.parse_datafile(filename) if 'target_machine' in self.config: return if not 'host_machine' in self.config: raise coredata.MesonException('Cross info file must have either host or a target machine.') if not 'properties' in self.config: raise coredata.MesonException('Cross file is missing "properties".') if not 'binaries' in self.config: raise coredata.MesonException('Cross file is missing "binaries".')
def extract_objects(self, srcargs): obj_src = [] for srclist in srcargs: if not isinstance(srclist, list): srclist = [srclist] for src in srclist: if not isinstance(src, str): raise coredata.MesonException('Extraction arguments must be strings.') src = File(False, self.subdir, src) if src not in self.sources: raise coredata.MesonException('Tried to extract unknown source %s.' % src) obj_src.append(src) return ExtractedObjects(self, obj_src)
def generate(self, state, args, kwargs): if len(args) > 0: raise coredata.MesonException('Pkgconfig_gen takes no positional arguments.') libs = kwargs.get('libraries', []) if not isinstance(libs, list): libs = [libs] processed_libs = [] for l in libs: if hasattr(l, 'held_object'): l = l.held_object if not (isinstance(l, build.SharedLibrary) or isinstance(l, build.StaticLibrary)): raise coredata.MesonException('Library argument not a library object.') processed_libs.append(l) libs = processed_libs subdirs = mesonlib.stringlistify(kwargs.get('subdirs', ['.'])) version = kwargs.get('version', '') if not isinstance(version, str): raise coredata.MesonException('Version must be a string.') name = kwargs.get('name', None) if not isinstance(name, str): raise coredata.MesonException('Name not specified.') filebase = kwargs.get('filebase', name) if not isinstance(filebase, str): raise coredata.MesonException('Filebase must be a string.') description = kwargs.get('description', None) if not isinstance(description, str): raise coredata.MesonException('Description is not a string.') pcfile = filebase + '.pc' pkgroot = os.path.join(state.environment.coredata.get_builtin_option('libdir'), 'pkgconfig') self.generate_pkgconfig_file(state, libs, subdirs, name, description, version, filebase) return build.Data(False, state.environment.get_scratch_dir(), [pcfile], pkgroot)