[PEP 8] General Style Part 2

main
Gormogon 10 years ago
parent d8df3d7a59
commit 09dc6bb5d7

@ -21,10 +21,12 @@
import libcalamares
from libcalamares.utils import check_chroot_call
def run_mkinitcpio():
kernel = libcalamares.job.configuration['kernel']
check_chroot_call(['mkinitcpio', '-p', kernel])
def run():
run_mkinitcpio()
return None

@ -20,6 +20,7 @@
from libcalamares.utils import chroot_call
def run():
returnCode = chroot_call(["update-initramfs", "-k", "all", "-u"])
if returnCode != 0:

@ -21,6 +21,7 @@
import libcalamares
from libcalamares.utils import check_chroot_call, chroot_call
class PackageManager:
def __init__(self, backend):
self.backend = backend
@ -30,13 +31,17 @@ class PackageManager:
for pkg in pkgs:
check_chroot_call(["pkcon", "-py", "install", pkg])
elif self.backend == "zypp":
check_chroot_call(["zypper", "--non-interactive", "--quiet-install", "install", "--auto-agree-with-licenses", "install"] + pkgs)
check_chroot_call(
["zypper", "--non-interactive", "--quiet-install", "install",
"--auto-agree-with-licenses", "install"] + pkgs)
elif self.backend == "yum":
check_chroot_call(["yum", "install", "-y"] + pkgs)
elif self.backend == "dnf":
check_chroot_call(["dnf", "install", "-y"] + pkgs)
elif self.backend == "urpmi":
check_chroot_call(["urpmi", "--download-all", "--no-suggests", "--no-verify-rpm", "--fastunsafe", "--ignoresize", "--nolock", "--auto"] + pkgs)
check_chroot_call(
["urpmi", "--download-all", "--no-suggests", "--no-verify-rpm",
"--fastunsafe", "--ignoresize", "--nolock", "--auto"] + pkgs)
elif self.backend == "apt":
check_chroot_call(["apt-get", "-q", "-y", "install"] + pkgs)
elif self.backend == "pacman":
@ -61,6 +66,7 @@ class PackageManager:
elif self.backend == "pacman":
check_chroot_call(["pacman", "-Rs", "--noconfirm"] + pkgs)
def run_operations(pkgman, entry):
for key in entry.keys():
if key == "install":
@ -68,6 +74,7 @@ def run_operations(pkgman, entry):
elif key == "remove":
pkgman.remove(entry[key])
def run():
backend = libcalamares.job.configuration.get("backend")
if backend not in ("packagekit", "zypp", "yum", "dnf", "urpmi", "apt", "pacman"):

@ -30,6 +30,7 @@ from collections import namedtuple
from libcalamares import *
class UnpackEntry:
__slots__ = ['source', 'sourcefs', 'destination', 'copied', 'total']
@ -40,6 +41,7 @@ class UnpackEntry:
self.copied = 0
self.total = 0
ON_POSIX = 'posix' in sys.builtin_module_names
@ -104,7 +106,6 @@ def file_copy(source, dest, progress_cb):
class UnpackOperation:
def __init__(self, entries):
self.entries = entries
self.entry_for_source = dict((x.source, x) for x in self.entries)
@ -117,8 +118,7 @@ class UnpackOperation:
partialprogress = 0.05 # Having a total !=0 gives 5%
partialprogress += 0.95 * \
(entry.copied / float(entry.total))
partialprogress += 0.95 * (entry.copied / float(entry.total))
progress += partialprogress / len(self.entries)
job.setprogress(progress)
@ -138,7 +138,8 @@ class UnpackOperation:
if entry.sourcefs == "squashfs":
if shutil.which("unsquashfs") is None:
return ("Failed to unpack image", "Failed to find unsquashfs, make sure you have "
return ("Failed to unpack image",
"Failed to find unsquashfs, make sure you have "
"the squashfs-tools package installed")
fslist = subprocess.check_output(["unsquashfs",

Loading…
Cancel
Save