diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-07-01 14:43:51 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-07-01 20:50:47 +0530 |
commit | 64cb70441bce61da3258fca93df5baac2eb310ea (patch) | |
tree | 594e946f136a10cd6b550bd4e7f64163548a5e16 | |
parent | 2e986ae30dbcc4505db36497adf943d119bc5a4e (diff) | |
download | meson-64cb70441bce61da3258fca93df5baac2eb310ea.zip meson-64cb70441bce61da3258fca93df5baac2eb310ea.tar.gz meson-64cb70441bce61da3258fca93df5baac2eb310ea.tar.bz2 |
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.
-rw-r--r-- | mesonbuild/backend/backends.py | 4 | ||||
-rw-r--r-- | mesonbuild/build.py | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index a9d9213..ded3ea2 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 302f824..3ca7bf2 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 |