From ffd5b5f80453a609b76e050d6d4e8309c540c28e Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 15 May 2021 11:35:18 -0400 Subject: Very selectively fix some PEP 8 issues with profiles --- profiles/52-54-00-12-34-56.py | 4 ++-- profiles/applications/postgresql.py | 2 +- profiles/awesome.py | 3 ++- profiles/budgie.py | 6 ++++-- profiles/cinnamon.py | 15 +++++++++++-- profiles/deepin.py | 1 + profiles/desktop.py | 42 ++++++++++++++++++++++++++++++------- profiles/enlightenment.py | 1 + profiles/gnome.py | 4 +++- profiles/i3.py | 9 +++++--- profiles/kde.py | 2 ++ profiles/lxqt.py | 5 +++-- profiles/mate.py | 4 +++- profiles/minimal.py | 4 +++- profiles/server.py | 4 +++- profiles/sway.py | 4 +--- profiles/xfce4.py | 5 +++-- profiles/xorg.py | 1 + 18 files changed, 86 insertions(+), 30 deletions(-) (limited to 'profiles') diff --git a/profiles/52-54-00-12-34-56.py b/profiles/52-54-00-12-34-56.py index 28cd14f6..d4fc3d07 100644 --- a/profiles/52-54-00-12-34-56.py +++ b/profiles/52-54-00-12-34-56.py @@ -7,7 +7,7 @@ __packages__ = ['nano', 'wget', 'git'] if __name__ == '52-54-00-12-34-56': awesome = archinstall.Application(archinstall.storage['installation_session'], 'postgresql') awesome.install() - + """ # Unmount and close previous runs (Mainly only used for re-runs, but won't hurt.) archinstall.sys_command(f'umount -R /mnt', suppress_errors=True) @@ -57,4 +57,4 @@ with archinstall.Filesystem(harddrive) as fs: urllib.request.urlopen(req, timeout=5) except: pass -""" \ No newline at end of file +""" diff --git a/profiles/applications/postgresql.py b/profiles/applications/postgresql.py index 3f8c6950..29546d78 100644 --- a/profiles/applications/postgresql.py +++ b/profiles/applications/postgresql.py @@ -8,4 +8,4 @@ archinstall.storage['installation_session'].add_additional_packages(__packages__ archinstall.storage['installation_session'].arch_chroot("initdb -D /var/lib/postgres/data", runas='postgres') -archinstall.storage['installation_session'].enable_service('postgresql') \ No newline at end of file +archinstall.storage['installation_session'].enable_service('postgresql') diff --git a/profiles/awesome.py b/profiles/awesome.py index ee812eb3..62cb9e00 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -8,6 +8,7 @@ is_top_level_profile = False # of the profile to get a list of "what packages will be installed". __packages__ = ['nemo', 'gpicview', 'main', 'alacritty'] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -46,7 +47,7 @@ if __name__ == 'awesome': fh.write(awesome_lua) ## TODO: Configure the right-click-menu to contain the above packages that were installed. (as a user config) - + ## Remove some interfering nemo settings archinstall.storage['installation_session'].arch_chroot("gsettings set org.nemo.desktop show-desktop-icons false") archinstall.storage['installation_session'].arch_chroot("xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search") diff --git a/profiles/budgie.py b/profiles/budgie.py index dbbd3a9d..abaf87b0 100644 --- a/profiles/budgie.py +++ b/profiles/budgie.py @@ -4,9 +4,10 @@ import archinstall is_top_level_profile = False -# "It is recommended also to install the gnome group, which contains applications required for the standard GNOME experience." - Arch Wiki +# "It is recommended also to install the gnome group, which contains applications required for the standard GNOME experience." - Arch Wiki __packages__ = ["budgie-desktop", "lightdm", "lightdm-gtk-greeter", "gnome"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -23,6 +24,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("budgie", "/somewhere/budgie.py") # or through conventional import budgie @@ -33,4 +35,4 @@ if __name__ == 'budgie': # Install the Budgie packages archinstall.storage['installation_session'].add_additional_packages(__packages__) - archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager + archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py index 89798671..0122677a 100644 --- a/profiles/cinnamon.py +++ b/profiles/cinnamon.py @@ -4,7 +4,17 @@ import archinstall is_top_level_profile = False -__packages__ = ["cinnamon", "system-config-printer", "gnome-keyring", "gnome-terminal", "blueberry", "metacity", "lightdm", "lightdm-gtk-greeter"] +__packages__ = [ + "cinnamon", + "system-config-printer", + "gnome-keyring", + "gnome-terminal", + "blueberry", + "metacity", + "lightdm", + "lightdm-gtk-greeter", +] + def _prep_function(*args, **kwargs): """ @@ -22,6 +32,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("cinnamon", "/somewhere/cinnamon.py") # or through conventional import cinnamon @@ -32,4 +43,4 @@ if __name__ == 'cinnamon': # Install the Cinnamon packages archinstall.storage['installation_session'].add_additional_packages(__packages__) - archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager + archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager diff --git a/profiles/deepin.py b/profiles/deepin.py index 757597f3..a4778b0d 100644 --- a/profiles/deepin.py +++ b/profiles/deepin.py @@ -6,6 +6,7 @@ is_top_level_profile = False __packages__ = ["deepin", "deepin-terminal", "deepin-editor", "lightdm", "lightdm-gtk-greeter"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/desktop.py b/profiles/desktop.py index 9e1d8b4c..84c1ac06 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -6,7 +6,19 @@ is_top_level_profile = True # New way of defining packages for a profile, which is iterable and can be used out side # of the profile to get a list of "what packages will be installed". -__packages__ = ['nano', 'vim', 'openssh', 'htop', 'wget', 'iwd', 'wireless_tools', 'wpa_supplicant', 'smartmontools', 'xdg-utils'] +__packages__ = [ + 'nano', + 'vim', + 'openssh', + 'htop', + 'wget', + 'iwd', + 'wireless_tools', + 'wpa_supplicant', + 'smartmontools', + 'xdg-utils', +] + def _prep_function(*args, **kwargs): """ @@ -16,11 +28,25 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie', 'mate', 'deepin', 'enlightenment'] + supported_desktops = [ + 'gnome', + 'kde', + 'awesome', + 'sway', + 'cinnamon', + 'xfce4', + 'lxqt', + 'i3', + 'budgie', + 'mate', + 'deepin', + 'enlightenment', + ] + + desktop = archinstall.generic_select( + supported_desktops, 'Select your desired desktop environment: ', allow_empty_input=False, sort=True + ) - desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ', - allow_empty_input=False, sort=True) - # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded # the next time it gets executed. @@ -34,6 +60,7 @@ def _prep_function(*args, **kwargs): else: print(f"Deprecated (??): {desktop} profile has no _prep_function() anymore") + if __name__ == 'desktop': """ This "profile" is a meta-profile. @@ -47,9 +74,8 @@ if __name__ == 'desktop': There are plenty of desktop-turn-key-solutions based on Arch Linux, this is therefore just a helper to get started """ - + # Install common packages for all desktop environments archinstall.storage['installation_session'].add_additional_packages(__packages__) - - archinstall.storage['installation_session'].install_profile(archinstall.storage['_desktop_profile']) + archinstall.storage['installation_session'].install_profile(archinstall.storage['_desktop_profile']) diff --git a/profiles/enlightenment.py b/profiles/enlightenment.py index 6ff334de..4c5a7999 100644 --- a/profiles/enlightenment.py +++ b/profiles/enlightenment.py @@ -6,6 +6,7 @@ is_top_level_profile = False __packages__ = ["enlightenment", "terminology", "lightdm", "lightdm-gtk-greeter"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/gnome.py b/profiles/gnome.py index e6cc75c0..09fac1bb 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -7,6 +7,7 @@ is_top_level_profile = False # Note: GDM should be part of the gnome group, but adding it here for clarity __packages__ = ["gnome", "gnome-tweaks", "gdm"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -24,6 +25,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("gnome", "/somewhere/gnome.py") # or through conventional import gnome @@ -34,6 +36,6 @@ if __name__ == 'gnome': # Install the GNOME packages archinstall.storage['installation_session'].add_additional_packages(__packages__) - archinstall.storage['installation_session'].enable_service('gdm') # Gnome Display Manager + 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. diff --git a/profiles/i3.py b/profiles/i3.py index e99bc549..1972ba59 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -8,6 +8,7 @@ is_top_level_profile = False # of the profile to get a list of "what packages will be installed". __packages__ = ['i3lock', 'i3status', 'i3blocks', 'xterm', 'lightdm-gtk-greeter', 'lightdm', 'dmenu'] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -17,8 +18,9 @@ def _prep_function(*args, **kwargs): """ supported_configurations = ['i3-wm', 'i3-gaps'] - desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ', - allow_empty_input=False, sort=True) + desktop = archinstall.generic_select( + supported_configurations, 'Select your desired configuration: ', allow_empty_input=False, sort=True + ) # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded @@ -33,6 +35,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + if __name__ == 'i3': """ This "profile" is a meta-profile. @@ -46,7 +49,7 @@ if __name__ == 'i3': There are plenty of desktop-turn-key-solutions based on Arch Linux, this is therefore just a helper to get started """ - + # Install common packages for all i3 configurations archinstall.storage['installation_session'].add_additional_packages(__packages__[:4]) diff --git a/profiles/kde.py b/profiles/kde.py index aac5ade4..66625074 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -8,6 +8,7 @@ __packages__ = ["plasma-meta", "konsole", "kate", "dolphin", "sddm", "plasma-way # TODO: Remove hard dependency of bash (due to .bash_profile) + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -24,6 +25,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + """ def _post_install(*args, **kwargs): if "nvidia" in _gfx_driver_packages: diff --git a/profiles/lxqt.py b/profiles/lxqt.py index 025d033d..af6337e6 100644 --- a/profiles/lxqt.py +++ b/profiles/lxqt.py @@ -1,4 +1,3 @@ - # A desktop environment using "LXQt" import archinstall @@ -7,6 +6,7 @@ is_top_level_profile = False __packages__ = ["lxqt", "breeze-icons", "oxygen-icons", "xdg-utils", "ttf-freefont", "leafpad", "slock", "sddm"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -23,6 +23,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("lxqt", "/somewhere/lxqt.py") # or through conventional import lxqt @@ -33,4 +34,4 @@ if __name__ == 'lxqt': # Install the LXQt packages archinstall.storage['installation_session'].add_additional_packages(__packages__) - archinstall.storage['installation_session'].enable_service('sddm') # SDDM Display Manager + archinstall.storage['installation_session'].enable_service('sddm') # SDDM Display Manager diff --git a/profiles/mate.py b/profiles/mate.py index e2421ed8..351f2250 100644 --- a/profiles/mate.py +++ b/profiles/mate.py @@ -6,6 +6,7 @@ is_top_level_profile = False __packages__ = ["mate", "mate-extra", "lightdm", "lightdm-gtk-greeter"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -22,6 +23,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("mate", "/somewhere/mate.py") # or through conventional import mate @@ -32,4 +34,4 @@ if __name__ == 'mate': # Install the MATE packages archinstall.storage['installation_session'].add_additional_packages(__packages__) - archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager + archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager diff --git a/profiles/minimal.py b/profiles/minimal.py index 79821a89..8af06a3a 100644 --- a/profiles/minimal.py +++ b/profiles/minimal.py @@ -4,6 +4,7 @@ import archinstall, os is_top_level_profile = True + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -11,7 +12,8 @@ def _prep_function(*args, **kwargs): we don't need to do anything special here, but it needs to exist and return True. """ - return True # Do nothing and just return True + return True # Do nothing and just return True + if __name__ == 'minimal': """ diff --git a/profiles/server.py b/profiles/server.py index d0346ace..36bfd3ab 100644 --- a/profiles/server.py +++ b/profiles/server.py @@ -6,6 +6,7 @@ is_top_level_profile = True available_servers = ["cockpit", "docker", "httpd", "lighttpd", "mariadb", "nginx", "postgresql", "sshd", "tomcat"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -13,9 +14,10 @@ def _prep_function(*args, **kwargs): """ selected_servers = archinstall.generic_multi_select(available_servers, f"Choose which servers to install and enable (leave blank for a minimal installation): ") archinstall.storage['_selected_servers'] = selected_servers - + return True + if __name__ == 'server': """ This "profile" is a meta-profile. diff --git a/profiles/sway.py b/profiles/sway.py index e90e5e8d..686fe868 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -39,9 +39,7 @@ if __name__ == "sway": "The proprietary Nvidia driver is not supported by Sway. It is likely that you will run into issues. Continue anyways? [y/N] " ) if choice.lower() in ("n", ""): - raise archinstall.lib.exceptions.HardwareIncompatibilityError( - "Sway does not support the proprietary nvidia drivers." - ) + raise archinstall.lib.exceptions.HardwareIncompatibilityError("Sway does not support the proprietary nvidia drivers.") # Install the Sway packages archinstall.storage['installation_session'].add_additional_packages(__packages__) diff --git a/profiles/xfce4.py b/profiles/xfce4.py index 43da23ac..ad00c461 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -1,4 +1,3 @@ - # A desktop environment using "Xfce4" import archinstall @@ -7,6 +6,7 @@ is_top_level_profile = False __packages__ = ["xfce4", "xfce4-goodies", "lightdm", "lightdm-gtk-greeter"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -23,6 +23,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("xfce4", "/somewhere/xfce4.py") # or through conventional import xfce4 @@ -33,4 +34,4 @@ if __name__ == 'xfce4': # Install the XFCE4 packages archinstall.storage['installation_session'].add_additional_packages(__packages__) - archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager + archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager diff --git a/profiles/xorg.py b/profiles/xorg.py index 19ca92d7..e7cf00d0 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -7,6 +7,7 @@ is_top_level_profile = True __packages__ = ['dkms', 'xorg-server', 'xorg-xinit', 'nvidia-dkms', 'xorg-server', *archinstall.lib.hardware.__packages__] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer -- cgit v1.2.3-54-g00ecf From acb754ff2edee96d3dc0c6ca29abd0c60a1a5ace Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 15 May 2021 11:42:32 -0400 Subject: Try to remove some unused imports --- profiles/deepin.py | 2 +- profiles/desktop.py | 2 +- profiles/i3.py | 2 +- profiles/kde.py | 2 +- profiles/minimal.py | 2 -- profiles/server.py | 2 +- profiles/xorg.py | 1 - 7 files changed, 5 insertions(+), 8 deletions(-) (limited to 'profiles') diff --git a/profiles/deepin.py b/profiles/deepin.py index a4778b0d..ebe730e2 100644 --- a/profiles/deepin.py +++ b/profiles/deepin.py @@ -1,6 +1,6 @@ # A desktop environment using "Deepin". -import archinstall, os +import archinstall is_top_level_profile = False diff --git a/profiles/desktop.py b/profiles/desktop.py index 84c1ac06..67514a97 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -1,6 +1,6 @@ # A desktop environment selector. -import archinstall, os +import archinstall is_top_level_profile = True diff --git a/profiles/i3.py b/profiles/i3.py index 1972ba59..418749c0 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -1,6 +1,6 @@ # Common package for i3, lets user select which i3 configuration they want. -import archinstall, os +import archinstall is_top_level_profile = False diff --git a/profiles/kde.py b/profiles/kde.py index 66625074..cdb6a41a 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -1,6 +1,6 @@ # A desktop environment using "KDE". -import archinstall, os +import archinstall is_top_level_profile = False diff --git a/profiles/minimal.py b/profiles/minimal.py index 8af06a3a..13cfd05a 100644 --- a/profiles/minimal.py +++ b/profiles/minimal.py @@ -1,7 +1,5 @@ # Used to do a minimal install -import archinstall, os - is_top_level_profile = True diff --git a/profiles/server.py b/profiles/server.py index 36bfd3ab..ff7b2179 100644 --- a/profiles/server.py +++ b/profiles/server.py @@ -1,6 +1,6 @@ # Used to select various server application profiles on top of a minimal installation. -import archinstall, os, logging +import archinstall, logging is_top_level_profile = True diff --git a/profiles/xorg.py b/profiles/xorg.py index e7cf00d0..34599468 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -1,6 +1,5 @@ # A system with "xorg" installed -import os import archinstall is_top_level_profile = True -- cgit v1.2.3-54-g00ecf From d93ef24e8e080ab4c71366bfba0340d16f17524b Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 15 May 2021 11:51:06 -0400 Subject: A couple more small fixes --- profiles/enlightenment.py | 2 +- profiles/server.py | 3 ++- profiles/xorg.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'profiles') diff --git a/profiles/enlightenment.py b/profiles/enlightenment.py index 4c5a7999..cfb97836 100644 --- a/profiles/enlightenment.py +++ b/profiles/enlightenment.py @@ -1,6 +1,6 @@ # A desktop environment using "Enlightenment". -import archinstall, os +import archinstall is_top_level_profile = False diff --git a/profiles/server.py b/profiles/server.py index ff7b2179..3ccc9715 100644 --- a/profiles/server.py +++ b/profiles/server.py @@ -1,6 +1,7 @@ # Used to select various server application profiles on top of a minimal installation. -import archinstall, logging +import archinstall +import logging is_top_level_profile = True diff --git a/profiles/xorg.py b/profiles/xorg.py index 34599468..a5a50697 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -36,4 +36,4 @@ if __name__ == 'xorg': 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(f"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 \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 37e818b3d1a7b76d1bdc511876a2a30d7a7a32d1 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 15 May 2021 12:07:46 -0400 Subject: More manual fixes --- examples/guided.py | 36 +++++++++++++++++------------------- examples/minimal.py | 8 +++++--- examples/unattended.py | 2 +- profiles/52-54-00-12-34-56.py | 6 +++--- profiles/awesome.py | 6 +++--- 5 files changed, 29 insertions(+), 29 deletions(-) (limited to 'profiles') diff --git a/examples/guided.py b/examples/guided.py index 0ae253a0..b96c5793 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -10,11 +10,12 @@ if archinstall.arguments.get('help'): # For support reasons, we'll log the disk layout pre installation to match against post-installation layout archinstall.log(f"Disk states before installing: {archinstall.disk_layouts()}", level=archinstall.LOG_LEVELS.Debug) + def ask_user_questions(): """ - First, we'll ask the user for a bunch of user input. - Not until we're satisfied with what we want to install - will we continue with the actual installation steps. + First, we'll ask the user for a bunch of user input. + Not until we're satisfied with what we want to install + will we continue with the actual installation steps. """ if not archinstall.arguments.get('keyboard-language', None): while True: @@ -41,7 +42,6 @@ def ask_user_questions(): selected_region = archinstall.arguments['mirror-region'] archinstall.arguments['mirror-region'] = {selected_region : archinstall.list_mirrors()[selected_region]} - # Ask which harddrive/block-device we will install to if archinstall.arguments.get('harddrive', None): archinstall.arguments['harddrive'] = archinstall.BlockDevice(archinstall.arguments['harddrive']) @@ -67,7 +67,6 @@ def ask_user_questions(): partition_mountpoints[partition] = None except archinstall.UnknownFilesystemFormat as err: archinstall.log(f" {partition} (Filesystem not supported)", fg='red') - # We then ask what to do with the partitions. if (option := archinstall.ask_for_disk_layout()) == 'abort': @@ -122,8 +121,7 @@ def ask_user_questions(): archinstall.log(f"Until then, please enter another supported filesystem.") continue except archinstall.SysCallError: - pass # Expected exception since mkfs. can not format /dev/null. - # But that means our .format() function supported it. + pass # Expected exception since mkfs. can not format /dev/null. But that means our .format() function supported it. break # When we've selected all three criteria, @@ -151,7 +149,7 @@ def ask_user_questions(): # Get disk encryption password (or skip if blank) if archinstall.arguments['harddrive'] and archinstall.arguments.get('!encryption-password', None) is None: - if (passwd := archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): ')): + if passwd := archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): '): archinstall.arguments['!encryption-password'] = passwd archinstall.arguments['harddrive'].encryption_password = archinstall.arguments['!encryption-password'] archinstall.arguments["bootloader"] = archinstall.ask_for_bootloader() @@ -191,7 +189,7 @@ def ask_user_questions(): # Ask about audio server selection if one is not already set if not archinstall.arguments.get('audio', None): - # only ask for audio server selection on a desktop profile + # only ask for audio server selection on a desktop profile if str(archinstall.arguments['profile']) == 'Profile(desktop)': archinstall.arguments['audio'] = archinstall.ask_for_audio_selection() else: @@ -264,12 +262,12 @@ def perform_installation_steps(): # Wipe the entire drive if the disk flag `keep_partitions`is False. if archinstall.arguments['harddrive'].keep_partitions is False: fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs')) - + # Check if encryption is desired and mark the root partition as encrypted. if archinstall.arguments.get('!encryption-password', None): root_partition = fs.find_partition('/') root_partition.encrypted = True - + # After the disk is ready, iterate the partitions and check # which ones are safe to format, and format those. for partition in archinstall.arguments['harddrive']: @@ -293,10 +291,10 @@ def perform_installation_steps(): unlocked_device.mount('/mnt') else: fs.find_partition('/').mount('/mnt') - + if hasUEFI(): fs.find_partition('/boot').mount('/mnt/boot') - + perform_installation('/mnt') @@ -307,7 +305,7 @@ def perform_installation(mountpoint): formatted and setup prior to entering this function. """ with archinstall.Installer(mountpoint, kernels=archinstall.arguments.get('kernels', 'linux')) as installation: - ## if len(mirrors): + # if len(mirrors): # Certain services might be running that affects the system during installation. # Currently, only one such service is "reflector.service" which updates /etc/pacman.d/mirrorlist # We need to wait for it before we continue since we opted in to use a custom mirror/region. @@ -319,7 +317,7 @@ def perform_installation(mountpoint): 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: + if archinstall.arguments['mirror-region'].get("mirrors", {}) 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.add_additional_packages("grub") @@ -339,7 +337,7 @@ def perform_installation(mountpoint): installation.enable_service('systemd-networkd') installation.enable_service('systemd-resolved') - if archinstall.arguments.get('audio', None) != None: + if archinstall.arguments.get('audio', None) is not None: installation.log(f"This audio server will be used: {archinstall.arguments.get('audio', None)}", level=logging.INFO) if archinstall.arguments.get('audio', None) == 'pipewire': print('Installing pipewire ...') @@ -350,7 +348,7 @@ def perform_installation(mountpoint): installation.add_additional_packages("pulseaudio") else: installation.log("No audio server will be installed.", level=logging.INFO) - + if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '': installation.add_additional_packages(archinstall.arguments.get('packages', None)) @@ -363,7 +361,7 @@ def perform_installation(mountpoint): for superuser, user_info in archinstall.arguments.get('superusers', {}).items(): installation.user_create(superuser, user_info["!password"], sudo=True) - if (timezone := archinstall.arguments.get('timezone', None)): + if timezone := archinstall.arguments.get('timezone', None): installation.set_timezone(timezone) if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw): @@ -390,4 +388,4 @@ def perform_installation(mountpoint): archinstall.log(f"Disk states after installing: {archinstall.disk_layouts()}", level=archinstall.LOG_LEVELS.Debug) ask_user_questions() -perform_installation_steps() \ No newline at end of file +perform_installation_steps() diff --git a/examples/minimal.py b/examples/minimal.py index 98d9a6f0..efd66ab7 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -11,8 +11,9 @@ if archinstall.arguments.get('help', None): archinstall.arguments['harddrive'] = archinstall.select_disk(archinstall.all_disks()) + def install_on(mountpoint): - # We kick off the installer by telling it where the + # We kick off the installer by telling it where the with archinstall.Installer(mountpoint) as installation: # Strap in the base system, add a boot loader and configure # some other minor details as specified by this profile and user. @@ -36,9 +37,10 @@ def install_on(mountpoint): archinstall.log(f" * root (password: airoot)") archinstall.log(f" * devel (password: devel)") + if archinstall.arguments['harddrive']: archinstall.arguments['harddrive'].keep_partitions = False - + print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='') archinstall.do_countdown() @@ -68,4 +70,4 @@ if archinstall.arguments['harddrive']: boot.mount('/mnt/boot') -install_on('/mnt') \ No newline at end of file +install_on('/mnt') diff --git a/examples/unattended.py b/examples/unattended.py index 679fbdf6..b0e52f20 100644 --- a/examples/unattended.py +++ b/examples/unattended.py @@ -17,4 +17,4 @@ for name, info in archinstall.list_profiles().items(): profile = archinstall.Profile(None, info['path']) profile.install() - break \ No newline at end of file + break diff --git a/profiles/52-54-00-12-34-56.py b/profiles/52-54-00-12-34-56.py index d4fc3d07..758a4cc2 100644 --- a/profiles/52-54-00-12-34-56.py +++ b/profiles/52-54-00-12-34-56.py @@ -1,6 +1,6 @@ import archinstall -import json -import urllib.request +# import json +# import urllib.request __packages__ = ['nano', 'wget', 'git'] @@ -27,7 +27,7 @@ with archinstall.Filesystem(harddrive) as fs: with archinstall.luks2(harddrive.partition[1], 'luksloop', disk_password) as unlocked_device: unlocked_device.format('btrfs') - + with archinstall.Installer( unlocked_device, boot_partition=harddrive.partition[0], diff --git a/profiles/awesome.py b/profiles/awesome.py index 62cb9e00..aa4702a6 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -40,14 +40,14 @@ if __name__ == 'awesome': with open(f"{archinstall.storage['installation_session'].target}/etc/xdg/awesome/rc.lua", 'r') as fh: awesome_lua = fh.read() - ## Replace xterm with alacritty for a smoother experience. + # Replace xterm with alacritty for a smoother experience. awesome_lua = awesome_lua.replace('"xterm"', '"alacritty"') with open(f"{archinstall.storage['installation_session'].target}/etc/xdg/awesome/rc.lua", 'w') as fh: fh.write(awesome_lua) - ## TODO: Configure the right-click-menu to contain the above packages that were installed. (as a user config) + # TODO: Configure the right-click-menu to contain the above packages that were installed. (as a user config) - ## Remove some interfering nemo settings + # Remove some interfering nemo settings archinstall.storage['installation_session'].arch_chroot("gsettings set org.nemo.desktop show-desktop-icons false") archinstall.storage['installation_session'].arch_chroot("xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search") -- cgit v1.2.3-54-g00ecf From e111dd9bc1ac1c27efa14f89a2cb1464f135c0da Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 15 May 2021 13:04:18 -0400 Subject: Final whitespace changes I think --- examples/unattended.py | 3 ++- profiles/52-54-00-12-34-56.py | 1 + profiles/kde.py | 1 + profiles/server.py | 3 ++- profiles/xorg.py | 1 + setup.py | 3 ++- 6 files changed, 9 insertions(+), 3 deletions(-) (limited to 'profiles') diff --git a/examples/unattended.py b/examples/unattended.py index bb854a70..f1ed4c94 100644 --- a/examples/unattended.py +++ b/examples/unattended.py @@ -1,6 +1,7 @@ -import archinstall import time +import archinstall + archinstall.storage['UPSTREAM_URL'] = 'https://archlinux.life/profiles' archinstall.storage['PROFILE_DB'] = 'index.json' diff --git a/profiles/52-54-00-12-34-56.py b/profiles/52-54-00-12-34-56.py index 758a4cc2..e1361073 100644 --- a/profiles/52-54-00-12-34-56.py +++ b/profiles/52-54-00-12-34-56.py @@ -1,4 +1,5 @@ import archinstall + # import json # import urllib.request diff --git a/profiles/kde.py b/profiles/kde.py index cdb6a41a..451704b9 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -6,6 +6,7 @@ is_top_level_profile = False __packages__ = ["plasma-meta", "konsole", "kate", "dolphin", "sddm", "plasma-wayland-session", "egl-wayland"] + # TODO: Remove hard dependency of bash (due to .bash_profile) diff --git a/profiles/server.py b/profiles/server.py index 3ccc9715..afc37776 100644 --- a/profiles/server.py +++ b/profiles/server.py @@ -1,8 +1,9 @@ # Used to select various server application profiles on top of a minimal installation. -import archinstall import logging +import archinstall + is_top_level_profile = True available_servers = ["cockpit", "docker", "httpd", "lighttpd", "mariadb", "nginx", "postgresql", "sshd", "tomcat"] diff --git a/profiles/xorg.py b/profiles/xorg.py index a5a50697..3351e4e5 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -22,6 +22,7 @@ def _prep_function(*args, **kwargs): return True + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("xorg", "/somewhere/xorg.py") # or through conventional import xorg diff --git a/setup.py b/setup.py index 8b95d978..68a125d1 100644 --- a/setup.py +++ b/setup.py @@ -1,2 +1,3 @@ -import setuptools # type: ignore +import setuptools # type: ignore + setuptools.setup() -- cgit v1.2.3-54-g00ecf