From fe2c3cc14deb80d1e4fa9a4c57b98f5812c18aea Mon Sep 17 00:00:00 2001 From: JakobDev Date: Mon, 12 Apr 2021 15:13:49 +0200 Subject: Replace os.system with subprocess.call --- archinstall/lib/locale_helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'archinstall/lib/locale_helpers.py') diff --git a/archinstall/lib/locale_helpers.py b/archinstall/lib/locale_helpers.py index 523a23d5..82964dc9 100644 --- a/archinstall/lib/locale_helpers.py +++ b/archinstall/lib/locale_helpers.py @@ -1,3 +1,4 @@ +import subprocess import os from .exceptions import * @@ -26,4 +27,4 @@ def search_keyboard_layout(filter, layout='qwerty'): yield language def set_keyboard_language(locale): - return os.system(f'loadkeys {locale}') == 0 + return subprocess.call(['loadkeys',locale]) == 0 -- cgit v1.2.3-70-g09d2 From 12b43f443bc128bb1eb3f53484eaf4449bd7d4d4 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 14 Apr 2021 13:16:18 +0200 Subject: Removed layout filtering This caused languages such as `be-latin1` to be hidden both in Search and direct input. Because as an example that layout belongs to `azerty` and not `qwerty`. --- archinstall/lib/locale_helpers.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'archinstall/lib/locale_helpers.py') diff --git a/archinstall/lib/locale_helpers.py b/archinstall/lib/locale_helpers.py index 82964dc9..736bfc47 100644 --- a/archinstall/lib/locale_helpers.py +++ b/archinstall/lib/locale_helpers.py @@ -4,27 +4,22 @@ import os from .exceptions import * # from .general import sys_command -def list_keyboard_languages(layout='qwerty'): +def list_keyboard_languages(): locale_dir = '/usr/share/kbd/keymaps/' if not os.path.isdir(locale_dir): raise RequirementError(f'Directory containing locales does not exist: {locale_dir}') for root, folders, files in os.walk(locale_dir): - # Since qwerty is under /i386/ but other layouts are - # in different spots, we'll need to filter the last foldername - # of the path to verify against the desired layout. - if os.path.basename(root) != layout: - continue for file in files: if os.path.splitext(file)[1] == '.gz': yield file.strip('.gz').strip('.map') -def search_keyboard_layout(filter, layout='qwerty'): - for language in list_keyboard_languages(layout): +def search_keyboard_layout(filter): + for language in list_keyboard_languages(): if filter.lower() in language.lower(): yield language def set_keyboard_language(locale): - return subprocess.call(['loadkeys',locale]) == 0 + return subprocess.call(['loadkeys', locale]) == 0 -- cgit v1.2.3-70-g09d2