llvm/llvm/test/Other/ChangePrinters/DotCfg/lit.local.cfg

import os
import subprocess


def have_needed_dot_support():
    if not os.path.exists("/usr/bin/dot"):
        return False

    try:
        ld_cmd = subprocess.Popen(
            ["/usr/bin/dot", "-T?"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
        )
        ld_err = ld_cmd.stderr.read().decode()
        ld_cmd.wait()
    except:
        return False

    return "pdf" in ld_err


if not have_needed_dot_support():
    config.unsupported = True