mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-30 02:45:37 -04:00
Python Better Docstrings
This commit is contained in:
parent
b8b41bdfdd
commit
113d9db7cb
15 changed files with 295 additions and 11 deletions
|
@ -23,10 +23,18 @@ from libcalamares.utils import check_chroot_call, chroot_call
|
|||
|
||||
|
||||
class PackageManager:
|
||||
"""
|
||||
|
||||
:param backend:
|
||||
"""
|
||||
def __init__(self, backend):
|
||||
self.backend = backend
|
||||
|
||||
def install(self, pkgs):
|
||||
"""
|
||||
|
||||
:param pkgs:
|
||||
"""
|
||||
if self.backend == "packagekit":
|
||||
for pkg in pkgs:
|
||||
check_chroot_call(["pkcon", "-py", "install", pkg])
|
||||
|
@ -48,6 +56,10 @@ class PackageManager:
|
|||
check_chroot_call(["pacman", "-Sy", "--noconfirm"] + pkgs)
|
||||
|
||||
def remove(self, pkgs):
|
||||
"""
|
||||
|
||||
:param pkgs:
|
||||
"""
|
||||
if self.backend == "packagekit":
|
||||
for pkg in pkgs:
|
||||
check_chroot_call(["pkcon", "-py", "remove", pkg])
|
||||
|
@ -68,6 +80,11 @@ class PackageManager:
|
|||
|
||||
|
||||
def run_operations(pkgman, entry):
|
||||
"""
|
||||
|
||||
:param pkgman:
|
||||
:param entry:
|
||||
"""
|
||||
for key in entry.keys():
|
||||
if key == "install":
|
||||
pkgman.install(entry[key])
|
||||
|
@ -76,6 +93,11 @@ def run_operations(pkgman, entry):
|
|||
|
||||
|
||||
def run():
|
||||
"""
|
||||
|
||||
|
||||
:return:
|
||||
"""
|
||||
backend = libcalamares.job.configuration.get("backend")
|
||||
if backend not in ("packagekit", "zypp", "yum", "dnf", "urpmi", "apt", "pacman"):
|
||||
return ("Bad backend", "backend=\"{}\"".format(backend))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue