Python-style: actually add the new copyright headers

This commit is contained in:
Adriaan de Groot 2017-06-04 15:01:25 +02:00
commit 231a83cf6b
3 changed files with 31 additions and 20 deletions

View File

@ -5,6 +5,7 @@
# #
# Copyright 2014, Aurélien Gâteau <agateau@kde.org> # Copyright 2014, Aurélien Gâteau <agateau@kde.org>
# Copyright 2016, Teo Mrnjavac <teo@kde.org> # Copyright 2016, Teo Mrnjavac <teo@kde.org>
# Copyright 2017, Alf Gaida <agaida@siduction.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
@ -32,7 +33,7 @@ FSTAB_HEADER = """# /etc/fstab: static file system information.
# be used with UUID= as a more robust way to name devices that works even if # be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5). # disks are added and removed. See fstab(5).
# #
# <file system> <mount point> <type> <options> <dump> <pass>""" # <file system> <mount point> <type> <options> <dump> <pass>"""
CRYPTTAB_HEADER = """# /etc/crypttab: mappings for encrypted partitions. CRYPTTAB_HEADER = """# /etc/crypttab: mappings for encrypted partitions.
# #
@ -46,7 +47,7 @@ CRYPTTAB_HEADER = """# /etc/crypttab: mappings for encrypted partitions.
# to encrypted swap, which should be set up with mkinitcpio-openswap # to encrypted swap, which should be set up with mkinitcpio-openswap
# for resume support. # for resume support.
# #
# <name> <device> <password> <options>""" # <name> <device> <password> <options>"""
# Turn Parted filesystem names into fstab names # Turn Parted filesystem names into fstab names
FS_MAP = { FS_MAP = {
@ -168,7 +169,7 @@ class FstabGenerator(object):
dct["device"], dct["device"],
dct["password"], dct["password"],
dct["options"], dct["options"],
) )
print(line, file=file) print(line, file=file)
@ -181,8 +182,10 @@ class FstabGenerator(object):
print(FSTAB_HEADER, file=fstab_file) print(FSTAB_HEADER, file=fstab_file)
for partition in self.partitions: for partition in self.partitions:
# Special treatment for a btrfs root with @ and @home subvolumes # Special treatment for a btrfs root with @ and @home
if partition["fs"] == "btrfs" and partition["mountPoint"] == "/": # subvolumes
if (partition["fs"] == "btrfs"
and partition["mountPoint"] == "/"):
output = subprocess.check_output(['btrfs', output = subprocess.check_output(['btrfs',
'subvolume', 'subvolume',
'list', 'list',
@ -216,7 +219,7 @@ class FstabGenerator(object):
fs="tmpfs", fs="tmpfs",
options="defaults,noatime,mode=1777", options="defaults,noatime,mode=1777",
check=0, check=0,
) )
self.print_fstab_line(dct, file=fstab_file) self.print_fstab_line(dct, file=fstab_file)
def generate_fstab_line_info(self, partition): def generate_fstab_line_info(self, partition):
@ -249,13 +252,15 @@ class FstabGenerator(object):
self.root_is_ssd = is_ssd self.root_is_ssd = is_ssd
if filesystem == "btrfs" and "subvol" in partition: if filesystem == "btrfs" and "subvol" in partition:
return dict(device="UUID=" + partition["uuid"], return dict(
mount_point=mount_point, device="UUID=" + partition["uuid"],
fs=filesystem, mount_point=mount_point,
options=",".join(["subvol={}".format(partition["subvol"]), fs=filesystem,
options]), options=",".join(
check=check, ["subvol={}".format(partition["subvol"]), options]
) ),
check=check,
)
return dict(device="UUID=" + partition["uuid"], return dict(device="UUID=" + partition["uuid"],
mount_point=mount_point or "swap", mount_point=mount_point or "swap",
@ -266,12 +271,12 @@ class FstabGenerator(object):
def print_fstab_line(self, dct, file=None): def print_fstab_line(self, dct, file=None):
""" Prints line to '/etc/fstab' file. """ """ Prints line to '/etc/fstab' file. """
line = "{:41} {:<14} {:<7} {:<10} 0 {}".format(dct["device"], line = "{:41} {:<14} {:<7} {:<10} 0 {}".format(dct["device"],
dct["mount_point"], dct["mount_point"],
dct["fs"], dct["fs"],
dct["options"], dct["options"],
dct["check"], dct["check"],
) )
print(line, file=file) print(line, file=file)
def create_mount_points(self): def create_mount_points(self):

View File

@ -4,6 +4,7 @@
# === This file is part of Calamares - <http://github.com/calamares> === # === This file is part of Calamares - <http://github.com/calamares> ===
# #
# Copyright 2014, Philip Müller <philm@manjaro.org> # Copyright 2014, Philip Müller <philm@manjaro.org>
# Copyright 2017, Alf Gaida <agaida@siduction.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
@ -29,4 +30,7 @@ def run():
return_code = target_env_call(["update-initramfs", "-k", "all", "-u"]) return_code = target_env_call(["update-initramfs", "-k", "all", "-u"])
if return_code != 0: if return_code != 0:
return "Failed to run update-initramfs on the target", "The exit code was {}".format(return_code) return (
"Failed to run update-initramfs on the target",
"The exit code was {}".format(return_code)
)

View File

@ -4,6 +4,8 @@
# === This file is part of Calamares - <http://github.com/calamares> === # === This file is part of Calamares - <http://github.com/calamares> ===
# #
# Copyright 2016, Teo Mrnjavac <teo@kde.org> # Copyright 2016, Teo Mrnjavac <teo@kde.org>
# Copyright 2017, Alf Gaida <agaida@siduction.org>
# Copyright 2017, Adriaan de Groot <groot@kde.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