From 39dd0f1ac89943acda2ad783e800d56819cb3c39 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 28 Jan 2022 12:31:18 -0300 Subject: [PATCH] [arch] improvement: always listing repository packages as primary options when multiple providers for a given dependency are available --- CHANGELOG.md | 3 ++- bauh/gems/arch/confirmation.py | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abdb8496..e22a30d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Improvements - Arch - not rechecking sub-dependencies of an AUR dependency to be installed - - allowing AUR packages to be installed as dependencies of a repository package + - allowing AUR packages to be installed as dependencies of a repository package + - always listing repository packages as primary options when multiple providers for a given dependency are available ### Fixes - General diff --git a/bauh/gems/arch/confirmation.py b/bauh/gems/arch/confirmation.py index 544e0438..a8d03f08 100644 --- a/bauh/gems/arch/confirmation.py +++ b/bauh/gems/arch/confirmation.py @@ -79,15 +79,22 @@ def request_providers(providers_map: Dict[str, Set[str]], repo_map: Dict[str, st for dep, providers in providers_map.items(): opts = [] - providers_list = [*providers] - providers_list.sort() + repo_providers, aur_providers = {}, {} - for p in providers_list: + for p in providers: repo = repo_map.get(p, 'aur') - opts.append(InputOption(label=p, - value=p, - icon_path=aur_icon_path if repo == 'aur' else repo_icon_path, - tooltip='{}: {}'.format(i18n['repository'].capitalize(), repo))) + + if repo == 'aur': + aur_providers[p] = repo + else: + repo_providers[p] = repo + + for current_providers in (repo_providers, aur_providers): + for pname, repo in sorted(current_providers.items()): + opts.append(InputOption(label=pname, + value=pname, + icon_path=aur_icon_path if repo == 'aur' else repo_icon_path, + tooltip='{}: {}'.format(i18n['repository'].capitalize(), repo))) form.components.append(SingleSelectComponent(label=bold(dep.lower()), options=opts,