From f88da816456af4c2516c678cca74a85072d8d5f1 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 2 Jun 2021 16:51:57 -0400 Subject: Add description to profile listing --- archinstall/lib/profiles.py | 12 ++++++++++++ archinstall/lib/user_interaction.py | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'archinstall') diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index d4913e7e..8434a0ab 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -228,6 +228,18 @@ class Profile(Script): # since developers like less code - omitting it should assume they want to present it. return True + def get_profile_description(self): + with open(self.path, 'r') as source: + source_data = source.read() + + if '__description__' in source_data: + with self.load_instructions(namespace=f"{self.namespace}.py") as imported: + if hasattr(imported, '__description__'): + return imported.__description__ + + # Default to this string if the profile does not have a description. + return "This profile does not have the __description__ attribute set." + @property def packages(self) -> Optional[list]: """ diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 79919658..004d81be 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -575,7 +575,8 @@ def select_profile(): if len(shown_profiles) >= 1: for index, profile in enumerate(shown_profiles): - print(f"{index}: {profile}") + description = Profile(None, profile).get_profile_description() + print(f"{index}: {profile}: {description}") print(' -- The above list is a set of pre-programmed profiles. --') print(' -- They might make it easier to install things like desktop environments. --') -- cgit v1.2.3-70-g09d2 From 81269b972c07fefe7cc7bcc923b5f8189bc757df Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 2 Jun 2021 16:56:39 -0400 Subject: Remove line explaining desktop profile --- archinstall/lib/user_interaction.py | 1 - 1 file changed, 1 deletion(-) (limited to 'archinstall') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 004d81be..b52267d9 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -580,7 +580,6 @@ def select_profile(): print(' -- The above list is a set of pre-programmed profiles. --') print(' -- They might make it easier to install things like desktop environments. --') - print(' -- The desktop profile will let you select a DE/WM profile, e.g gnome, kde, sway --') print(' -- (Leave blank and hit enter to skip this step and continue) --') selected_profile = generic_select(actual_profiles_raw, 'Enter a pre-programmed profile name if you want to install one: ', options_output=False) -- cgit v1.2.3-70-g09d2