Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/profiles.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-09-30 09:11:36 +0000
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-09-30 09:11:36 +0000
commit85fd06fa8a20a1861c9ec0d8e15da954fe5cdd43 (patch)
tree9bcb45341bd95a225800c5c7680c632e4ebff5cd /archinstall/lib/profiles.py
parent5a4d68e617ba4e76137db96542ebaeb08acd70cb (diff)
Finalized magic function _prep_function(). Gets returned when a profile is imported through archinstall.select_profile() user-interaction helper function. Asks for additional user-input right away rather than half way into the installation. This makes sure user input is taken care of before starting the installation. Although it complicates the code layout a tiny bit. Profiles need a __name__ and a _prep_function combo in order to be safely executed by select_profile(). select_profile() will not attempt to run or execute the code in any way unless those to conditions are met. In theory :)
Diffstat (limited to 'archinstall/lib/profiles.py')
-rw-r--r--archinstall/lib/profiles.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py
index 45d82531..f63fb96d 100644
--- a/archinstall/lib/profiles.py
+++ b/archinstall/lib/profiles.py
@@ -88,9 +88,10 @@ class Profile():
def load_instructions(self):
if (absolute_path := self.path):
if os.path.splitext(absolute_path)[1] == '.py':
- spec = importlib.util.spec_from_file_location(absolute_path, absolute_path)
+ namespace = os.path.splitext(os.path.basename(absolute_path))[0]
+ spec = importlib.util.spec_from_file_location(namespace, absolute_path)
imported = importlib.util.module_from_spec(spec)
- sys.modules[os.path.basename(absolute_path)] = imported
+ sys.modules[namespace] = imported
return Imported(spec, imported)
else:
raise ProfileError(f'Extension {os.path.splitext(absolute_path)[1]} is not a supported profile model. Only .py is supported.')