Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archinstall/lib/profiles.py9
-rw-r--r--examples/guided.py2
2 files changed, 8 insertions, 3 deletions
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py
index 5d425a22..ef7bba00 100644
--- a/archinstall/lib/profiles.py
+++ b/archinstall/lib/profiles.py
@@ -125,7 +125,9 @@ class Script():
else:
raise ProfileNotFound(f"Cannot handle scheme {parsed_url.scheme}")
- def load_instructions(self, namespace=None):
+ def load_instructions(self, namespace=None, reset_namespace=False):
+ original_namespace = self.namespace
+
if namespace:
self.namespace = namespace
@@ -135,6 +137,9 @@ class Script():
print(f"Imported {self} into sys.modules with namespace {self.namespace}.")
+ if reset_namespace:
+ self.namespace = original_namespace
+
return self
def execute(self):
@@ -173,7 +178,7 @@ class Profile(Script):
# if __name__ == 'moduleName'
if '__name__' in source_data and '_prep_function' in source_data:
print(f"Checking if {self} has _prep_function by importing with namespace {self.namespace}.py")
- with self.load_instructions(namespace=f"{self.namespace}.py") as imported:
+ with self.load_instructions(namespace=f"{self.namespace}.py", reset_namespace=True) as imported:
if hasattr(imported, '_prep_function'):
return True
return False
diff --git a/examples/guided.py b/examples/guided.py
index f4fc533b..4e3dd082 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -170,7 +170,7 @@ def ask_user_questions():
# Check the potentially selected profiles preperations to get early checks if some additional questions are needed.
if archinstall.arguments['profile'] and archinstall.arguments['profile'].has_prep_function():
print(f"{archinstall.arguments['profile']} has prep-function, loading with namespace {archinstall.arguments['profile'].namespace}.py")
- with archinstall.arguments['profile'].load_instructions(namespace=f"{archinstall.arguments['profile'].namespace}.py") as imported:
+ with archinstall.arguments['profile'].load_instructions(namespace=f"{archinstall.arguments['profile'].namespace}.py", reset_namespace=True) as imported:
if not imported._prep_function():
archinstall.log(
' * Profile\'s preparation requirements was not fulfilled.',