move packages/flavour.py to flavours/

This commit is contained in:
InsanePrawn 2022-10-08 03:25:50 +02:00
parent ed4226a505
commit 777b3172d8
10 changed files with 29 additions and 26 deletions

View file

@ -10,7 +10,8 @@ from exec.file import makedir
from fastboot import fastboot_boot, fastboot_erase_dtbo
from image import get_device_name, losetup_rootfs_image, get_image_path, dump_aboot, dump_lk2nd
from devices.device import get_profile_device
from packages.flavour import get_profile_flavour, profile_option
from flavours.flavour import get_profile_flavour
from flavours.cli import profile_option
from wrapper import enforce_wrap
LK2ND = FLASH_PARTS['LK2ND']

View file

@ -138,7 +138,7 @@ def prompt_profile_device(current: Optional[str], profile_name: str) -> tuple[st
def prompt_profile_flavour(current: Optional[str], profile_name: str) -> tuple[str, bool]:
from packages.flavour import get_flavours
from flavours.flavour import get_flavours
flavours = get_flavours()
print(click.style("Pick your flavour!\nThese are the available flavours:", bold=True))
for f in sorted(flavours.keys()):

View file

@ -14,9 +14,9 @@ only used to trigger builds of the submodule docs!
config
devices
flash
flavours
forwarding
image
packages
ssh
telnet

View file

@ -10,7 +10,8 @@ from exec.file import get_temp_dir
from fastboot import fastboot_flash
from image import dd_image, partprobe, shrink_fs, losetup_rootfs_image, losetup_destroy, dump_aboot, dump_lk2nd, dump_qhypstub, get_image_name, get_image_path
from devices.device import get_profile_device
from packages.flavour import get_profile_flavour, profile_option
from flavours.flavour import get_profile_flavour
from flavours.cli import profile_option
from wrapper import enforce_wrap
ABOOT = FLASH_PARTS['ABOOT']

0
flavours/__init__.py Normal file
View file

20
flavours/cli.py Normal file
View file

@ -0,0 +1,20 @@
import click
from .flavour import get_flavours
profile_option = click.option('-p', '--profile', help="name of the profile to use", required=False, default=None)
@click.command(name='flavours')
def cmd_flavours():
'list information about available flavours'
flavours = get_flavours()
if not flavours:
raise Exception("No flavours found!")
for name in sorted(flavours.keys()):
f = flavours[name]
try:
f.parse_flavourinfo()
except:
pass
print(f)

View file

@ -1,6 +1,5 @@
from __future__ import annotations
import click
import json
import logging
import os
@ -10,10 +9,7 @@ from typing import Optional
from config import config
from constants import FLAVOUR_DESCRIPTION_PREFIX, FLAVOUR_INFO_FILE
from .pkgbuild import discover_pkgbuilds, get_pkgbuild_by_name, init_pkgbuilds, Pkgbuild
profile_option = click.option('-p', '--profile', help="name of the profile to use", required=False, default=None)
from packages.pkgbuild import discover_pkgbuilds, get_pkgbuild_by_name, init_pkgbuilds, Pkgbuild
@dataclass
@ -112,18 +108,3 @@ def get_flavour(name: str, lazy: bool = True):
def get_profile_flavour(profile_name: Optional[str] = None) -> Flavour:
profile = config.enforce_profile_flavour_set(profile_name=profile_name)
return get_flavour(profile.flavour)
@click.command(name='flavours')
def cmd_flavours():
'list information about available flavours'
flavours = get_flavours()
if not flavours:
raise Exception("No flavours found!")
for name in sorted(flavours.keys()):
f = flavours[name]
try:
f.parse_flavourinfo()
except:
pass
print(f)

View file

@ -17,7 +17,7 @@ from exec.cmd import run_root_cmd, generate_cmd_su
from exec.file import root_write_file, root_makedir, makedir
from packages.build import build_enable_qemu_binfmt, build_packages, filter_pkgbuilds
from devices.device import Device, get_profile_device
from packages.flavour import Flavour, get_profile_flavour
from flavours.flavour import Flavour, get_profile_flavour
from ssh import copy_ssh_keys
from wrapper import enforce_wrap

View file

@ -11,8 +11,8 @@ from wrapper import nowrapper_option, enforce_wrap
from config import config, config_option, cmd_config
from forwarding import cmd_forwarding
from packages.cli import cmd_packages
from flavours.cli import cmd_flavours
from devices.cli import cmd_devices
from packages.flavour import cmd_flavours
from telnet import cmd_telnet
from chroot.cli import cmd_chroot
from cache import cmd_cache