Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Taylor <dylan@dylanmtaylor.com>2021-05-15 13:59:37 -0400
committerDylan Taylor <dylan@dylanmtaylor.com>2021-05-15 13:59:37 -0400
commit3b20adb7d216cbe72bf1770e219207216bee96ee (patch)
tree8e90b3795bfae1e0e3e3bfaebf7f341c9d9e6362
parenta75dd6ea3a4f961ddfeaff6b4378bd4aac5c3b39 (diff)
Whitespace changes
-rw-r--r--archinstall/lib/disk.py16
-rw-r--r--archinstall/lib/general.py2
-rw-r--r--archinstall/lib/hardware.py2
-rw-r--r--archinstall/lib/installer.py5
-rw-r--r--archinstall/lib/mirrors.py2
-rw-r--r--archinstall/lib/profiles.py6
-rw-r--r--archinstall/lib/services.py2
-rw-r--r--docs/pull_request_template.md3
-rw-r--r--examples/guided.py12
-rw-r--r--profiles/gnome.py4
-rw-r--r--profiles/xorg.py4
11 files changed, 31 insertions, 27 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index 2241ac8e..62f1785f 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -152,8 +152,9 @@ class BlockDevice():
def flush_cache(self):
self.part_cache = OrderedDict()
+
class Partition():
- def __init__(self, path :str, block_device :BlockDevice, part_id=None, size=-1, filesystem=None, mountpoint=None, encrypted=False, autodetect_filesystem=True):
+ def __init__(self, path: str, block_device: BlockDevice, part_id=None, size=-1, filesystem=None, mountpoint=None, encrypted=False, autodetect_filesystem=True):
if not part_id:
part_id = os.path.basename(path)
@@ -506,9 +507,9 @@ class Filesystem():
self.blockdevice.partition[0].allow_formatting = True
self.blockdevice.partition[1].allow_formatting = True
else:
- #we don't need a seprate boot partition it would be a waste of space
+ # we don't need a seprate boot partition it would be a waste of space
self.add_partition('primary', start='1MB', end='100%')
- self.blockdevice.partition[0].filesystem=root_filesystem_type
+ self.blockdevice.partition[0].filesystem = root_filesystem_type
log(f"Set the root partition {self.blockdevice.partition[0]} to use filesystem {root_filesystem_type}.", level=logging.DEBUG)
self.blockdevice.partition[0].target_mountpoint = '/'
self.blockdevice.partition[0].allow_formatting = True
@@ -558,28 +559,31 @@ def device_state(name, *args, **kwargs):
return
return True
+
# lsblk --json -l -n -o path
def all_disks(*args, **kwargs):
kwargs.setdefault("partitions", False)
drives = OrderedDict()
- #for drive in json.loads(sys_command(f'losetup --json', *args, **lkwargs, hide_from_log=True)).decode('UTF_8')['loopdevices']:
+ # for drive in json.loads(sys_command(f'losetup --json', *args, **lkwargs, hide_from_log=True)).decode('UTF_8')['loopdevices']:
for drive in json.loads(b''.join(sys_command(f'lsblk --json -l -n -o path,size,type,mountpoint,label,pkname,model', *args, **kwargs, hide_from_log=True)).decode('UTF_8'))['blockdevices']:
if not kwargs['partitions'] and drive['type'] == 'part': continue
drives[drive['path']] = BlockDevice(drive['path'], drive)
return drives
+
def convert_to_gigabytes(string):
unit = string.strip()[-1]
size = float(string.strip()[:-1])
if unit == 'M':
- size = size/1024
+ size = size / 1024
elif unit == 'T':
- size = size*1024
+ size = size * 1024
return size
+
def harddrive(size=None, model=None, fuzzy=False):
collection = all_disks()
for drive in collection:
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py
index 9f6de666..f9b9078a 100644
--- a/archinstall/lib/general.py
+++ b/archinstall/lib/general.py
@@ -83,10 +83,12 @@ class JSON(json.JSONEncoder, json.JSONDecoder):
def encode(self, obj):
return super(JSON, self).encode(self._encode(obj))
+
class sys_command:
"""
Stolen from archinstall_gui
"""
+
def __init__(self, cmd, callback=None, start_callback=None, peak_output=False, environment_vars={}, *args, **kwargs):
kwargs.setdefault("worker_id", gen_uid())
kwargs.setdefault("emulate", False)
diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py
index 9eaff22e..3203daee 100644
--- a/archinstall/lib/hardware.py
+++ b/archinstall/lib/hardware.py
@@ -108,7 +108,7 @@ def cpuVendor() -> Optional[str]:
def isVM() -> bool:
try:
- subprocess.check_call(["systemd-detect-virt"]) # systemd-detect-virt issues a non-zero exit code if it is not on a virtual machine
+ subprocess.check_call(["systemd-detect-virt"]) # systemd-detect-virt issues a non-zero exit code if it is not on a virtual machine
return True
except:
return False
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index eccd2c49..cacdff69 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -153,7 +153,7 @@ class Installer():
return True
- def set_hostname(self, hostname :str, *args, **kwargs):
+ def set_hostname(self, hostname: str, *args, **kwargs):
with open(f'{self.target}/etc/hostname', 'w') as fh:
fh.write(hostname + '\n')
@@ -423,7 +423,6 @@ class Installer():
## blkid doesn't trigger on loopback devices really well,
## so we'll use the old manual method until we get that sorted out.
-
if (real_device := self.detect_encryption(root_partition)):
# TODO: We need to detect if the encrypted device is a whole disk encryption,
# or simply a partition encryption. Right now we assume it's a partition (and we always have)
@@ -446,7 +445,7 @@ class Installer():
sys_command('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg')
return True
else:
- root_device = subprocess.check_output(f'basename "$(readlink -f /sys/class/block/{root_partition.path.replace("/dev/","")}/..)"', shell=True).decode().strip()
+ root_device = subprocess.check_output(f'basename "$(readlink -f /sys/class/block/{root_partition.path.replace("/dev/", "")}/..)"', shell=True).decode().strip()
if root_device == "block":
root_device = f"{root_partition.path}"
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.target} grub-install --target=i386-pc /dev/{root_device}'))
diff --git a/archinstall/lib/mirrors.py b/archinstall/lib/mirrors.py
index e53b356a..4b05b96a 100644
--- a/archinstall/lib/mirrors.py
+++ b/archinstall/lib/mirrors.py
@@ -22,7 +22,7 @@ def filter_mirrors_by_region(regions, destination='/etc/pacman.d/mirrorlist', tm
return True
-def add_custom_mirrors(mirrors:list, *args, **kwargs):
+def add_custom_mirrors(mirrors: list, *args, **kwargs):
"""
This will append custom mirror definitions in pacman.conf
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py
index 8b5525b4..2f97231c 100644
--- a/archinstall/lib/profiles.py
+++ b/archinstall/lib/profiles.py
@@ -14,7 +14,7 @@ from .storage import storage
def grab_url_data(path):
- safe_path = path[:path.find(':')+1]+''.join([item if item in ('/', '?', '=', '&') else urllib.parse.quote(item) for item in multisplit(path[path.find(':')+1:], ('/', '?', '=', '&'))])
+ safe_path = path[:path.find(':') + 1] + ''.join([item if item in ('/', '?', '=', '&') else urllib.parse.quote(item) for item in multisplit(path[path.find(':') + 1:], ('/', '?', '=', '&'))])
ssl_context = ssl.create_default_context()
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
@@ -47,7 +47,7 @@ def list_profiles(filter_irrelevant_macs=True, subpath='', filter_top_level_prof
if len(first_line) and first_line[0] == '#':
description = first_line[1:].strip()
- cache[file[:-3]] = {'path' : os.path.join(root, file), 'description' : description, 'tailored' : tailored}
+ cache[file[:-3]] = {'path': os.path.join(root, file), 'description': description, 'tailored': tailored}
break
# Grab profiles from upstream URL
@@ -70,7 +70,7 @@ def list_profiles(filter_irrelevant_macs=True, subpath='', filter_top_level_prof
continue
tailored = True
- cache[profile[:-3]] = {'path' : os.path.join(storage["UPSTREAM_URL"]+subpath, profile), 'description' : profile_list[profile], 'tailored' : tailored}
+ cache[profile[:-3]] = {'path': os.path.join(storage["UPSTREAM_URL"] + subpath, profile), 'description': profile_list[profile], 'tailored': tailored}
if filter_top_level_profiles:
for profile in list(cache.keys()):
diff --git a/archinstall/lib/services.py b/archinstall/lib/services.py
index 46aa7846..537a2f84 100644
--- a/archinstall/lib/services.py
+++ b/archinstall/lib/services.py
@@ -5,6 +5,6 @@ def service_state(service_name: str):
if os.path.splitext(service_name)[1] != '.service':
service_name += '.service' # Just to be safe
- state = b''.join(sys_command(f'systemctl show --no-pager -p SubState --value {service_name}', environment_vars={'SYSTEMD_COLORS' : '0'}))
+ state = b''.join(sys_command(f'systemctl show --no-pager -p SubState --value {service_name}', environment_vars={'SYSTEMD_COLORS': '0'}))
return state.strip().decode('UTF-8')
diff --git a/docs/pull_request_template.md b/docs/pull_request_template.md
index 18d01ab2..1cbcf76a 100644
--- a/docs/pull_request_template.md
+++ b/docs/pull_request_template.md
@@ -12,5 +12,4 @@ If the PR is larger than ~20 lines, please describe it here unless described in
# Testing
-Any new feature or stability improvement should be tested if possible. Please follow the test instructions at the bottom
-of the README or use the ISO built on each PR.
+Any new feature or stability improvement should be tested if possible. Please follow the test instructions at the bottom of the README or use the ISO built on each PR.
diff --git a/examples/guided.py b/examples/guided.py
index ae5c5f54..ca50f838 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -85,7 +85,7 @@ def ask_user_questions():
# If we provide keys as options, it's better to convert them to list and sort before passing
mountpoints_list = sorted(list(partition_mountpoints.keys()))
partition = archinstall.generic_select(mountpoints_list,
- "Select a partition by number that you want to set a mount-point for (leave blank when done): ")
+ "Select a partition by number that you want to set a mount-point for (leave blank when done): ")
if not partition:
if set(mountpoints_set) & {'/', '/boot'} == {'/', '/boot'}:
break
@@ -316,12 +316,12 @@ def perform_installation(mountpoint):
time.sleep(1)
# Set mirrors used by pacstrap (outside of installation)
if archinstall.arguments.get('mirror-region', None):
- archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium
+ archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium
if installation.minimal_installation():
installation.set_hostname(archinstall.arguments['hostname'])
if archinstall.arguments['mirror-region'].get("mirrors", None) is not None:
- installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium
- if archinstall.arguments["bootloader"]=="grub-install" and hasUEFI()==True:
+ installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium
+ if archinstall.arguments["bootloader"] == "grub-install" and hasUEFI() == True:
installation.add_additional_packages("grub")
installation.set_keyboard_language(archinstall.arguments['keyboard-language'])
installation.add_bootloader(archinstall.arguments["bootloader"])
@@ -329,8 +329,8 @@ def perform_installation(mountpoint):
# If user selected to copy the current ISO network configuration
# Perform a copy of the config
if archinstall.arguments.get('nic', {}) == 'Copy ISO network configuration to installation':
- installation.copy_ISO_network_config(enable_services=True) # Sources the ISO network configuration to the install medium.
- elif archinstall.arguments.get('nic', {}).get('NetworkManager',False):
+ installation.copy_ISO_network_config(enable_services=True) # Sources the ISO network configuration to the install medium.
+ elif archinstall.arguments.get('nic', {}).get('NetworkManager', False):
installation.add_additional_packages("networkmanager")
installation.enable_service('NetworkManager.service')
# Otherwise, if a interface was selected, configure that interface
diff --git a/profiles/gnome.py b/profiles/gnome.py
index 09fac1bb..7bf5b7fd 100644
--- a/profiles/gnome.py
+++ b/profiles/gnome.py
@@ -37,5 +37,5 @@ if __name__ == 'gnome':
archinstall.storage['installation_session'].add_additional_packages(__packages__)
archinstall.storage['installation_session'].enable_service('gdm') # Gnome Display Manager
- # We could also start it via xinitrc since we do have Xorg,
- # but for gnome that's deprecated and wayland is preferred.
+# We could also start it via xinitrc since we do have Xorg,
+# but for gnome that's deprecated and wayland is preferred.
diff --git a/profiles/xorg.py b/profiles/xorg.py
index 3351e4e5..e18a4f03 100644
--- a/profiles/xorg.py
+++ b/profiles/xorg.py
@@ -30,11 +30,11 @@ if __name__ == 'xorg':
try:
if "nvidia" in _gfx_driver_packages:
if "linux-zen" in archinstall.storage['installation_session'].base_packages or "linux-lts" in archinstall.storage['installation_session'].base_packages:
- archinstall.storage['installation_session'].add_additional_packages("dkms")#I've had kernel regen fail if it wasn't installed before nvidia-dkms
+ archinstall.storage['installation_session'].add_additional_packages("dkms") # I've had kernel regen fail if it wasn't installed before nvidia-dkms
archinstall.storage['installation_session'].add_additional_packages("xorg-server xorg-xinit nvidia-dkms")
else:
archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(_gfx_driver_packages)}")
else:
archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(_gfx_driver_packages)}")
except:
- archinstall.storage['installation_session'].add_additional_packages("xorg-server xorg-xinit") # Prep didn't run, so there's no driver to install \ No newline at end of file
+ archinstall.storage['installation_session'].add_additional_packages("xorg-server xorg-xinit") # Prep didn't run, so there's no driver to install