mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-23 05:35:44 -05:00
config: prompt_profile(): handle uninitialised PKGBUILDs gracefully and warn user
This commit is contained in:
parent
72d9bf3a37
commit
ba5cda7cfa
1 changed files with 12 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
|||
import click
|
||||
import logging
|
||||
import os
|
||||
|
||||
from copy import deepcopy
|
||||
from typing import Any, Iterable, Optional, Union
|
||||
|
||||
|
@ -89,6 +91,15 @@ def prompt_profile(
|
|||
raise Exception(f'Unknown profile "{name}"')
|
||||
logging.info(f'Configuring profile "{name}"')
|
||||
changed = False
|
||||
if not (no_parse or os.path.exists(os.path.join(config.get_path('pkgbuilds'), 'device'))):
|
||||
logging.warning("PKGBUILDS NOT INITIALISED:\n"
|
||||
"Usually we'd present you with detailed lists of choices for devices and flavours in this dialogue,\n"
|
||||
"but your pkgbuilds.git seem to not have been cloned yet.\n\n"
|
||||
"You can:\n1. complete the dialogue with default values for now\n"
|
||||
"2. run `kupferbootstrap packages update` afterwards\n"
|
||||
f"3. then get back to this dialogue by running `kupferbootstrap config profile init {name}`\n\n"
|
||||
"You can also use `kupferbootstrap packages flavours` and `kupferbootstrap packages devices` to list them.")
|
||||
no_parse = True
|
||||
for key, current in profile.items():
|
||||
current = profile[key]
|
||||
text = f'{name}.{key}'
|
||||
|
@ -99,7 +110,7 @@ def prompt_profile(
|
|||
elif key == 'flavour':
|
||||
parse_prompt = prompt_profile_flavour
|
||||
else:
|
||||
raise Exception(f'config: Unhanled parseable field {key}, this is a bug in kupferbootstrap.')
|
||||
raise Exception(f'config: Unhandled parseable field {key}, this is a bug in kupferbootstrap.')
|
||||
result, _changed = parse_prompt(current, name) # type: ignore
|
||||
else:
|
||||
result, _changed = prompt_config(text=text, default=current, field_type=type(PROFILE_DEFAULTS[key])) # type: ignore
|
||||
|
|
Loading…
Add table
Reference in a new issue