From ad4733bbd0b0e889ad902a7d954ec985fc7a24fe Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 17 Feb 2021 14:21:46 +0100 Subject: Simplified profile prep-execution slightly in guided.py. The code can be improved further but it's now more easily read what's going on. --- examples/guided.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'examples') diff --git a/examples/guided.py b/examples/guided.py index 1758a397..4cd37972 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -185,15 +185,15 @@ else: archinstall.arguments['profile'] = archinstall.list_profiles()[archinstall.arguments['profile']] # Check the potentially selected profiles preperations to get early checks if some additional questions are needed. -print(archinstall.arguments['profile']) -if archinstall.arguments['profile']: - if not archinstall.arguments['profile']._prep_function(): - archinstall.log( - ' * Profile\'s preparation requirements was not fulfilled.', - bg='black', - fg='red' - ) - exit(1) +if archinstall.arguments['profile'] and archinstall.arguments['profile'].has_prep_function(): + with archinstall.arguments['profile'].load_instructions(namespace=f"{archinstall.arguments['profile'].namespace}.py") as imported: + if not imported._prep_function(): + archinstall.log( + ' * Profile\'s preparation requirements was not fulfilled.', + bg='black', + fg='red' + ) + exit(1) # Additional packages (with some light weight error handling for invalid package names) if not archinstall.arguments.get('packages', None): -- cgit v1.2.3-54-g00ecf