Very selectively fix some PEP 8 issues with profiles

This commit is contained in:
Dylan Taylor 2021-05-15 11:35:18 -04:00
parent 5254ac6220
commit ffd5b5f804
18 changed files with 86 additions and 30 deletions

View File

@ -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
"""
"""

View File

@ -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')
archinstall.storage['installation_session'].enable_service('postgresql')

View File

@ -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")

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'])

View File

@ -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

View File

@ -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.

View File

@ -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])

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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':
"""

View File

@ -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.

View File

@ -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__)

View File

@ -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

View File

@ -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