Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[flake8]
count = True
ignore = W191,W503
ignore = W191,W503,E704,E203
max-complexity = 40
max-line-length = 160
show-source = True
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/ruff-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
on: [ push, pull_request ]
name: ruff check formatting
jobs:
ruff_format_check:
runs-on: ubuntu-latest
container:
image: archlinux/archlinux:latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: astral-sh/ruff-action@84f83ecf9e1e15d26b7984c7ec9cf73d39ffc946 # v3.3.1
- run: ruff check --select=COM812 --fix
- run: ruff format --diff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
on: [ push, pull_request ]
name: ruff linting
name: ruff check linting
jobs:
ruff:
runs-on: ubuntu-latest
Expand Down
29 changes: 9 additions & 20 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
default_stages: ['pre-commit']
repos:
- repo: https://github.com/pycqa/autoflake
rev: v2.3.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.9
hooks:
- id: autoflake
args: [
'--in-place',
'--remove-all-unused-imports',
'--ignore-init-module-imports'
]
files: \.py$
require_serial: true
fail_fast: true
# fix unused imports and sort them
- id: ruff
args: ["--extend-select", "I", "--fix"]
# format the code
- id: ruff-format
# run the linter
- id: ruff
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
Expand All @@ -23,8 +21,6 @@ repos:
- id: check-yaml # Attempts to load all yaml files to verify syntax
- id: destroyed-symlinks # Detects symlinks which are changed to regular files
- id: detect-private-key # Checks for the existence of private keys
- id: end-of-file-fixer # Makes sure files end in a newline and only a newline
- id: trailing-whitespace # Trims trailing whitespace
# Python specific hooks:
- id: check-ast # Simply check whether files parse as valid python
- id: check-docstring-first # Checks for a common error of placing code before the docstring
Expand All @@ -47,13 +43,6 @@ repos:
- pydantic
- pytest
- cryptography
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.9
hooks:
- id: ruff
args: ["check", "--select", "I", "--fix"]
fail_fast: true
- id: ruff
- repo: local
hooks:
- id: pylint
Expand Down
48 changes: 24 additions & 24 deletions archinstall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _fetch_arch_db() -> None:
try:
Pacman.run("-Sy")
except Exception as e:
debug(f'Failed to sync Arch Linux package database: {e}')
debug(f"Failed to sync Arch Linux package database: {e}")
exit(1)


Expand All @@ -57,10 +57,10 @@ def _check_new_version() -> None:
try:
upgrade = Pacman.run("-Qu archinstall").decode()
except Exception as e:
debug(f'Failed determine pacman version: {e}')
debug(f"Failed determine pacman version: {e}")

if upgrade:
text = f'New version available: {upgrade}'
text = f"New version available: {upgrade}"
info(text)
time.sleep(3)

Expand All @@ -71,7 +71,7 @@ def main() -> int:
OR straight as a module: python -m archinstall
In any case we will be attempting to load the provided script to be run from the scripts/ folder
"""
if '--help' in sys.argv or '-h' in sys.argv:
if "--help" in sys.argv or "-h" in sys.argv:
arch_config_handler.print_help()
return 0

Expand All @@ -89,7 +89,7 @@ def main() -> int:

script = arch_config_handler.args.script

mod_name = f'archinstall.scripts.{script}'
mod_name = f"archinstall.scripts.{script}"
# by loading the module we'll automatically run the script
importlib.import_module(mod_name)

Expand All @@ -109,13 +109,13 @@ def run_as_a_module() -> None:
Tui.shutdown()

if exc:
err = ''.join(traceback.format_exception(exc))
err = "".join(traceback.format_exception(exc))
error(err)

text = (
'Archinstall experienced the above error. If you think this is a bug, please report it to\n'
"Archinstall experienced the above error. If you think this is a bug, please report it to\n"
'https://github.com/archlinux/archinstall and include the log file "/var/log/archinstall/install.log".\n\n'
'Hint: To extract the log from a live ISO \ncurl -F\'file=@/var/log/archinstall/install.log\' https://0x0.st\n'
"Hint: To extract the log from a live ISO \ncurl -F'file=@/var/log/archinstall/install.log' https://0x0.st\n"
)

warn(text)
Expand All @@ -125,20 +125,20 @@ def run_as_a_module() -> None:


__all__ = [
'DeferredTranslation',
'FormattedOutput',
'Language',
'Pacman',
'SysInfo',
'Tui',
'arch_config_handler',
'debug',
'disk_layouts',
'error',
'info',
'load_plugin',
'log',
'plugin',
'translation_handler',
'warn',
"DeferredTranslation",
"FormattedOutput",
"Language",
"Pacman",
"SysInfo",
"Tui",
"arch_config_handler",
"debug",
"disk_layouts",
"error",
"info",
"load_plugin",
"log",
"plugin",
"translation_handler",
"warn",
]
2 changes: 1 addition & 1 deletion archinstall/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import archinstall

if __name__ == '__main__':
if __name__ == "__main__":
archinstall.run_as_a_module()
31 changes: 16 additions & 15 deletions archinstall/default_profiles/applications/pipewire.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,24 @@

class PipewireProfile(Profile):
def __init__(self) -> None:
super().__init__('Pipewire', ProfileType.Application)
super().__init__("Pipewire", ProfileType.Application)

@property
@override
def packages(self) -> list[str]:
return [
'pipewire',
'pipewire-alsa',
'pipewire-jack',
'pipewire-pulse',
'gst-plugin-pipewire',
'libpulse',
'wireplumber'
"pipewire",
"pipewire-alsa",
"pipewire-jack",
"pipewire-pulse",
"gst-plugin-pipewire",
"libpulse",
"wireplumber",
]

def _enable_pipewire_for_all(self, install_session: 'Installer') -> None:
def _enable_pipewire_for_all(self, install_session: "Installer") -> None:
from archinstall.lib.args import arch_config_handler

users: list[User] | None = arch_config_handler.config.users

if users is None:
Expand All @@ -37,20 +38,20 @@ def _enable_pipewire_for_all(self, install_session: 'Installer') -> None:
service_dir.mkdir(parents=True, exist_ok=True)

# Set ownership of the entire user catalogue
install_session.arch_chroot(f'chown -R {user.username}:{user.username} /home/{user.username}')
install_session.arch_chroot(f"chown -R {user.username}:{user.username} /home/{user.username}")

# symlink in the correct pipewire systemd items
install_session.arch_chroot(
f'ln -sf /usr/lib/systemd/user/pipewire-pulse.service /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.service',
run_as=user.username
f"ln -sf /usr/lib/systemd/user/pipewire-pulse.service /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.service",
run_as=user.username,
)
install_session.arch_chroot(
f'ln -sf /usr/lib/systemd/user/pipewire-pulse.socket /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.socket',
run_as=user.username
f"ln -sf /usr/lib/systemd/user/pipewire-pulse.socket /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.socket",
run_as=user.username,
)

@override
def install(self, install_session: 'Installer') -> None:
def install(self, install_session: "Installer") -> None:
super().install(install_session)
install_session.add_additional_packages(self.packages)
self._enable_pipewire_for_all(install_session)
39 changes: 20 additions & 19 deletions archinstall/default_profiles/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
class DesktopProfile(Profile):
def __init__(self, current_selection: list[Profile] = []) -> None:
super().__init__(
'Desktop',
"Desktop",
ProfileType.Desktop,
current_selection=current_selection,
support_greeter=True
support_greeter=True,
)

@property
@override
def packages(self) -> list[str]:
return [
'nano',
'vim',
'openssh',
'htop',
'wget',
'iwd',
'wireless_tools',
'wpa_supplicant',
'smartmontools',
'xdg-utils'
"nano",
"vim",
"openssh",
"htop",
"wget",
"iwd",
"wireless_tools",
"wpa_supplicant",
"smartmontools",
"xdg-utils",
]

@property
Expand All @@ -61,8 +61,9 @@ def do_on_select(self) -> SelectResult:
MenuItem(
p.name,
value=p,
preview_action=lambda x: x.value.preview_text()
) for p in profile_handler.get_desktop_profiles()
preview_action=lambda x: x.value.preview_text(),
)
for p in profile_handler.get_desktop_profiles()
]

group = MenuItemGroup(items, sort_items=True, sort_case_sensitive=False)
Expand All @@ -74,8 +75,8 @@ def do_on_select(self) -> SelectResult:
allow_reset=True,
allow_skip=True,
preview_style=PreviewStyle.RIGHT,
preview_size='auto',
preview_frame=FrameProperties.max('Info')
preview_size="auto",
preview_frame=FrameProperties.max("Info"),
).run()

match result.type_:
Expand All @@ -89,17 +90,17 @@ def do_on_select(self) -> SelectResult:
return SelectResult.ResetCurrent

@override
def post_install(self, install_session: 'Installer') -> None:
def post_install(self, install_session: "Installer") -> None:
for profile in self.current_selection:
profile.post_install(install_session)

@override
def install(self, install_session: 'Installer') -> None:
def install(self, install_session: "Installer") -> None:
# Install common packages for all desktop environments
install_session.add_additional_packages(self.packages)

for profile in self.current_selection:
info(f'Installing profile {profile.name}...')
info(f"Installing profile {profile.name}...")

install_session.add_additional_packages(profile.packages)
install_session.enable_service(profile.services)
Expand Down
4 changes: 2 additions & 2 deletions archinstall/default_profiles/desktops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@


class SeatAccess(Enum):
seatd = 'seatd'
polkit = 'polkit'
seatd = "seatd"
polkit = "polkit"
Loading
Loading