forked from Shinonome/caelestia-cli
refactor: set default aur helper to constant
This commit is contained in:
@@ -7,7 +7,7 @@ from pathlib import Path
|
||||
|
||||
from caelestia.utils.dots.deployer import Deployer
|
||||
from caelestia.utils.dots.manifest import Manifest, ManifestError, expand, expand_dests
|
||||
from caelestia.utils.dots.packages import PackageInstaller
|
||||
from caelestia.utils.dots.packages import DEFAULT_AUR_HELPER, PackageInstaller
|
||||
from caelestia.utils.dots.source import DotsSource, SourceError
|
||||
from caelestia.utils.dots.state import DotsState
|
||||
from caelestia.utils.io import confirm, disable_input, fatal, info, log, pause, warn
|
||||
@@ -155,7 +155,7 @@ class Command:
|
||||
log(f"Building {path}...")
|
||||
local_packages[path] = installer.build_install(directory)
|
||||
|
||||
return getattr(installer, "helper", ""), packages, local_packages
|
||||
return getattr(installer, "helper", DEFAULT_AUR_HELPER), packages, local_packages
|
||||
|
||||
def run_hooks(self, manifest: Manifest) -> None:
|
||||
hooks = manifest.enabled_hooks("post_install")
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
from abc import ABC, abstractmethod
|
||||
from pathlib import Path
|
||||
|
||||
from caelestia.utils.io import fatal, info
|
||||
|
||||
AUR_HELPERS = "paru", "yay"
|
||||
DEFAULT_AUR_HELPER = "paru"
|
||||
AUR_HELPERS = DEFAULT_AUR_HELPER, "yay"
|
||||
|
||||
|
||||
def _install_aur_helper(helper: str, noconfirm: bool = False) -> None:
|
||||
@@ -31,7 +33,7 @@ def _install_aur_helper(helper: str, noconfirm: bool = False) -> None:
|
||||
if helper == "yay":
|
||||
subprocess.run(["yay", "-Y", "--gendb"], check=True)
|
||||
subprocess.run(["yay", "-Y", "--devel", "--save"], check=True)
|
||||
else:
|
||||
elif helper == "paru":
|
||||
subprocess.run(["paru", "--gendb"], check=True)
|
||||
|
||||
|
||||
@@ -59,9 +61,9 @@ class PackageInstaller(ABC):
|
||||
if shutil.which(candidate):
|
||||
return ArchInstaller(candidate, noconfirm)
|
||||
|
||||
info("No AUR helper found. Installing paru...")
|
||||
_install_aur_helper("paru", noconfirm)
|
||||
return ArchInstaller("paru", noconfirm)
|
||||
info(f"No AUR helper found. Installing {DEFAULT_AUR_HELPER}...")
|
||||
_install_aur_helper(DEFAULT_AUR_HELPER, noconfirm)
|
||||
return ArchInstaller(DEFAULT_AUR_HELPER, noconfirm)
|
||||
|
||||
# --- Abstract methods ---
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import json
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from caelestia.utils.dots.packages import DEFAULT_AUR_HELPER
|
||||
from caelestia.utils.io import warn
|
||||
from caelestia.utils.paths import atomic_dump, dots_state_path
|
||||
|
||||
@@ -31,7 +32,7 @@ class DotsState:
|
||||
return DotsState()
|
||||
|
||||
return DotsState(
|
||||
aur_helper=data.get("aur_helper"),
|
||||
aur_helper=data.get("aur_helper", DEFAULT_AUR_HELPER),
|
||||
applied_rev=data.get("applied_rev"),
|
||||
enabled_components=data.get("enabled_components", []),
|
||||
packages=data.get("packages", []),
|
||||
|
||||
Reference in New Issue
Block a user