From 85fd06fa8a20a1861c9ec0d8e15da954fe5cdd43 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 30 Sep 2020 09:11:36 +0000 Subject: Finalized magic function _prep_function(). Gets returned when a profile is imported through archinstall.select_profile() user-interaction helper function. Asks for additional user-input right away rather than half way into the installation. This makes sure user input is taken care of before starting the installation. Although it complicates the code layout a tiny bit. Profiles need a __name__ and a _prep_function combo in order to be safely executed by select_profile(). select_profile() will not attempt to run or execute the code in any way unless those to conditions are met. In theory :) --- profiles/xorg.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'profiles/xorg.py') diff --git a/profiles/xorg.py b/profiles/xorg.py index 26492f7c..38492c5c 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -95,12 +95,10 @@ def _prep_function(*args, **kwargs): return True -# Absolute import, not conventional import. # Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("/somewhere/xorg.py") -if os.path.basename(__name__) == 'xorg.py': - print('This should not be printed!') - +# through importlib.util.spec_from_file_location("xorg", "/somewhere/xorg.py") +# or through conventional import xorg +if __name__ == 'xorg': installation.add_additional_packages("xorg-server xorg-xinit") # with open(f'{installation.mountpoint}/etc/X11/xinit/xinitrc', 'a') as X11: -- cgit v1.2.3-70-g09d2