Merge pull request #735 from siduction/pep8-initcpiocfg

Fixed pep8 whining in module initcpiocfg
This commit is contained in:
adriaandegroot 2017-06-04 11:35:15 +02:00 committed by GitHub
commit 084e304c07

View File

@ -5,6 +5,7 @@
# #
# Copyright 2014, Rohan Garg <rohan@kde.org> # Copyright 2014, Rohan Garg <rohan@kde.org>
# Copyright 2015, Philip Müller <philm@manjaro.org> # Copyright 2015, Philip Müller <philm@manjaro.org>
# Copyright 2017, Alf Gaida <agaida@sidution.org>
# #
# Calamares is free software: you can redistribute it and/or modify # Calamares is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -25,7 +26,9 @@ from collections import OrderedDict
def cpuinfo(): 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['proc0']={...}
cpu_info['proc1']={...} cpu_info['proc1']={...}
@ -45,7 +48,8 @@ def cpuinfo():
procinfo = OrderedDict() procinfo = OrderedDict()
else: else:
if len(line.split(':')) == 2: 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: else:
procinfo[line.split(':')[0].strip()] = '' procinfo[line.split(':')[0].strip()] = ''
@ -53,7 +57,8 @@ def cpuinfo():
def write_mkinitcpio_lines(hooks, modules, files, root_mount_point): def write_mkinitcpio_lines(hooks, modules, files, root_mount_point):
""" Set up mkinitcpio.conf. """
Set up mkinitcpio.conf.
:param hooks: :param hooks:
:param modules: :param modules:
@ -81,7 +86,8 @@ def write_mkinitcpio_lines(hooks, modules, files, root_mount_point):
def modify_mkinitcpio_conf(partitions, root_mount_point): def modify_mkinitcpio_conf(partitions, root_mount_point):
""" Modifies mkinitcpio.conf """
Modifies mkinitcpio.conf
:param partitions: :param partitions:
:param root_mount_point: :param root_mount_point:
@ -89,7 +95,8 @@ def modify_mkinitcpio_conf(partitions, root_mount_point):
cpu = cpuinfo() cpu = cpuinfo()
swap_uuid = "" swap_uuid = ""
btrfs = "" btrfs = ""
hooks = ["base", "udev", "autodetect", "modconf", "block", "keyboard", "keymap"] hooks = ["base", "udev", "autodetect", "modconf", "block", "keyboard",
"keymap"]
modules = [] modules = []
files = [] files = []
encrypt_hook = False encrypt_hook = False
@ -113,13 +120,16 @@ def modify_mkinitcpio_conf(partitions, root_mount_point):
if partition["mountPoint"] == "/" and "luksMapperName" in partition: if partition["mountPoint"] == "/" and "luksMapperName" in partition:
encrypt_hook = True 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 unencrypted_separate_boot = True
if encrypt_hook: if encrypt_hook:
hooks.append("encrypt") hooks.append("encrypt")
if not unencrypted_separate_boot and \ 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") files.append("/crypto_keyfile.bin")
if swap_uuid is not "": 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": if btrfs is "yes" and cpu['proc0']['vendor_id'].lower() != "genuineintel":
modules.append("crc32c") 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") modules.append("crc32c-intel")
else: else:
hooks.append("fsck") hooks.append("fsck")
@ -140,7 +151,8 @@ def modify_mkinitcpio_conf(partitions, root_mount_point):
def run(): def run():
""" Calls routine with given parameters to modify '/etc/mkinitcpio.conf'. """
Calls routine with given parameters to modify '/etc/mkinitcpio.conf'.
:return: :return:
""" """