Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-03-21 14:50:57 +0100
committerAnton Hvornum <anton@hvornum.se>2021-03-21 14:50:57 +0100
commitc1e8e6b58dd71f14f2720f532c327d29e8473dbe (patch)
tree678f42ccc693983c5d5f9a7b8a54d12ca349f012
parentf76f5458daa63b06cf356f40a0eb27f957308b66 (diff)
Debugging tainted namespace on profile modules.
-rw-r--r--archinstall/lib/profiles.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py
index 7b6e9b4d..63d32afa 100644
--- a/archinstall/lib/profiles.py
+++ b/archinstall/lib/profiles.py
@@ -76,7 +76,7 @@ class Script():
self.spec = None
self.examples = None
self.namespace = os.path.splitext(os.path.basename(self.path))[0]
- print(f"Script loaded with namespace: {self.namespace}")
+ print(f"Script {self} loaded with namespace: {self.namespace}")
def __enter__(self, *args, **kwargs):
self.execute()
@@ -126,17 +126,18 @@ class Script():
raise ProfileNotFound(f"Cannot handle scheme {parsed_url.scheme}")
def load_instructions(self, namespace=None):
- print(f"Load instructions for {self} with namespace {namespace}")
- if namespace:
- self.namespace = namespace
+ if not namespace:
+ namespace = self.namespace
- if '.py.py' in self.namespace:
- raise KeyError("Debugging")
+ if namespace in sys.modules:
+ print(f"Found {self} in sys.modules, returning cached import.")
+ return self
- self.spec = importlib.util.spec_from_file_location(self.namespace, self.path)
+ self.spec = importlib.util.spec_from_file_location(namespace, self.path)
imported = importlib.util.module_from_spec(self.spec)
- sys.modules[self.namespace] = imported
+ sys.modules[namespace] = imported
+ print(f"Imported {self} into sys.modules. Returning fresh copy.")
return self
def execute(self):