From a1e1c66f1d8f858ff953b45ece7469354a083d0d Mon Sep 17 00:00:00 2001 From: Philip Date: Fri, 23 Jun 2017 12:29:44 +0200 Subject: [PATCH] [PEP8] fix several modules --- src/modules/chrootcfg/main.py | 17 ++++++++++++----- src/modules/services/main.py | 4 ++-- src/modules/servicescfg/main.py | 7 ++++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/modules/chrootcfg/main.py b/src/modules/chrootcfg/main.py index fa0d38509..88297f538 100644 --- a/src/modules/chrootcfg/main.py +++ b/src/modules/chrootcfg/main.py @@ -82,8 +82,10 @@ class OperationTracker: libcalamares.job.setprogress(self.progress) + ON_POSIX = 'posix' in sys.builtin_module_names + class PacmanController: def __init__(self, root): self.__root = root @@ -146,8 +148,13 @@ class PacmanController: self.tracker.downloaded += 1 phase = 1 debug("Downloading: {}".format(dl[0])) - debug("Downloaded packages: {}".format(self.tracker.downloaded)) - self.tracker.send_progress(self.tracker.downloaded, phase) + debug("Downloaded packages: {}".format( + self.tracker.downloaded + )) + self.tracker.send_progress( + self.tracker.downloaded, + phase + ) last = dl elif inst: @@ -197,7 +204,7 @@ class PacmanController: elif key == "localInstall": for pkg in self.operations[key]: pkgs.extend([pkg["package"]]) - self.install(pkgs,local=True) + self.install(pkgs, local=True) elif key == "remove": for pkg in self.operations[key]: pkgs.extend([pkg["package"]]) @@ -244,7 +251,7 @@ class ChrootController: dest = self.root + target["name"] if not os.path.exists(dest): debug("Create: {}".format(dest)) - mod = int(target["mode"],8) + mod = int(target["mode"], 8) debug("Mode: {}".format(oct(mod))) os.makedirs(dest, mode=mod) @@ -262,7 +269,6 @@ class ChrootController: cal_umask = os.umask(0) self.make_dirs() path = join(self.root, "run") - #debug("Fix permissions: {}".format(path)) os.chmod(path, 0o755) os.umask(cal_umask) self.copy_file('etc/pacman-mirrors.conf') @@ -277,6 +283,7 @@ class ChrootController: return pacman.run() + def run(): """ Create chroot dirs and install pacman, diff --git a/src/modules/services/main.py b/src/modules/services/main.py index b9f2dc0e0..516979e49 100644 --- a/src/modules/services/main.py +++ b/src/modules/services/main.py @@ -112,8 +112,8 @@ def run(): if ec != 0: return "Cannot enable systemd service {}".format(dm), \ - "systemctl enable call in chroot returned error code " \ - "{}".format(ec) + "systemctl enable call in chroot returned error " \ + "code {}".format(ec) else: libcalamares.utils.debug( "Cannot enable systemd service {}".format(dm) diff --git a/src/modules/servicescfg/main.py b/src/modules/servicescfg/main.py index 79968d725..f3f9a97a9 100644 --- a/src/modules/servicescfg/main.py +++ b/src/modules/servicescfg/main.py @@ -79,7 +79,12 @@ class ServicesController: def update(self, action, state): for svc in self.services[state]: if exists(self.root + "/etc/init.d/" + svc["name"]): - target_env_call(["rc-update", action, svc["name"], svc["runlevel"]]) + target_env_call([ + "rc-update", + action, + svc["name"], + svc["runlevel"] + ]) def run(self): self.configure()