

def eval_custom_target_command(self, target, absolute_paths=False):
    if (not absolute_paths):
        ofilenames = [os.path.join(self.get_target_dir(target), i) for i in target.output]
    else:
        ofilenames = [os.path.join(self.environment.get_build_dir(), self.get_target_dir(target), i) for i in target.output]
    srcs = []
    outdir = self.get_target_dir(target)
    if (outdir == ''):
        outdir = '.'
    if absolute_paths:
        outdir = os.path.join(self.environment.get_build_dir(), outdir)
    for i in target.sources:
        if hasattr(i, 'held_object'):
            i = i.held_object
        if isinstance(i, str):
            fname = os.path.join(self.build_to_src, target.subdir, i)
        elif isinstance(i, build.BuildTarget):
            fname = self.get_target_filename(i)
        else:
            fname = i.rel_to_builddir(self.build_to_src)
        if absolute_paths:
            fname = os.path.join(self.environment.get_build_dir(), fname)
        srcs.append(fname)
    cmd = []
    for i in target.command:
        if isinstance(i, build.Executable):
            cmd += self.exe_object_to_cmd_array(i)
            continue
        if isinstance(i, build.CustomTarget):
            tmp = i.get_filename()[0]
            i = os.path.join(self.get_target_dir(i), tmp)
        for (j, src) in enumerate(srcs):
            i = i.replace(('@INPUT%d@' % j), src)
        for (j, res) in enumerate(ofilenames):
            i = i.replace(('@OUTPUT%d@' % j), res)
        if (i == '@INPUT@'):
            cmd += srcs
        elif (i == '@OUTPUT@'):
            cmd += ofilenames
        else:
            if ('@OUTDIR@' in i):
                i = i.replace('@OUTDIR@', outdir)
            elif ('@PRIVATE_OUTDIR_' in i):
                match = re.search('@PRIVATE_OUTDIR_(ABS_)?([-a-zA-Z0-9.@:]*)@', i)
                source = match.group(0)
                if ((match.group(1) is None) and (not absolute_paths)):
                    lead_dir = ''
                else:
                    lead_dir = self.environment.get_build_dir()
                target_id = match.group(2)
                i = i.replace(source, os.path.join(lead_dir, outdir))
            cmd.append(i)
    cmd = [i.replace('\\', '/') for i in cmd]
    return (srcs, ofilenames, cmd)

dataset/ETHPy150Open mesonbuild/meson/mesonbuild/backend/backends.py Backend.eval_custom_target_command/original