CustomTarget: Use mesonlib.File objects as-is in the command to be run

This allows us to output either the relative or absolute path as
requested. Fixes usage of configure_file inside CustomTarget commands
with the VS backends.
pull/417/head
Nirbheek Chauhan 9 years ago
parent 2e986ae30d
commit 64cb70441b
  1. 4
      mesonbuild/backend/backends.py
  2. 4
      mesonbuild/build.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}'

@ -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

Loading…
Cancel
Save