Skip to content
Snippets Groups Projects
pkgs_envsetup.py 962 B
Newer Older
from subprocess import run, DEVNULL, PIPE
    "bsd-mailx",  # for "mail" command used in tester
    "python3-defusedxml",
    "python3-openssl",
    "python3-psutil",
    "python3-requests",
    "python3-spf",
]
        if run(
            ["/usr/bin/dpkg", "-s", pkg],
            shell=False,
            stdout=DEVNULL,
            stderr=DEVNULL,
            stdin=PIPE,
        ).returncode != 0:
            result = run(
                ["/usr/bin/apt", "install", "-y", pkg],
Nicolas KAROLAK's avatar
Nicolas KAROLAK committed
                shell=False,
                stdout=DEVNULL,
                stderr=DEVNULL,
Nicolas KAROLAK's avatar
Nicolas KAROLAK committed
            )
            if not result:
                print("{} install succeeded".format(pkg))
            else:
                print("{} install failed".format(pkg))
        else:
            print("{} already installed".format(pkg))


if __name__ == "__main__":
    main()