diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-08-27 13:42:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-27 13:42:13 +0300 |
commit | 4e050c3d9b545a8c8e136d5c8e7eb9cee988fbc6 (patch) | |
tree | fd64a026c5c364ce296230ac40f68224318efbc7 /mesonbuild/backend/backends.py | |
parent | 3ed1ff1c714e35beb82d02a9f1a1bccb992329b2 (diff) | |
parent | b7757189e4eb8a17182d07cdcad53e8f5ebad0ce (diff) | |
download | meson-4e050c3d9b545a8c8e136d5c8e7eb9cee988fbc6.zip meson-4e050c3d9b545a8c8e136d5c8e7eb9cee988fbc6.tar.gz meson-4e050c3d9b545a8c8e136d5c8e7eb9cee988fbc6.tar.bz2 |
Merge pull request #712 from QuLogic/capturing-custom-target
Allow capturing command output of a custom target.
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r-- | mesonbuild/backend/backends.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 806a6f3..fbc5079 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -37,7 +37,7 @@ class InstallData(): class ExecutableSerialisation(): def __init__(self, name, fname, cmd_args, env, is_cross, exe_wrapper, - workdir, extra_paths): + workdir, extra_paths, capture): self.name = name self.fname = fname self.cmd_args = cmd_args @@ -46,6 +46,7 @@ class ExecutableSerialisation(): self.exe_runner = exe_wrapper self.workdir = workdir self.extra_paths = extra_paths + self.capture = capture class TestSerialisation: def __init__(self, name, suite, fname, is_cross, exe_wrapper, is_parallel, cmd_args, env, @@ -176,18 +177,25 @@ class Backend(): raise MesonException('Unknown data type in object list.') return obj_list - def serialise_executable(self, exe, cmd_args, workdir, env={}): + def serialise_executable(self, exe, cmd_args, workdir, env={}, + capture=None): 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,9 +207,9 @@ 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) + extra_paths, capture) pickle.dump(es, f) return exe_data |