Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md80
-rw-r--r--archinstall/lib/mirrors.py3
-rw-r--r--archinstall/lib/networking.py7
-rw-r--r--archinstall/lib/output.py13
-rw-r--r--archinstall/lib/packages.py2
-rw-r--r--archinstall/lib/profiles.py11
-rw-r--r--archinstall/lib/storage.py12
-rw-r--r--archinstall/lib/user_interaction.py80
-rw-r--r--docs/conf.py2
-rw-r--r--docs/pull_request_template.md4
-rw-r--r--examples/guided.py4
11 files changed, 121 insertions, 97 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index a72704bb..cc443fbd 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,57 +1,79 @@
# Contributing to archinstall
-Any contributions through pull requests are welcome as this project aims to be a community based project to ease some Arch Linux installation steps. Bear in mind that in the future this repo might be transferred to the official [GitLab repo under Arch Linux](http://gitlab.archlinux.org/archlinux/) *(if GitLab becomes open to the general public)*.
+Any contributions through pull requests are welcome as this project aims to be a community based project to ease some
+Arch Linux installation steps. Bear in mind that in the future this repo might be transferred to the
+official [GitLab repo under Arch Linux](http://gitlab.archlinux.org/archlinux/) *(if GitLab becomes open to the general
+public)*.
-Therefore guidelines and style changes to the code might come into affect as well as guidelines surrounding bug reporting and discussions.
+Therefore guidelines and style changes to the code might come into affect as well as guidelines surrounding bug
+reporting and discussions.
## Branches
-`master` is currently the default branch, and that's where all future feature work is being done, this means that `master` is a living entity and will most likely never be in a fully stable state. For stable releases, please see the tagged commits.
+`master` is currently the default branch, and that's where all future feature work is being done, this means
+that `master` is a living entity and will most likely never be in a fully stable state. For stable releases, please see
+the tagged commits.
-Patch releases will be done against their own branches, branched from stable tagged releases and will be named according to the version it will become on release *(Patches to `v2.1.4` will be done on branch `v2.1.5` for instance)*.
+Patch releases will be done against their own branches, branched from stable tagged releases and will be named according
+to the version it will become on release *(Patches to `v2.1.4` will be done on branch `v2.1.5` for instance)*.
## Discussions
-Currently, questions, bugs and suggestions should be reported through [GitHub issue tracker](https://github.com/archlinux/archinstall/issues).<br>
+Currently, questions, bugs and suggestions should be reported
+through [GitHub issue tracker](https://github.com/archlinux/archinstall/issues).<br>
For less formal discussions there are also a [archinstall Discord server](https://discord.gg/cqXU88y).
## Coding convention
-Archinstall's goal is to follow [PEP8](https://www.python.org/dev/peps/pep-0008/) as best as it can with some minor exceptions.<br>
+Archinstall's goal is to follow [PEP8](https://www.python.org/dev/peps/pep-0008/) as best as it can with some minor
+exceptions.<br>
The exceptions to PEP8 are:
- * Archinstall uses [tabs instead of spaces](https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces) simply to make it easier for non-IDE developers to navigate the code *(Tab display-width should be equal to 4 spaces)*. Exception to the rule are comments that need fine-tuned indentation for documentation purposes.
- * [Line length](https://www.python.org/dev/peps/pep-0008/#maximum-line-length) should aim for no more than 100 characters, but not strictly enforced.
- * [Line breaks before/after binary operator](https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator) is not enforced, as long as the style of line breaks are consistent within the same code block.
- * Archinstall should always be saved with **Unix-formatted line endings** and no other platform-specific formats.
- * [Blank lines](https://www.python.org/dev/peps/pep-0008/#blank-lines) before/after imports and functions are not followed and discouraged. One space is commonly used in archinstall.
- * Multiple [Imports](https://www.python.org/dev/peps/pep-0008/#imports) on the same line is allowed, but more than five imports should be avoided on any given line. This simply saves up some space at the top of the file *(for non-IDE developers)* and will not be enforced.
- * [String quotes](https://www.python.org/dev/peps/pep-0008/#string-quotes) follow PEP8, the exception being when creating formatted strings, double-quoted strings are *preferred* but not required on the outer edges *(Example: `f"Welcome {name}"` rather than `f'Welcome {name}'`)*.
+* Archinstall uses [tabs instead of spaces](https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces) simply to make it
+ easier for non-IDE developers to navigate the code *(Tab display-width should be equal to 4 spaces)*. Exception to the
+ rule are comments that need fine-tuned indentation for documentation purposes.
+* [Line length](https://www.python.org/dev/peps/pep-0008/#maximum-line-length) should aim for no more than 100
+ characters, but not strictly enforced.
+* [Line breaks before/after binary operator](https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator)
+ is not enforced, as long as the style of line breaks are consistent within the same code block.
+* Archinstall should always be saved with **Unix-formatted line endings** and no other platform-specific formats.
+* [Blank lines](https://www.python.org/dev/peps/pep-0008/#blank-lines) before/after imports and functions are not
+ followed and discouraged. One space is commonly used in archinstall.
+* Multiple [Imports](https://www.python.org/dev/peps/pep-0008/#imports) on the same line is allowed, but more than five
+ imports should be avoided on any given line. This simply saves up some space at the top of the file *(for non-IDE
+ developers)* and will not be enforced.
+* [String quotes](https://www.python.org/dev/peps/pep-0008/#string-quotes) follow PEP8, the exception being when
+ creating formatted strings, double-quoted strings are *preferred* but not required on the outer edges *(
+ Example: `f"Welcome {name}"` rather than `f'Welcome {name}'`)*.
Most of these style guidelines have been put into place after the fact *(in an attempt to clean up the code)*.<br>
There might therefore be older code which does not follow the coding convention and the code is subject to change.
## Submitting Changes
-Archinstall uses Github's pull-request workflow and all contributions in terms of code should be done through pull requests.<br>
+Archinstall uses Github's pull-request workflow and all contributions in terms of code should be done through pull
+requests.<br>
-Anyone interested in archinstall may review your code. One of the core developers will merge your pull request when they think it is ready.
-For every pull request, we aim to promptly either merge it or say why it is not yet ready; if you go a few days without a reply, please feel free to ping the thread by adding a new comment.
+Anyone interested in archinstall may review your code. One of the core developers will merge your pull request when they
+think it is ready. For every pull request, we aim to promptly either merge it or say why it is not yet ready; if you go
+a few days without a reply, please feel free to ping the thread by adding a new comment.
-To get your pull request merged sooner, you should explain why you are making the change. For example, you can point to a code sample that is outdated in terms of Arch Linux command lines.
-It is also helpful to add links to online documentation or to the implementation of the code you are changing.
+To get your pull request merged sooner, you should explain why you are making the change. For example, you can point to
+a code sample that is outdated in terms of Arch Linux command lines. It is also helpful to add links to online
+documentation or to the implementation of the code you are changing.
-Also, do not squash your commits after you have submitted a pull request, as this erases context during review. We will squash commits when the pull request is merged.
+Also, do not squash your commits after you have submitted a pull request, as this erases context during review. We will
+squash commits when the pull request is merged.
At present the current contributors are (alphabetically):
- * Anton Hvornum ([@Torxed](https://github.com/Torxed))
- * Borislav Kosharov ([@nikibobi](https://github.com/nikibobi))
- * demostanis ([@demostanis](https://github.com/demostanis))
- * Giancarlo Razzolini (@[grazzolini](https://github.com/grazzolini))
- * j-james ([@j-james](https://github.com/j-james))
- * Jerker Bengtsson ([@jaybent](https://github.com/jaybent))
- * Ninchester ([@ninchester](https://github.com/ninchester))
- * Philipp Schaffrath ([@phisch](https://github.com/phisch))
- * Varun Madiath ([@vamega](https://github.com/vamega))
- * nullrequest ([@advaithm](https://github.com/advaithm))
+* Anton Hvornum ([@Torxed](https://github.com/Torxed))
+* Borislav Kosharov ([@nikibobi](https://github.com/nikibobi))
+* demostanis ([@demostanis](https://github.com/demostanis))
+* Giancarlo Razzolini (@[grazzolini](https://github.com/grazzolini))
+* j-james ([@j-james](https://github.com/j-james))
+* Jerker Bengtsson ([@jaybent](https://github.com/jaybent))
+* Ninchester ([@ninchester](https://github.com/ninchester))
+* Philipp Schaffrath ([@phisch](https://github.com/phisch))
+* Varun Madiath ([@vamega](https://github.com/vamega))
+* nullrequest ([@advaithm](https://github.com/advaithm))
diff --git a/archinstall/lib/mirrors.py b/archinstall/lib/mirrors.py
index dd8fadc4..e53b356a 100644
--- a/archinstall/lib/mirrors.py
+++ b/archinstall/lib/mirrors.py
@@ -60,7 +60,7 @@ def insert_mirrors(mirrors, *args, **kwargs):
return True
-def use_mirrors(regions :dict, destination='/etc/pacman.d/mirrorlist'):
+def use_mirrors(regions: dict, destination='/etc/pacman.d/mirrorlist'):
log(f'A new package mirror-list has been created: {destination}', level=logging.INFO)
for region, mirrors in regions.items():
with open(destination, 'w') as mirrorlist:
@@ -86,7 +86,6 @@ def list_mirrors():
log(f'Could not fetch an active mirror-list: {err}', level=logging.WARNING, fg="yellow")
return regions
-
region = 'Unknown region'
for line in response.readlines():
if len(line.strip()) == 0:
diff --git a/archinstall/lib/networking.py b/archinstall/lib/networking.py
index 768cc1cc..3e5ed4e7 100644
--- a/archinstall/lib/networking.py
+++ b/archinstall/lib/networking.py
@@ -1,8 +1,9 @@
-import os
import fcntl
+import os
import socket
import struct
from collections import OrderedDict
+
from .exceptions import *
from .general import sys_command
from .storage import storage
@@ -10,7 +11,7 @@ from .storage import storage
def get_hw_addr(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', bytes(ifname, 'utf-8')[:15]))
+ info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', bytes(ifname, 'utf-8')[:15]))
return ':'.join('%02x' % b for b in info[18:24])
@@ -25,7 +26,7 @@ def list_interfaces(skip_loopback=True):
return interfaces
-def enrich_iface_types(interfaces :dict):
+def enrich_iface_types(interfaces: dict):
result = {}
for iface in interfaces:
if os.path.isdir(f"/sys/class/net/{iface}/bridge/"):
diff --git a/archinstall/lib/output.py b/archinstall/lib/output.py
index 0818aed0..cce9e88c 100644
--- a/archinstall/lib/output.py
+++ b/archinstall/lib/output.py
@@ -1,8 +1,9 @@
import abc
+import logging
import os
import sys
-import logging
from pathlib import Path
+
from .storage import storage
@@ -21,7 +22,7 @@ class journald(dict):
@abc.abstractmethod
def log(message, level=logging.DEBUG):
try:
- import systemd.journal # type: ignore
+ import systemd.journal # type: ignore
except ModuleNotFoundError:
return False
@@ -77,8 +78,8 @@ def supports_color():
# Heavily influenced by: https://github.com/django/django/blob/ae8338daf34fd746771e0678081999b656177bae/django/utils/termcolors.py#L13
# Color options here: https://askubuntu.com/questions/528928/how-to-do-underline-bold-italic-strikethrough-color-background-and-size-i
-def stylize_output(text :str, *opts, **kwargs):
- opt_dict = {'bold': '1', 'italic' : '3', 'underscore': '4', 'blink': '5', 'reverse': '7', 'conceal': '8'}
+def stylize_output(text: str, *opts, **kwargs):
+ opt_dict = {'bold': '1', 'italic': '3', 'underscore': '4', 'blink': '5', 'reverse': '7', 'conceal': '8'}
color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
foreground = {color_names[x]: '3%s' % x for x in range(8)}
background = {color_names[x]: '4%s' % x for x in range(8)}
@@ -120,8 +121,8 @@ def log(*args, **kwargs):
log_file.write("")
except PermissionError:
# Fallback to creating the log file in the current folder
- err_string = f"Not enough permission to place log file at {absolute_logfile}, creating it in {Path('./').absolute()/filename} instead."
- absolute_logfile = Path('./').absolute()/filename
+ err_string = f"Not enough permission to place log file at {absolute_logfile}, creating it in {Path('./').absolute() / filename} instead."
+ absolute_logfile = Path('./').absolute() / filename
absolute_logfile.parents[0].mkdir(exist_ok=True)
absolute_logfile = str(absolute_logfile)
storage['LOG_PATH'] = './'
diff --git a/archinstall/lib/packages.py b/archinstall/lib/packages.py
index 87c60abb..e16ed99e 100644
--- a/archinstall/lib/packages.py
+++ b/archinstall/lib/packages.py
@@ -51,7 +51,7 @@ def find_packages(*names):
return result
-def validate_package_list(packages :list):
+def validate_package_list(packages: list):
"""
Validates a list of given packages.
Raises `RequirementError` if one or more packages are not found.
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py
index ebcd3aff..8b5525b4 100644
--- a/archinstall/lib/profiles.py
+++ b/archinstall/lib/profiles.py
@@ -7,6 +7,7 @@ import sys
import urllib.parse
import urllib.request
from typing import Optional
+
from .general import multisplit
from .networking import *
from .storage import storage
@@ -16,7 +17,7 @@ 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:], ('/', '?', '=', '&'))])
ssl_context = ssl.create_default_context()
ssl_context.check_hostname = False
- ssl_context.verify_mode=ssl.CERT_NONE
+ ssl_context.verify_mode = ssl.CERT_NONE
response = urllib.request.urlopen(safe_path, context=ssl_context)
return response.read()
@@ -29,7 +30,7 @@ def list_profiles(filter_irrelevant_macs=True, subpath='', filter_top_level_prof
cache = {}
# Grab all local profiles found in PROFILE_PATH
for PATH_ITEM in storage['PROFILE_PATH']:
- for root, folders, files in os.walk(os.path.abspath(os.path.expanduser(PATH_ITEM+subpath))):
+ for root, folders, files in os.walk(os.path.abspath(os.path.expanduser(PATH_ITEM + subpath))):
for file in files:
if file == '__init__.py':
continue
@@ -51,7 +52,7 @@ def list_profiles(filter_irrelevant_macs=True, subpath='', filter_top_level_prof
# Grab profiles from upstream URL
if storage['PROFILE_DB']:
- profiles_url = os.path.join(storage["UPSTREAM_URL"]+subpath, storage['PROFILE_DB'])
+ profiles_url = os.path.join(storage["UPSTREAM_URL"] + subpath, storage['PROFILE_DB'])
try:
profile_list = json.loads(grab_url_data(profiles_url))
except urllib.error.HTTPError as err:
@@ -74,7 +75,7 @@ def list_profiles(filter_irrelevant_macs=True, subpath='', filter_top_level_prof
if filter_top_level_profiles:
for profile in list(cache.keys()):
if Profile(None, profile).is_top_level_profile() is False:
- del(cache[profile])
+ del (cache[profile])
return cache
@@ -166,7 +167,7 @@ class Profile(Script):
super(Profile, self).__init__(path, installer)
def __dump__(self, *args, **kwargs):
- return {'path' : self.path}
+ return {'path': self.path}
def __repr__(self, *args, **kwargs):
return f'Profile({os.path.basename(self.profile)})'
diff --git a/archinstall/lib/storage.py b/archinstall/lib/storage.py
index d985ca17..53d5e938 100644
--- a/archinstall/lib/storage.py
+++ b/archinstall/lib/storage.py
@@ -8,15 +8,15 @@ import os
#
# And Keeping this in dict ensures that variables are shared across imports.
storage = {
- 'PROFILE_PATH' : [
+ 'PROFILE_PATH': [
'./profiles',
'~/.config/archinstall/profiles',
os.path.join(os.path.dirname(os.path.abspath(__file__)), 'profiles'),
# os.path.abspath(f'{os.path.dirname(__file__)}/../examples')
],
- 'UPSTREAM_URL' : 'https://raw.githubusercontent.com/archlinux/archinstall/master/profiles',
- 'PROFILE_DB' : None, # Used in cases when listing profiles is desired, not mandatory for direct profile grabing.
- 'LOG_PATH' : '/var/log/archinstall',
- 'LOG_FILE' : 'install.log',
- 'MOUNT_POINT' : '/mnt'
+ 'UPSTREAM_URL': 'https://raw.githubusercontent.com/archlinux/archinstall/master/profiles',
+ 'PROFILE_DB': None, # Used in cases when listing profiles is desired, not mandatory for direct profile grabing.
+ 'LOG_PATH': '/var/log/archinstall',
+ 'LOG_FILE': 'install.log',
+ 'MOUNT_POINT': '/mnt'
}
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index 0aeba3b9..4ca0fed8 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -48,6 +48,7 @@ def check_for_correct_username(username):
def do_countdown():
SIG_TRIGGER = False
+
def kill_handler(sig, frame):
print()
exit(0)
@@ -101,17 +102,17 @@ def print_large_list(options, padding=5, margin_bottom=0, separator=': '):
longest_line = highest_index_number_length + len(separator) + get_longest_option(options) + padding
spaces_without_option = longest_line - (len(separator) + highest_index_number_length)
max_num_of_columns = get_terminal_width() // longest_line
- max_options_in_cells = max_num_of_columns * (get_terminal_height()-margin_bottom)
+ max_options_in_cells = max_num_of_columns * (get_terminal_height() - margin_bottom)
if (len(options) > max_options_in_cells):
for index, option in enumerate(options):
print(f"{index}: {option}")
return 1, index
else:
- for row in range(0, (get_terminal_height()-margin_bottom)):
- for column in range(row, len(options), (get_terminal_height()-margin_bottom)):
- spaces = " "*(spaces_without_option - len(options[column]))
- print(f"{str(column): >{highest_index_number_length}}{separator}{options[column]}", end = spaces)
+ for row in range(0, (get_terminal_height() - margin_bottom)):
+ for column in range(row, len(options), (get_terminal_height() - margin_bottom)):
+ spaces = " " * (spaces_without_option - len(options[column]))
+ print(f"{str(column): >{highest_index_number_length}}{separator}{options[column]}", end=spaces)
print()
return column, row
@@ -148,7 +149,7 @@ def generic_multi_select(options, text="Select one or more of the options above
else:
printed_options.append(f'{option}')
- section.clear(0, get_terminal_height()-section._cursor_y-1)
+ section.clear(0, get_terminal_height() - section._cursor_y - 1)
print_large_list(printed_options, margin_bottom=2)
section._cursor_y = len(printed_options)
section._cursor_x = 0
@@ -204,7 +205,7 @@ class MiniCurses:
sys.stdout.flush()
sys.stdout.write("\033[%dG" % 0)
sys.stdout.flush()
- sys.stdout.write(" " * (get_terminal_width()-1))
+ sys.stdout.write(" " * (get_terminal_width() - 1))
sys.stdout.flush()
sys.stdout.write("\033[%dG" % 0)
sys.stdout.flush()
@@ -223,17 +224,17 @@ class MiniCurses:
sys.stdout.flush()
sys.stdout.write('\033[%d;%df' % (y, x))
- for line in range(get_terminal_height()-y-1, y):
- sys.stdout.write(" " * (get_terminal_width()-1))
+ for line in range(get_terminal_height() - y - 1, y):
+ sys.stdout.write(" " * (get_terminal_width() - 1))
sys.stdout.flush()
sys.stdout.write('\033[%d;%df' % (y, x))
sys.stdout.flush()
def deal_with_control_characters(self, char):
mapper = {
- '\x7f' : 'BACKSPACE',
- '\r' : 'CR',
- '\n' : 'NL'
+ '\x7f': 'BACKSPACE',
+ '\r': 'CR',
+ '\n': 'NL'
}
if (mapped_char := mapper.get(char, None)) == 'BACKSPACE':
@@ -319,7 +320,7 @@ def ask_for_superuser_account(prompt='Username for required superuser with sudo
continue
password = get_password(prompt=f'Password for user {new_user}: ')
- return {new_user: {"!password" : password}}
+ return {new_user: {"!password": password}}
def ask_for_additional_users(prompt='Any additional users to install (leave blank for no users): '):
@@ -335,9 +336,9 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan
password = get_password(prompt=f'Password for user {new_user}: ')
if input("Should this user be a superuser (sudoer) [y/N]: ").strip(' ').lower() in ('y', 'yes'):
- superusers[new_user] = {"!password" : password}
+ superusers[new_user] = {"!password": password}
else:
- users[new_user] = {"!password" : password}
+ users[new_user] = {"!password": password}
return users, superusers
@@ -347,7 +348,7 @@ def ask_for_a_timezone():
timezone = input('Enter a valid timezone (examples: Europe/Stockholm, US/Eastern) or press enter to use UTC: ').strip().strip('*.')
if timezone == '':
timezone = 'UTC'
- if (pathlib.Path("/usr")/"share"/"zoneinfo"/timezone).exists():
+ if (pathlib.Path("/usr") / "share" / "zoneinfo" / timezone).exists():
return timezone
else:
log(
@@ -359,17 +360,17 @@ def ask_for_a_timezone():
def ask_for_bootloader() -> str:
bootloader = "systemd-bootctl"
- if hasUEFI()==False:
- bootloader="grub-install"
+ if hasUEFI() == False:
+ bootloader = "grub-install"
else:
bootloader_choice = input("Would you like to use GRUB as a bootloader instead of systemd-boot? [y/N] ").lower()
if bootloader_choice == "y":
- bootloader="grub-install"
+ bootloader = "grub-install"
return bootloader
def ask_for_audio_selection():
- audio = "pulseaudio" # Default for most desktop environments
+ audio = "pulseaudio" # Default for most desktop environments
pipewire_choice = input("Would you like to install pipewire instead of pulseaudio as the default audio server? [Y/n] ").lower()
if pipewire_choice in ("y", ""):
audio = "pipewire"
@@ -379,18 +380,18 @@ def ask_for_audio_selection():
def ask_to_configure_network():
# Optionally configure one network interface.
- #while 1:
+ # while 1:
# {MAC: Ifname}
interfaces = {
- 'ISO-CONFIG' : 'Copy ISO network configuration to installation',
- 'NetworkManager':'Use NetworkManager to control and manage your internet connection',
+ 'ISO-CONFIG': 'Copy ISO network configuration to installation',
+ 'NetworkManager': 'Use NetworkManager to control and manage your internet connection',
**list_interfaces()
}
nic = generic_select(interfaces, "Select one network interface to configure (leave blank to skip): ")
if nic and nic != 'Copy ISO network configuration to installation':
if nic == 'Use NetworkManager to control and manage your internet connection':
- return {'nic': nic,'NetworkManager':True}
+ return {'nic': nic, 'NetworkManager': True}
# Current workaround:
# For selecting modes without entering text within brackets,
@@ -401,7 +402,7 @@ def ask_to_configure_network():
print(f"{index}: {mode}")
mode = generic_select(['DHCP', 'IP'], f"Select which mode to configure for {nic} or leave blank for DHCP: ",
- options_output=False)
+ options_output=False)
if mode == 'IP':
while 1:
ip = input(f"Enter the IP and subnet for {nic} (example: 192.168.0.5/24): ").strip()
@@ -436,7 +437,7 @@ def ask_to_configure_network():
if len(dns_input := input('Enter your DNS servers (space separated, blank for none): ').strip()):
dns = dns_input.split(' ')
- return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns}
+ return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway': gateway, 'dns': dns}
else:
return {'nic': nic}
elif nic:
@@ -447,26 +448,26 @@ def ask_to_configure_network():
def ask_for_disk_layout():
options = {
- 'keep-existing' : 'Keep existing partition layout and select which ones to use where',
- 'format-all' : 'Format entire drive and setup a basic partition scheme',
- 'abort' : 'Abort the installation'
+ 'keep-existing': 'Keep existing partition layout and select which ones to use where',
+ 'format-all': 'Format entire drive and setup a basic partition scheme',
+ 'abort': 'Abort the installation'
}
value = generic_select(options, "Found partitions on the selected drive, (select by number) what you want to do: ",
- allow_empty_input=False, sort=True)
+ allow_empty_input=False, sort=True)
return next((key for key, val in options.items() if val == value), None)
def ask_for_main_filesystem_format():
options = {
- 'btrfs' : 'btrfs',
- 'ext4' : 'ext4',
- 'xfs' : 'xfs',
- 'f2fs' : 'f2fs'
+ 'btrfs': 'btrfs',
+ 'ext4': 'ext4',
+ 'xfs': 'xfs',
+ 'f2fs': 'f2fs'
}
value = generic_select(options, "Select which filesystem your main partition should use (by number or name): ",
- allow_empty_input=False)
+ allow_empty_input=False)
return next((key for key, val in options.items() if val == value), None)
@@ -526,7 +527,7 @@ def generic_select(options, input_text="Select one of the above by index or abso
selected_option = options[selected_option]
break
elif selected_option in options:
- break # We gave a correct absolute value
+ break # We gave a correct absolute value
else:
raise RequirementError(f'Selected option "{selected_option}" does not exist in available options')
except RequirementError as err:
@@ -584,7 +585,7 @@ def select_profile(options):
print(' -- (Leave blank and hit enter to skip this step and continue) --')
selected_profile = generic_select(profiles, 'Enter a pre-programmed profile name if you want to install one: ',
- options_output=False)
+ options_output=False)
if selected_profile:
return Profile(None, selected_profile)
else:
@@ -674,8 +675,9 @@ def select_mirror_regions(mirrors, show_top_mirrors=True):
print_large_list(regions, margin_bottom=4)
print(' -- You can skip this step by leaving the option blank --')
- selected_mirror = generic_select(regions, 'Select one of the above regions to download packages from (by number or full name): ',
- options_output=False)
+ selected_mirror = generic_select(regions,
+ 'Select one of the above regions to download packages from (by number or full name): ',
+ options_output=False)
if not selected_mirror:
# Returning back empty options which can be both used to
# do "if x:" logic as well as do `x.get('mirror', {}).get('sub', None)` chaining
diff --git a/docs/conf.py b/docs/conf.py
index 2c699184..9d23f979 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -43,7 +43,6 @@ author = 'Anton Hvornum'
# The full version, including alpha/beta/rc tags
release = 'v2.1.0'
-
# -- General configuration ---------------------------------------------------
master_doc = 'index'
@@ -64,7 +63,6 @@ templates_path = ['_templates']
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
-
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
diff --git a/docs/pull_request_template.md b/docs/pull_request_template.md
index 729c1aae..18d01ab2 100644
--- a/docs/pull_request_template.md
+++ b/docs/pull_request_template.md
@@ -12,5 +12,5 @@ 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. \ No newline at end of file
+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 a4fb5e3b..76741708 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -1,9 +1,9 @@
-import time
import json
import logging
+import time
+
import archinstall
from archinstall.lib.hardware import hasUEFI
-from archinstall.lib.profiles import Profile
if archinstall.arguments.get('help'):
print("See `man archinstall` for help.")