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@hvornum.se>2021-03-21 17:52:59 +0100
committerGitHub <noreply@github.com>2021-03-21 17:52:59 +0100
commit7c54b4ce72ba8d7689ff54215414fdb2341a59bb (patch)
treedd045e42df15bac68a81ca49a9c9a11b1618389f /archinstall/lib/profiles.py
parent75d1395b107d983c8b97f10ee757ee6f28487afa (diff)
parent83c0ee4b225d3263b7aa564035130151f8163584 (diff)
Merge pull request #118 from Torxed/torx-fix-profile-issues
Fixed profile issues as well as partition cache issues. Also added some more debug logs for support cases.
Diffstat (limited to 'archinstall/lib/profiles.py')
-rw-r--r--archinstall/lib/profiles.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py
index 01c3288c..08b1d618 100644
--- a/archinstall/lib/profiles.py
+++ b/archinstall/lib/profiles.py
@@ -1,7 +1,7 @@
import os, urllib.request, urllib.parse, ssl, json, re
import importlib.util, sys, glob, hashlib
from collections import OrderedDict
-from .general import multisplit, sys_command, log
+from .general import multisplit, sys_command
from .exceptions import *
from .networking import *
from .output import log, LOG_LEVELS
@@ -76,6 +76,8 @@ class Script():
self.spec = None
self.examples = None
self.namespace = os.path.splitext(os.path.basename(self.path))[0]
+ self.original_namespace = self.namespace
+ log(f"Script {self} has been loaded with namespace '{self.namespace}'", level=LOG_LEVELS.Debug)
def __enter__(self, *args, **kwargs):
self.execute()
@@ -131,14 +133,13 @@ class Script():
self.spec = importlib.util.spec_from_file_location(self.namespace, self.path)
imported = importlib.util.module_from_spec(self.spec)
sys.modules[self.namespace] = imported
-
+
return self
def execute(self):
if not self.namespace in sys.modules or self.spec is None:
self.load_instructions()
- __builtins__['installation'] = self.installer # TODO: Replace this with a import archinstall.session instead
self.spec.loader.exec_module(sys.modules[self.namespace])
return sys.modules[self.namespace]
@@ -146,7 +147,6 @@ class Script():
class Profile(Script):
def __init__(self, installer, path, args={}):
super(Profile, self).__init__(path, installer)
- self._cache = None
def __dump__(self, *args, **kwargs):
return {'path' : self.path}
@@ -155,6 +155,10 @@ class Profile(Script):
return f'Profile({os.path.basename(self.profile)})'
def install(self):
+ # Before installing, revert any temporary changes to the namespace.
+ # This ensures that the namespace during installation is the original initation namespace.
+ # (For instance awesome instead of aweosme.py or app-awesome.py)
+ self.namespace = self.original_namespace
return self.execute()
def has_prep_function(self):
@@ -202,4 +206,11 @@ class Application(Profile):
elif parsed_url.scheme in ('https', 'http'):
return self.localize_path(self.profile)
else:
- raise ProfileNotFound(f"Application cannot handle scheme {parsed_url.scheme}") \ No newline at end of file
+ raise ProfileNotFound(f"Application cannot handle scheme {parsed_url.scheme}")
+
+ def install(self):
+ # Before installing, revert any temporary changes to the namespace.
+ # This ensures that the namespace during installation is the original initation namespace.
+ # (For instance awesome instead of aweosme.py or app-awesome.py)
+ self.namespace = self.original_namespace
+ return self.execute() \ No newline at end of file