Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-09-30 09:38:46 +0000
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-09-30 09:38:46 +0000
commit63d774b7d7f82cd0a4ab59c44128d271baaa6dd4 (patch)
tree0b838299221989461cab5d0490cbc1b2d92d4cb8 /archinstall
parent1bff423195c0890e9fa3d8d2cf40796873f7adc7 (diff)
Fixing a import logic issue. We don't want to trigger if __name__ ... during _prep_function() calls. So we'll import the module with a specific namespace containing the .py which shouldn't be able to happen when normal programmers do normal imports as .py gets removed normally.
Diffstat (limited to 'archinstall')
-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 60d41ea1..6d7a8b42 100644
--- a/archinstall/lib/profiles.py
+++ b/archinstall/lib/profiles.py
@@ -85,10 +85,11 @@ class Profile():
# def py_exec_mock(self):
# spec.loader.exec_module(imported)
- def load_instructions(self):
+ def load_instructions(self, namespace=None):
if (absolute_path := self.path):
if os.path.splitext(absolute_path)[1] == '.py':
- namespace = os.path.splitext(os.path.basename(absolute_path))[0]
+ if not namespace:
+ 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[namespace] = imported