Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-10-18 13:31:54 +0200
committerGitHub <noreply@github.com>2020-10-18 13:31:54 +0200
commit7dd38f167b05b413ad14e5e8a837a23490c0989e (patch)
treeadaf3b046fb4ee3fba6c083b4217ceec1ad42058 /archinstall
parentb6c5942da69e5eeb3db60f1af40e9f33db6800e9 (diff)
parenta69e1af4f1b13e0a47d4dc634c03b5bc383b9adc (diff)
Merge pull request #53 from Torxed/guided
Implemented early package-name-checks for guided.py
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/packages.py18
-rw-r--r--archinstall/lib/user_interaction.py8
2 files changed, 20 insertions, 6 deletions
diff --git a/archinstall/lib/packages.py b/archinstall/lib/packages.py
index 3a671784..2f5ebe94 100644
--- a/archinstall/lib/packages.py
+++ b/archinstall/lib/packages.py
@@ -1,5 +1,6 @@
import urllib.request, urllib.parse
import ssl, json
+from .exceptions import *
BASE_URL = 'https://www.archlinux.org/packages/search/json/?name={package}'
@@ -24,4 +25,19 @@ def find_packages(*names):
result = {}
for package in names:
result[package] = find_package(package)
- return result \ No newline at end of file
+ return result
+
+def validate_package_list(packages :list):
+ """
+ Validates a list of given packages.
+ Raises `RequirementError` if one or more packages are not found.
+ """
+ invalid_packages = []
+ for package in packages:
+ if not find_package(package)['results']:
+ invalid_packages.append(package)
+
+ if invalid_packages:
+ raise RequirementError(f"Invalid package names: {invalid_packages}")
+
+ return True \ No newline at end of file
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index e01859b3..0d3a12f5 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -81,11 +81,9 @@ def select_profile(options):
print(' -- (Leave blank to skip this next optional step) --')
selected_profile = input('Any particular pre-programmed profile you want to install: ')
- #print(' -- You can enter ? or help to search for more profiles --')
- #if selected_profile.lower() in ('?', 'help'):
- # filter_string = input('Search for layout containing (example: "sv-"): ')
- # new_options = search_keyboard_layout(filter_string)
- # return select_language(new_options)
+ if len(selected_profile.strip()) <= 0:
+ return None
+
if selected_profile.isdigit() and (pos := int(selected_profile)) <= len(profiles)-1:
selected_profile = profiles[pos]
elif selected_profile in options: