Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/profile
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2023-05-12 02:30:09 +1000
committerGitHub <noreply@github.com>2023-05-11 18:30:09 +0200
commit89cefb9a1c7d4c4968e7d8645149078e601c9d1c (patch)
tree12c84bdcef1b0ef3f8a21977e25c7f0f89388138 /archinstall/lib/profile
parent6e6b850a8f687b193172aaa321d49bd2956c1d4f (diff)
Cleanup imports and unused code (#1801)
* Cleanup imports and unused code * Update build check * Keep deprecation exception * Simplify logging --------- Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall/lib/profile')
-rw-r--r--archinstall/lib/profile/profile_menu.py2
-rw-r--r--archinstall/lib/profile/profiles_handler.py21
2 files changed, 11 insertions, 12 deletions
diff --git a/archinstall/lib/profile/profile_menu.py b/archinstall/lib/profile/profile_menu.py
index 6462685a..213466a6 100644
--- a/archinstall/lib/profile/profile_menu.py
+++ b/archinstall/lib/profile/profile_menu.py
@@ -6,7 +6,7 @@ from archinstall.default_profiles.profile import Profile, GreeterType
from .profile_model import ProfileConfiguration
from ..hardware import AVAILABLE_GFX_DRIVERS
from ..menu import Menu, MenuSelectionType, AbstractSubMenu, Selector
-from ..user_interaction.system_conf import select_driver
+from ..interactions.system_conf import select_driver
if TYPE_CHECKING:
_: Any
diff --git a/archinstall/lib/profile/profiles_handler.py b/archinstall/lib/profile/profiles_handler.py
index 6ed95f8e..16fef251 100644
--- a/archinstall/lib/profile/profiles_handler.py
+++ b/archinstall/lib/profile/profiles_handler.py
@@ -1,7 +1,6 @@
from __future__ import annotations
import importlib.util
-import logging
import sys
from collections import Counter
from functools import cached_property
@@ -15,7 +14,7 @@ from .profile_model import ProfileConfiguration
from ..hardware import AVAILABLE_GFX_DRIVERS
from ..menu import MenuSelectionType, Menu, MenuSelection
from ..networking import list_interfaces, fetch_data_from_url
-from ..output import log
+from ..output import error, debug, info, warn
from ..storage import storage
if TYPE_CHECKING:
@@ -106,7 +105,7 @@ class ProfileHandler:
invalid = ', '.join([k for k, v in resolved.items() if v is None])
if invalid:
- log(f'No profile definition found: {invalid}')
+ info(f'No profile definition found: {invalid}')
custom_settings = profile_config.get('custom_settings', {})
for profile in valid:
@@ -216,7 +215,7 @@ class ProfileHandler:
install_session.add_additional_packages(additional_pkg)
except Exception as err:
- log(f"Could not handle nvidia and linuz-zen specific situations during xorg installation: {err}", level=logging.WARNING, fg="yellow")
+ warn(f"Could not handle nvidia and linuz-zen specific situations during xorg installation: {err}")
# Prep didn't run, so there's no driver to install
install_session.add_additional_packages(['xorg-server', 'xorg-xinit'])
@@ -250,7 +249,7 @@ class ProfileHandler:
self.add_custom_profiles(profiles)
except ValueError:
err = str(_('Unable to fetch profile from specified url: {}')).format(url)
- log(err, level=logging.ERROR, fg="red")
+ error(err)
def _load_profile_class(self, module: ModuleType) -> List[Profile]:
"""
@@ -264,7 +263,7 @@ class ProfileHandler:
if isinstance(cls_, Profile):
profiles.append(cls_)
except Exception:
- log(f'Cannot import {module}, it does not appear to be a Profile class', level=logging.DEBUG)
+ debug(f'Cannot import {module}, it does not appear to be a Profile class')
return profiles
@@ -278,7 +277,7 @@ class ProfileHandler:
if len(duplicates) > 0:
err = str(_('Profiles must have unique name, but profile definitions with duplicate name found: {}')).format(duplicates[0][0])
- log(err, level=logging.ERROR, fg="red")
+ error(err)
sys.exit(1)
def _is_legacy(self, file: Path) -> bool:
@@ -297,15 +296,15 @@ class ProfileHandler:
Process a file for profile definitions
"""
if self._is_legacy(file):
- log(f'Cannot import {file} because it is no longer supported, please use the new profile format')
+ info(f'Cannot import {file} because it is no longer supported, please use the new profile format')
return []
if not file.is_file():
- log(f'Cannot find profile file {file}')
+ info(f'Cannot find profile file {file}')
return []
name = file.name.removesuffix(file.suffix)
- log(f'Importing profile: {file}', level=logging.DEBUG)
+ debug(f'Importing profile: {file}')
try:
spec = importlib.util.spec_from_file_location(name, file)
@@ -315,7 +314,7 @@ class ProfileHandler:
spec.loader.exec_module(imported)
return self._load_profile_class(imported)
except Exception as e:
- log(f'Unable to parse file {file}: {e}', level=logging.ERROR)
+ error(f'Unable to parse file {file}: {e}')
return []