From 1d54a625f489d3f6f25e84df8e68e6f66a64a857 Mon Sep 17 00:00:00 2001 From: Richard Neumann Date: Thu, 1 Apr 2021 20:31:29 +0200 Subject: Simplify boolean checks --- archinstall/lib/hardware.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index 93eb560f..5828fd09 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -3,9 +3,7 @@ from .general import sys_command from .networking import list_interfaces, enrichIfaceTypes def hasWifi(): - if 'WIRELESS' in enrichIfaceTypes(list_interfaces().values()).values(): - return True - return False + return 'WIRELESS' in enrichIfaceTypes(list_interfaces().values()).values() def hasUEFI(): return os.path.isdir('/sys/firmware/efi') @@ -19,18 +17,12 @@ def graphicsDevices(): return cards def hasNvidiaGraphics(): - if [x for x in graphicsDevices() if 'nvidia' in x]: - return True - return False + return any('nvidia' in x for x in graphicsDevices()) def hasAmdGraphics(): - if [x for x in graphicsDevices() if 'amd' in x]: - return True - return False + return any('amd' in x for x in graphicsDevices()) def hasIntelGraphics(): - if [x for x in graphicsDevices() if 'intel' in x]: - return True - return False + return any('intel' in x for x in graphicsDevices()) -# TODO: Add more identifiers \ No newline at end of file +# TODO: Add more identifiers -- cgit v1.2.3-70-g09d2 From cab8c7d43a9ada09269c3baae73cc724e4372538 Mon Sep 17 00:00:00 2001 From: Richard Neumann Date: Thu, 1 Apr 2021 20:45:45 +0200 Subject: Move class-related docstring to class definition --- archinstall/lib/systemd.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/archinstall/lib/systemd.py b/archinstall/lib/systemd.py index edd75098..b644bc21 100644 --- a/archinstall/lib/systemd.py +++ b/archinstall/lib/systemd.py @@ -26,15 +26,15 @@ class Ini(): return result class Systemd(Ini): + """ + Placeholder class to do systemd specific setups. + """ def __init__(self, *args, **kwargs): - """ - Placeholder class to do systemd specific setups. - """ super(Systemd, self).__init__(*args, **kwargs) class Networkd(Systemd): + """ + Placeholder class to do systemd-network specific setups. + """ def __init__(self, *args, **kwargs): - """ - Placeholder class to do systemd-network specific setups. - """ - super(Networkd, self).__init__(*args, **kwargs) \ No newline at end of file + super(Networkd, self).__init__(*args, **kwargs) -- cgit v1.2.3-70-g09d2 From c0cfa7ae929a55cf2ea4458f758e9196242a3cc9 Mon Sep 17 00:00:00 2001 From: Richard Neumann Date: Thu, 1 Apr 2021 20:46:28 +0200 Subject: Remove useless __init__ methods --- archinstall/lib/systemd.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/archinstall/lib/systemd.py b/archinstall/lib/systemd.py index b644bc21..f2b7c9b3 100644 --- a/archinstall/lib/systemd.py +++ b/archinstall/lib/systemd.py @@ -29,12 +29,8 @@ class Systemd(Ini): """ Placeholder class to do systemd specific setups. """ - def __init__(self, *args, **kwargs): - super(Systemd, self).__init__(*args, **kwargs) class Networkd(Systemd): """ Placeholder class to do systemd-network specific setups. """ - def __init__(self, *args, **kwargs): - super(Networkd, self).__init__(*args, **kwargs) -- cgit v1.2.3-70-g09d2 From ef7f2f53b1838a479837af52cb24bd5552792b75 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 1 Apr 2021 22:12:52 +0200 Subject: Missing variable This should fix #135 --- archinstall/lib/luks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py index 19c21795..57163e35 100644 --- a/archinstall/lib/luks.py +++ b/archinstall/lib/luks.py @@ -94,8 +94,8 @@ class luks2(): else: raise err - if b'Command successful.' not in b''.join(cmd_handle): - raise DiskError(f'Could not encrypt volume "{partition.path}": {o}') + if b'Command successful.' not in (cmd_output := b''.join(cmd_handle)): + raise DiskError(f'Could not encrypt volume "{partition.path}": {cmd_output}') return key_file @@ -126,4 +126,4 @@ class luks2(): def format(self, path): if (handle := sys_command(f"/usr/bin/cryptsetup -q -v luksErase {path}")).exit_code != 0: - raise DiskError(f'Could not format {path} with {self.filesystem} because: {b"".join(handle)}') \ No newline at end of file + raise DiskError(f'Could not format {path} with {self.filesystem} because: {b"".join(handle)}') -- cgit v1.2.3-70-g09d2 From 94042517a434964741e95736a361e94ff70359ee Mon Sep 17 00:00:00 2001 From: Shohei Kusakata Date: Fri, 2 Apr 2021 10:47:21 +0900 Subject: Fixing document interlink error --- docs/index.rst | 2 +- docs/installing/guided.rst | 4 +++- docs/installing/python.rst | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index c03cc451..eef368c5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -2,7 +2,7 @@ python-archinstall Documentation ================================ | **python-archinstall** *(or, archinstall for short)* is a helper library to install Arch Linux and manage services, packages and other things. -| It comes packaged with different pre-configured installers, such as the `installing.guided`_ installer. +| It comes packaged with different pre-configured installers, such as the :ref:`guided ` installer. | | A demo can be viewed here: `https://www.youtube.com/watch?v=9Xt7X_Iqg6E `_ which uses the default guided installer. diff --git a/docs/installing/guided.rst b/docs/installing/guided.rst index 92324589..7ce081ca 100644 --- a/docs/installing/guided.rst +++ b/docs/installing/guided.rst @@ -100,6 +100,8 @@ Default is :code:`Archinstall` The hostname in which the machine will identify itself on the local network. This step is optional, but a default hostname of `Archinstall` will be set if none is selected. +.. _root_password: + Root password ------------- @@ -115,7 +117,7 @@ Super User (sudo) ----------------- .. warning:: - This step only applies if you correctly skipped the previous step :ref:`root_password`_ which also makes this step mandatory. + This step only applies if you correctly skipped :ref:`the previous step ` which also makes this step mandatory. If the previous step was skipped, and only if it is skipped. This step enables you to create a :code:`sudo` enabled user with a password. diff --git a/docs/installing/python.rst b/docs/installing/python.rst index 44606166..b5cf4776 100644 --- a/docs/installing/python.rst +++ b/docs/installing/python.rst @@ -44,7 +44,7 @@ Or as a user module: Which will allow you to start using the library. -.. _installing.python.manual +.. _installing.python.manual: Manual installation ------------------- -- cgit v1.2.3-70-g09d2 From cd3553ad89b5dfedd49f985fc5aa397fcd96c81d Mon Sep 17 00:00:00 2001 From: Shohei Kusakata Date: Fri, 2 Apr 2021 10:50:07 +0900 Subject: Fixing short title underline warning --- docs/examples/python.rst | 4 ++-- docs/installing/python.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/examples/python.rst b/docs/examples/python.rst index 04f2f43a..f6388738 100644 --- a/docs/examples/python.rst +++ b/docs/examples/python.rst @@ -9,9 +9,9 @@ The way the library is invoked in module mode is limited to executing scripts un It's there for important to place any script or profile you wish to invoke in the examples folder prior to building and installing. Pre-requisites -------------- +-------------- -We'll assume you've followed the `installing.python.manual`_ method. +We'll assume you've followed the :ref:`installing.python.manual` method. Before actually installing the library, you will need to place your custom installer-scripts under `./archinstall/examples/` as a python file. More on how you create these in the next section. diff --git a/docs/installing/python.rst b/docs/installing/python.rst index b5cf4776..94cfb243 100644 --- a/docs/installing/python.rst +++ b/docs/installing/python.rst @@ -10,7 +10,7 @@ But the library can be installed manually as well. This is not required if you're running archinstall on a pre-built ISO. The installation is only required if you're creating your own scripted installations. Using pacman ----------- +------------ Archinstall is on the `official repositories `_. -- cgit v1.2.3-70-g09d2