diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index a9d921384..ded3ea267 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -500,6 +500,10 @@ class Backend(): # it assumes that it is in path, so always give it a full path. tmp = i.get_filename()[0] i = os.path.join(self.get_target_dir(i), tmp) + elif isinstance(i, mesonlib.File): + i = os.path.join(i.subdir, i.fname) + if absolute_paths: + i = os.path.join(self.environment.get_build_dir(), i) # FIXME: str types are blindly added and ignore the 'absolute_paths' argument elif not isinstance(i, str): err_msg = 'Argument {0} is of unknown type {1}' diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 302f824d2..3ca7bf2f3 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -989,7 +989,7 @@ class CustomTarget: for i, c in enumerate(cmd): if hasattr(c, 'held_object'): c = c.held_object - if isinstance(c, str): + if isinstance(c, str) or isinstance(c, File): final_cmd.append(c) elif isinstance(c, dependencies.ExternalProgram): if not c.found(): @@ -1005,8 +1005,6 @@ class CustomTarget: if not isinstance(s, str): raise InvalidArguments('Array as argument %d contains a non-string.' % i) final_cmd.append(s) - elif isinstance(c, File): - final_cmd.append(os.path.join(c.subdir, c.fname)) else: raise InvalidArguments('Argument %s in "command" is invalid.' % i) self.command = final_cmd