diff options
-rw-r--r-- | backends.py | 2 | ||||
-rw-r--r-- | build.py | 1 | ||||
-rw-r--r-- | interpreter.py | 14 | ||||
-rw-r--r-- | mesonlib.py | 6 |
4 files changed, 23 insertions, 0 deletions
diff --git a/backends.py b/backends.py index 83f291a..3c6827f 100644 --- a/backends.py +++ b/backends.py @@ -167,6 +167,8 @@ class Backend(): for osrc in extobj.srclist: if not self.source_suffix_in_objs: osrc = '.'.join(osrc.split('.')[:-1]) + if hasattr(osrc, 'fname'): # FIXME allow only strings. + osrc = osrc.fname objname = os.path.join(proj_dir_to_build_root, targetdir, os.path.basename(osrc) + suffix) result.append(objname) @@ -259,6 +259,7 @@ class BuildTarget(): 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) diff --git a/interpreter.py b/interpreter.py index 647cc52..f33fff3 100644 --- a/interpreter.py +++ b/interpreter.py @@ -1494,6 +1494,19 @@ class Interpreter(): result.append(a) return result + def source_strings_to_files(self, sources): + results = [] + for s in sources: + if isinstance(s, File) or isinstance(s, GeneratedListHolder) or \ + isinstance(s, CustomTargetHolder): + pass + elif isinstance(s, str): # FIXME do not allow plain strings. + s = File.from_source_file(self.environment.source_dir, self.subdir, s) + else: + raise RuntimeError("Unreachable code") + results.append(s) + return results + def build_target(self, node, args, kwargs, targetholder): args = self.flatten(args) name = args[0] @@ -1515,6 +1528,7 @@ class Interpreter(): except KeyError: kw_src = [] sources += kw_src + sources = self.source_strings_to_files(sources) objs = self.flatten(kwargs.get('objects', [])) if not isinstance(objs, list): objs = [objs] diff --git a/mesonlib.py b/mesonlib.py index f547379..313ffd6 100644 --- a/mesonlib.py +++ b/mesonlib.py @@ -48,6 +48,12 @@ class File: def split(self, s): return self.fname.split(s) + def __eq__(self, other): + return (self.fname, self.subdir, self.is_built) == (other.fname, other.subdir, other.is_built) + + def __hash__(self): + return hash((self.fname, self.subdir, self.is_built)) + def is_osx(): return platform.system().lower() == 'darwin' |