Added a check to see if the package we include exists in testing or not, and if it does, we allow that repo and warn about it.

This commit is contained in:
Anton Hvornum 2022-05-13 07:29:27 +02:00
parent d3b0432283
commit 652308ee40
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
1 changed files with 10 additions and 0 deletions

View File

@ -1,3 +1,5 @@
import logging
from __future__ import annotations
from typing import List, Any, Dict, TYPE_CHECKING
@ -8,6 +10,8 @@ from ..hardware import AVAILABLE_GFX_DRIVERS, has_uefi, has_amd_graphics, has_in
from ..menu import Menu
from ..menu.menu import MenuSelectionType
from ..storage import storage
from ..output import log
from ..packages import find_package
if TYPE_CHECKING:
_: Any
@ -112,6 +116,12 @@ def select_driver(options: Dict[str, Any] = AVAILABLE_GFX_DRIVERS) -> str:
return arguments.get('gfx_driver')
arguments['gfx_driver'] = choice.value
if choice.value == 'nvidia-open':
if (package_info := find_package('nvidia-open')) and package_info[0].repo == 'testing':
if 'testing' not in arguments.get('additional-repositories', []):
log(f"Enabling repository 'testing' due to nvidia-open being selected and it lives there", fg="orange", logging.WARNING)
arguments['additional-repositories'] = arguments.get('additional-repositories', []) + ['testing']
return options.get(choice.value)
raise RequirementError("Selecting drivers require a least one profile to be given as an option.")