diff --git a/software/python-package/shepherd_sheep/__init__.py b/software/python-package/shepherd_sheep/__init__.py index aab24f68..10fb1bc6 100644 --- a/software/python-package/shepherd_sheep/__init__.py +++ b/software/python-package/shepherd_sheep/__init__.py @@ -16,15 +16,17 @@ from pathlib import Path from typing import Union -from shepherd_core.data_models import ShpModel, FirmwareDType -from shepherd_core.data_models.task import EmulationTask, FirmwareModTask +from shepherd_core.data_models import FirmwareDType +from shepherd_core.data_models import ShpModel +from shepherd_core.data_models.content import extract_firmware +from shepherd_core.data_models.content import firmware_to_hex +from shepherd_core.data_models.content import modify_firmware +from shepherd_core.data_models.task import EmulationTask +from shepherd_core.data_models.task import FirmwareModTask from shepherd_core.data_models.task import HarvestTask from shepherd_core.data_models.task import ProgrammingTask -from shepherd_core.data_models.task import prepare_task from shepherd_core.data_models.task import extract_tasks -from shepherd_core.data_models.content import extract_firmware -from shepherd_core.data_models.content import modify_firmware -from shepherd_core.data_models.content import firmware_to_hex +from shepherd_core.data_models.task import prepare_task from . import sysfs_interface from .eeprom import EEPROM @@ -53,6 +55,9 @@ "ShepherdDebug", "run_emulator", "run_harvester", + "run_programmer", + "run_firmware_mod", + "run_task", "ShepherdIOException", "log", "flatten_list", @@ -60,7 +65,7 @@ def context_stack() -> ExitStack: - """ Enables a nicer Exit-Behaviour + """Enables a nicer Exit-Behaviour Returns: an exit-stack to use optionally """ diff --git a/software/python-package/shepherd_sheep/cli.py b/software/python-package/shepherd_sheep/cli.py index 97f3aff6..932c8028 100644 --- a/software/python-package/shepherd_sheep/cli.py +++ b/software/python-package/shepherd_sheep/cli.py @@ -21,6 +21,7 @@ import gevent import yaml import zerorpc +from shepherd_core import logger as log from shepherd_core import CalibrationCape from shepherd_core.data_models import ShpModel from shepherd_core.data_models.base.cal_measurement import CalMeasurementCape @@ -30,11 +31,11 @@ from shepherd_core.data_models.testbed import ProgrammerProtocol from shepherd_core.inventory import Inventory -from shepherd_sheep.task_handling import task_handler from . import __version__ from . import run_emulator from . import run_harvester from . import run_programmer +from . import run_task from . import sysfs_interface from .eeprom import EEPROM from .eeprom import CapeData @@ -51,7 +52,7 @@ try: from periphery import GPIO except ModuleNotFoundError: - print("WARNING: Periphery-Package missing - hardware-access will not work") # noqa: T201 + log.warning("Periphery-Package missing - hardware-access will not work") # TODO: correct docs @@ -193,13 +194,12 @@ def run(mode: str, parameters: dict, verbose: int): @cli.command( short_help="Runs a task or set of tasks with provided config/task file.", ) -@click.argument( # TODO: to option - with default +@click.argument( # TODO: to option - with default "config", type=click.Path(exists=True, readable=True, file_okay=True, dir_okay=False), ) def task(config: Union[Path, ShpModel]): - task_handler(config) - + run_task(config) @cli.group(