From 60817334224a8ade4c7e600498fe9bd8f540bf29 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 21 Mar 2021 15:16:41 +0100 Subject: 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. --- archinstall/lib/profiles.py | 15 +++++++++++++-- 1 file 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 -- cgit v1.2.3-70-g09d2