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@hvornum.se>2021-04-08 14:53:04 +0000
committerGitHub <noreply@github.com>2021-04-08 14:53:04 +0000
commitd988d81690edfb5044d3a33e9a7155fcf27df313 (patch)
tree437c1fdf71c66c1136d060ea4d46740f4a468b2b /archinstall
parente70aa5244bd07cdaa299df528f8ebd099b00bf64 (diff)
parent7fdbfaaaf947ca69572525efa57626c3794be08f (diff)
Merging in quality of life improvements from 2.2.0 into 2.1.4 (master)
Selectively bringing in quality of life improvements from v2.2.0 work into master
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/installer.py2
-rw-r--r--archinstall/lib/profiles.py46
2 files changed, 47 insertions, 1 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 16d48183..66cac12c 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -52,7 +52,7 @@ class Installer():
'user' : False # Root counts as a user, if additional users are skipped.
}
- self.base_packages = base_packages.split(' ')
+ self.base_packages = base_packages.split(' ') if type(base_packages) is str else base_packages
self.post_base_install = []
storage['session'] = self
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py
index 4ef6c533..abf10f8e 100644
--- a/archinstall/lib/profiles.py
+++ b/archinstall/lib/profiles.py
@@ -177,6 +177,52 @@ class Profile(Script):
if hasattr(imported, '_prep_function'):
return True
return False
+"""
+ def has_post_install(self):
+ with open(self.path, 'r') as source:
+ source_data = source.read()
+
+ # Some crude safety checks, make sure the imported profile has
+ # a __name__ check and if so, check if it's got a _prep_function()
+ # we can call to ask for more user input.
+ #
+ # If the requirements are met, import with .py in the namespace to not
+ # trigger a traditional:
+ # if __name__ == 'moduleName'
+ if '__name__' in source_data and '_post_install' in source_data:
+ with self.load_instructions(namespace=f"{self.namespace}.py") as imported:
+ if hasattr(imported, '_post_install'):
+ return True
+"""
+
+ def is_top_level_profile(self):
+ with open(self.path, 'r') as source:
+ source_data = source.read()
+
+ # TODO: I imagine that there is probably a better way to write this.
+ return 'top_level_profile = True' in source_data
+
+ @property
+ def packages(self) -> list:
+ """
+ Returns a list of packages baked into the profile definition.
+ If no package definition has been done, .packages() will return None.
+ """
+ with open(self.path, 'r') as source:
+ source_data = source.read()
+
+ # Some crude safety checks, make sure the imported profile has
+ # a __name__ check before importing.
+ #
+ # If the requirements are met, import with .py in the namespace to not
+ # trigger a traditional:
+ # if __name__ == 'moduleName'
+ if '__name__' in source_data and '__packages__' in source_data:
+ with self.load_instructions(namespace=f"{self.namespace}.py") as imported:
+ if hasattr(imported, '__packages__'):
+ return imported.__packages__
+ return None
+
class Application(Profile):
def __repr__(self, *args, **kwargs):