aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2016-08-24 04:19:23 -0400
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2016-08-26 20:46:42 -0400
commitdcaf2d7b3d010526eb5035fec788f1b9a854262c (patch)
tree2c4e6392beab17fb18f3d9070e98578f7e22660c
parent3ed1ff1c714e35beb82d02a9f1a1bccb992329b2 (diff)
downloadmeson-dcaf2d7b3d010526eb5035fec788f1b9a854262c.zip
meson-dcaf2d7b3d010526eb5035fec788f1b9a854262c.tar.gz
meson-dcaf2d7b3d010526eb5035fec788f1b9a854262c.tar.bz2
Accept string exe with Backend.serialise_executable.
Normally, this accepts a build.Executable, but it accept build.BuildTarget and build.CustomTarget as well. Now it will also accept a string path.
-rw-r--r--mesonbuild/backend/backends.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 806a6f3..bdba44f 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -179,15 +179,21 @@ class Backend():
def serialise_executable(self, exe, cmd_args, workdir, env={}):
import uuid
# Can't just use exe.name here; it will likely be run more than once
- scratch_file = 'meson_exe_{0}_{1}.dat'.format(exe.name,
+ if isinstance(exe, (dependencies.ExternalProgram,
+ build.BuildTarget, build.CustomTarget)):
+ basename = exe.name
+ else:
+ basename = os.path.basename(exe)
+ scratch_file = 'meson_exe_{0}_{1}.dat'.format(basename,
str(uuid.uuid4())[:8])
exe_data = os.path.join(self.environment.get_scratch_dir(), scratch_file)
with open(exe_data, 'wb') as f:
if isinstance(exe, dependencies.ExternalProgram):
exe_fullpath = exe.fullpath
+ elif isinstance(exe, (build.BuildTarget, build.CustomTarget)):
+ exe_fullpath = [self.get_target_filename_abs(exe)]
else:
- exe_fullpath = [os.path.join(self.environment.get_build_dir(),
- self.get_target_filename(exe))]
+ exe_fullpath = [exe]
is_cross = self.environment.is_cross_build() and \
self.environment.cross_info.need_cross_compiler() and \
self.environment.cross_info.need_exe_wrapper()
@@ -199,7 +205,7 @@ class Backend():
extra_paths = self.determine_windows_extra_paths(exe)
else:
extra_paths = []
- es = ExecutableSerialisation(exe.name, exe_fullpath, cmd_args, env,
+ es = ExecutableSerialisation(basename, exe_fullpath, cmd_args, env,
is_cross, exe_wrapper, workdir,
extra_paths)
pickle.dump(es, f)