Skip to content
Snippets Groups Projects
pkgs_envsetup.py 794 B
Newer Older
#!/usr/bin/env python3

from subprocess import call, DEVNULL

PACKAGES = [
    "python3-defusedxml",
    "python3-openssl",
    "python3-psutil",
    "python3-requests",
    "python3-spf",
]
Nicolas KAROLAK's avatar
Nicolas KAROLAK committed
        if call(
            ["/usr/bin/dpkg", "-s", pkg], shell=False, stdout=DEVNULL, stderr=DEVNULL
        ):
            result = call(
                ["/usr/bin/apt", "install", pkg],
                shell=False,
                stdout=DEVNULL,
                stderr=DEVNULL,
            )
            if not result:
                print("{} install succeeded".format(pkg))
            else:
                print("{} install failed".format(pkg))
        else:
            print("{} already installed".format(pkg))


if __name__ == "__main__":
    main()