Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2023-09-22 19:43:12 +1000
committerGitHub <noreply@github.com>2023-09-22 11:43:12 +0200
commit8e40de85fb2fcde81ac994335286a863c6e46c86 (patch)
treee5b2293ee111ad18a0d2fa743b6af98401cb0725
parent6d908e8cd7d395a1f8f2473b2dc9ca3e2ace1226 (diff)
Only parse profile classes when loading modules (#2088)
Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
-rw-r--r--archinstall/lib/profile/profiles_handler.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/archinstall/lib/profile/profiles_handler.py b/archinstall/lib/profile/profiles_handler.py
index 7810db2f..03039321 100644
--- a/archinstall/lib/profile/profiles_handler.py
+++ b/archinstall/lib/profile/profiles_handler.py
@@ -2,6 +2,7 @@ from __future__ import annotations
import importlib.util
import sys
+import inspect
from collections import Counter
from functools import cached_property
from pathlib import Path
@@ -276,12 +277,15 @@ class ProfileHandler:
profiles = []
for k, v in module.__dict__.items():
if isinstance(v, type) and v.__module__ == module.__name__:
- try:
- cls_ = v()
- if isinstance(cls_, Profile):
- profiles.append(cls_)
- except Exception:
- debug(f'Cannot import {module}, it does not appear to be a Profile class')
+ bases = inspect.getmro(v)
+
+ if Profile in bases:
+ try:
+ cls_ = v()
+ if isinstance(cls_, Profile):
+ profiles.append(cls_)
+ except Exception:
+ debug(f'Cannot import {module}, it does not appear to be a Profile class')
return profiles