kupferbootstrap: add typed marker and convert non-relative imports

This commit is contained in:
InsanePrawn 2024-10-07 19:57:28 +02:00
parent d71a33bb33
commit e55fa49f31
5 changed files with 8 additions and 8 deletions

View file

@ -15,7 +15,7 @@ arches_arg_optional = click.argument('arches', type=click.Choice(ARCHES), nargs=
@cmd_binfmt.command('register', help='Register a binfmt handler with the kernel') @cmd_binfmt.command('register', help='Register a binfmt handler with the kernel')
@arches_arg @arches_arg
def cmd_register(arches: list[Arch], disable_chroot: bool = False): def cmd_register(arches: list[Arch], disable_chroot: bool = False):
from packages.build import build_enable_qemu_binfmt from ..packages.build import build_enable_qemu_binfmt
for arch in arches: for arch in arches:
build_enable_qemu_binfmt(arch) build_enable_qemu_binfmt(arch)

View file

@ -30,7 +30,7 @@ def cmd_chroot(ctx: click.Context, type: str = 'build', name: Optional[str] = No
raise Exception(f'Unknown chroot type: "{type}"') raise Exception(f'Unknown chroot type: "{type}"')
if type == 'rootfs': if type == 'rootfs':
from image.image import cmd_inspect from ..image.image import cmd_inspect
assert isinstance(cmd_inspect, click.Command) assert isinstance(cmd_inspect, click.Command)
ctx.invoke(cmd_inspect, profile=name, shell=True) ctx.invoke(cmd_inspect, profile=name, shell=True)
return return

View file

@ -205,7 +205,7 @@ def prompt_for_save(retry_ctx: Optional[click.Context] = None):
If `retry_ctx` is passed, the context's command will be reexecuted with the same arguments if the user chooses to retry. If `retry_ctx` is passed, the context's command will be reexecuted with the same arguments if the user chooses to retry.
False will still be returned as the retry is expected to either save, perform another retry or arbort. False will still be returned as the retry is expected to either save, perform another retry or arbort.
""" """
from wrapper import is_wrapped from ..wrapper import is_wrapped
if click.confirm(f'Do you want to save your changes to {config.runtime.config_file}?', default=True): if click.confirm(f'Do you want to save your changes to {config.runtime.config_file}?', default=True):
if is_wrapped(): if is_wrapped():
logging.warning("Writing to config file inside wrapper." logging.warning("Writing to config file inside wrapper."

View file

@ -8,10 +8,10 @@ import yaml
from copy import deepcopy from copy import deepcopy
from typing import ClassVar, Optional, Mapping, Union from typing import ClassVar, Optional, Mapping, Union
from kupferbootstrap.config.state import config from ..config.state import config
from kupferbootstrap.constants import Arch, BASE_DISTROS, KUPFER_HTTPS, REPOS_CONFIG_FILE, REPOSITORIES from ..constants import Arch, BASE_DISTROS, KUPFER_HTTPS, REPOS_CONFIG_FILE, REPOSITORIES
from kupferbootstrap.dictscheme import DictScheme, toml_inline_dicts, TomlPreserveInlineDictEncoder from ..dictscheme import DictScheme, toml_inline_dicts, TomlPreserveInlineDictEncoder
from kupferbootstrap.utils import sha256sum from ..utils import sha256sum
REPOS_KEY = 'repos' REPOS_KEY = 'repos'
REMOTEURL_KEY = 'remote_url' REMOTEURL_KEY = 'remote_url'
@ -142,7 +142,7 @@ def get_repo_config(
config_exists = os.path.exists(repo_config_file_path) config_exists = os.path.exists(repo_config_file_path)
if not config_exists and _current_config is None: if not config_exists and _current_config is None:
if initialize_pkgbuilds: if initialize_pkgbuilds:
from packages.pkgbuild import init_pkgbuilds from ..packages.pkgbuild import init_pkgbuilds
init_pkgbuilds(update=False) init_pkgbuilds(update=False)
return get_repo_config(initialize_pkgbuilds=False, repo_config_file=repo_config_file) return get_repo_config(initialize_pkgbuilds=False, repo_config_file=repo_config_file)
if repo_config_file is not None: if repo_config_file is not None:

View file