Setting proper keys in exported config (#557)

* Set the resolved profile path to the actual desktop environment

* split Nvidia driver list into proprietary and open-source

* Updated select_driver to use archinstall.arguments for driver selection

* Adding default value that works with later .get()

* audio will now be prompted irrespective of profile
This commit is contained in:
Yash Tripathi 2021-06-13 18:22:24 +05:30 committed by GitHub
parent 4e17355796
commit d30a22cae3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 19 deletions

View File

@ -16,7 +16,7 @@ from .locale_helpers import list_keyboard_languages, verify_keyboard_layout, sea
from .networking import list_interfaces from .networking import list_interfaces
from .output import log from .output import log
from .profiles import Profile, list_profiles from .profiles import Profile, list_profiles
from .storage import *
# TODO: Some inconsistencies between the selection processes. # TODO: Some inconsistencies between the selection processes.
# Some return the keys from the options, some the values? # Some return the keys from the options, some the values?
@ -700,9 +700,9 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS):
""" """
drivers = sorted(list(options)) drivers = sorted(list(options))
default_option = options["All open-source (default)"]
if drivers: if drivers:
arguments = storage.get('arguments', {})
if has_amd_graphics(): if has_amd_graphics():
print('For the best compatibility with your AMD hardware, you may want to use either the all open-source or AMD / ATI options.') print('For the best compatibility with your AMD hardware, you may want to use either the all open-source or AMD / ATI options.')
if has_intel_graphics(): if has_intel_graphics():
@ -710,22 +710,12 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS):
if has_nvidia_graphics(): if has_nvidia_graphics():
print('For the best compatibility with your Nvidia hardware, you may want to use the Nvidia proprietary driver.') print('For the best compatibility with your Nvidia hardware, you may want to use the Nvidia proprietary driver.')
initial_option = generic_select(drivers, input_text="Select your graphics card driver: ") arguments['gfx_driver'] = generic_select(drivers, input_text="Select your graphics card driver: ")
if not initial_option: if arguments.get('gfx_driver', None) is None:
return default_option arguments['gfx_driver'] = "All open-source (default)"
selected_driver = options[initial_option] return options.get(arguments.get('gfx_driver'))
if type(selected_driver) == dict:
driver_options = sorted(list(selected_driver))
driver_package_group = generic_select(driver_options, f'Which driver-type do you want for {initial_option}: ', allow_empty_input=False)
driver_package_group = selected_driver[driver_package_group]
return driver_package_group
return selected_driver
raise RequirementError("Selecting drivers require a least one profile to be given as an option.") raise RequirementError("Selecting drivers require a least one profile to be given as an option.")

View File

@ -54,6 +54,8 @@ def _prep_function(*args, **kwargs):
archinstall.storage['_desktop_profile'] = desktop archinstall.storage['_desktop_profile'] = desktop
profile = archinstall.Profile(None, desktop) profile = archinstall.Profile(None, desktop)
# Set the resolved profile path to the actual desktop environment
archinstall.arguments['profile'] = profile
# Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered. # Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered.
with profile.load_instructions(namespace=f"{desktop}.py") as imported: with profile.load_instructions(namespace=f"{desktop}.py") as imported:
if hasattr(imported, '_prep_function'): if hasattr(imported, '_prep_function'):