From b7488b611b76c617d849d161208d5ce4608b36b8 Mon Sep 17 00:00:00 2001 From: Alf Gaida Date: Wed, 29 Mar 2017 21:59:22 +0200 Subject: [PATCH] Fixed pep8 whining in module initcpiocfg Added myself to copyright --- src/modules/initcpiocfg/main.py | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index 5a0d028da..2f6f12b52 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -5,6 +5,7 @@ # # Copyright 2014, Rohan Garg # Copyright 2015, Philip Müller +# Copyright 2017, Alf Gaida # # Calamares is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,7 +26,9 @@ from collections import OrderedDict def cpuinfo(): - """ Return the information in /proc/cpuinfo as a dictionary in the following format: + """ + Return the information in /proc/cpuinfo as a dictionary in the following + format: cpu_info['proc0']={...} cpu_info['proc1']={...} @@ -45,7 +48,8 @@ def cpuinfo(): procinfo = OrderedDict() else: if len(line.split(':')) == 2: - procinfo[line.split(':')[0].strip()] = line.split(':')[1].strip() + splitted_line = line.split(':')[1].strip() + procinfo[line.split(':')[0].strip()] = splitted_line else: procinfo[line.split(':')[0].strip()] = '' @@ -53,7 +57,8 @@ def cpuinfo(): def write_mkinitcpio_lines(hooks, modules, files, root_mount_point): - """ Set up mkinitcpio.conf. + """ + Set up mkinitcpio.conf. :param hooks: :param modules: @@ -81,7 +86,8 @@ def write_mkinitcpio_lines(hooks, modules, files, root_mount_point): def modify_mkinitcpio_conf(partitions, root_mount_point): - """ Modifies mkinitcpio.conf + """ + Modifies mkinitcpio.conf :param partitions: :param root_mount_point: @@ -89,7 +95,8 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): cpu = cpuinfo() swap_uuid = "" btrfs = "" - hooks = ["base", "udev", "autodetect", "modconf", "block", "keyboard", "keymap"] + hooks = ["base", "udev", "autodetect", "modconf", "block", "keyboard", + "keymap"] modules = [] files = [] encrypt_hook = False @@ -113,13 +120,16 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): if partition["mountPoint"] == "/" and "luksMapperName" in partition: encrypt_hook = True - if partition["mountPoint"] == "/boot" and "luksMapperName" not in partition: + if (partition["mountPoint"] == "/boot" + and "luksMapperName" not in partition): unencrypted_separate_boot = True if encrypt_hook: hooks.append("encrypt") if not unencrypted_separate_boot and \ - os.path.isfile(os.path.join(root_mount_point, "crypto_keyfile.bin")): + os.path.isfile( + os.path.join(root_mount_point, "crypto_keyfile.bin") + ): files.append("/crypto_keyfile.bin") if swap_uuid is not "": @@ -131,7 +141,8 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): if btrfs is "yes" and cpu['proc0']['vendor_id'].lower() != "genuineintel": modules.append("crc32c") - elif btrfs is "yes" and cpu['proc0']['vendor_id'].lower() == "genuineintel": + elif (btrfs is "yes" + and cpu['proc0']['vendor_id'].lower() == "genuineintel"): modules.append("crc32c-intel") else: hooks.append("fsck") @@ -140,7 +151,8 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): def run(): - """ Calls routine with given parameters to modify '/etc/mkinitcpio.conf'. + """ + Calls routine with given parameters to modify '/etc/mkinitcpio.conf'. :return: """