def generate_run_target(self, target, outfile):
        runnerscript = [sys.executable, self.environment.get_build_command(), '--internal', 'commandrunner']
        deps = []
        arg_strings = []
        for i in target.args:
            if isinstance(i, str):
                arg_strings.append(i)
            elif isinstance(i, (build.BuildTarget, build.CustomTarget)):
                relfname = self.get_target_filename(i)
                deps.append(relfname)
                arg_strings.append(os.path.join(self.environment.get_build_dir(), relfname))
            else:
                mlog.debug(str(i))
                raise MesonException('Unreachable code in generate_run_target.')
        elem = NinjaBuildElement(self.all_outputs, target.name, 'CUSTOM_COMMAND', deps)
        cmd = runnerscript + [self.environment.get_source_dir(), self.environment.get_build_dir(), target.subdir]
        texe = target.command
        try:
            texe = texe.held_object
        except __HOLE__:
            pass
        if isinstance(texe, build.Executable):
            abs_exe = os.path.join(self.environment.get_build_dir(), self.get_target_filename(texe))
            deps.append(self.get_target_filename(texe))
            if self.environment.is_cross_build() \
                and self.environment.cross_info.config['binaries'].get('exe_wrapper', None) is not None:
                cmd += [self.environment.cross_info.config['binaries']['exe_wrapper']]
            cmd.append(abs_exe)
        else:
            cmd.append(target.command)
        cmd += arg_strings
        elem.add_item('COMMAND', cmd)
        elem.add_item('description', 'Running external command %s.' % target.name)
        elem.add_item('pool', 'console')
        elem.write(outfile)
        self.processed_targets[target.name + target.type_suffix()] = True
dataset/ETHPy150Open mesonbuild/meson/mesonbuild/backend/ninjabackend.py/NinjaBackend.generate_run_target