diff options
Diffstat (limited to 'devbot/distro.py')
-rw-r--r-- | devbot/distro.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/devbot/distro.py b/devbot/distro.py index 34f54bc..fe2522d 100644 --- a/devbot/distro.py +++ b/devbot/distro.py @@ -1,5 +1,29 @@ import subprocess +from devbot import command + +class FedoraPackageManager: + def install_packages(self, packages): + args = ["yum", "install"] + args.extend(packages) + + command.run_with_sudo(args) + +class UbuntuPackageManager: + def install_packages(self, packages): + args = ["apt-get", "install"] + args.extend(packages) + + command.run_with_sudo(args) + +def get_package_manager(): + name, version = _get_distro_info() + + if name == "fedora": + return FedoraPackageManager() + elif name == "ubuntu": + return UbuntuPackageManager() + def get_system_version(): name, version = _get_distro_info() if (name == "ubuntu" and version == "12.10") or \ |