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 15:16:41 +0100
committerAnton Hvornum <anton@hvornum.se>2021-03-21 15:16:41 +0100
commit60817334224a8ade4c7e600498fe9bd8f540bf29 (patch)
treec7c10018a0bc48936d01cd2a7f85691e516f086f /archinstall/lib/profiles.py
parenta9f177e722d80ecbacb0c8e74ea0e8a4b88212be (diff)
Storing original namespace of profiles as they were during initation. Namespaces now get reverted back to the original state just before .install() is called. This ensures any temporary namespace changes made during prep-checks etc doesn't stick around when we try to install.
Diffstat (limited to 'archinstall/lib/profiles.py')
-rw-r--r--archinstall/lib/profiles.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py
index a0f2dc77..34ba09da 100644
--- a/archinstall/lib/profiles.py
+++ b/archinstall/lib/profiles.py
@@ -76,6 +76,7 @@ class Script():
self.spec = None
self.examples = None
self.namespace = os.path.splitext(os.path.basename(self.path))[0]
+ self.original_namespace = self.namespace
print(f"Script {self} loaded with namespace: {self.namespace}")
def __enter__(self, *args, **kwargs):
@@ -149,7 +150,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}
@@ -158,6 +158,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):
@@ -206,4 +210,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