File tree Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 2626from orthw .utils .required import require_initialized
2727
2828
29- def find (package_id : str ) -> int :
29+ def find (package_id : str ) -> None :
3030 require_initialized ()
3131
3232 ort_config_package_configurations_dir : Path = config .ort_config_package_configurations_dir
Original file line number Diff line number Diff line change 1919from pathlib import Path
2020
2121import click
22- from docker .models .containers import Container
2322
2423from orthw .utils import logging
2524from orthw .utils .cmdgroups import command_group
@@ -31,7 +30,7 @@ def scan(
3130 output_dir : str | None = None ,
3231 format_ : str = "JSON" ,
3332 docker : bool = False ,
34- ) -> int | Container :
33+ ) -> int :
3534 """Runs ORT Scanner on given source code directory to detect licenses and copyrights
3635
3736 Args:
Original file line number Diff line number Diff line change 2020import pkgutil
2121import sys
2222from pathlib import Path
23+ from typing import Any
2324
2425import click
2526
@@ -42,7 +43,7 @@ def __init__(self) -> None:
4243
4344 for module in pkgutil .iter_modules ():
4445 if module .name .startswith ("orthw" ) and hasattr (module .module_finder , "path" ):
45- path = Path (module .module_finder .path ) / module .name / "commands"
46+ path = Path (module .module_finder .path ) / module .name / "commands" # pyright: ignore
4647 self .module_import (path )
4748
4849 def module_import (self , path : Path ) -> None :
@@ -76,7 +77,7 @@ def run(self) -> int:
7677 return 1
7778
7879 @property
79- def commands (self ) -> list [ click . MultiCommand ] | None :
80+ def commands (self ) -> Any :
8081 """Return the dynamic commands from plugins"""
8182 return command_group ().commands ()
8283
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ def run(
3434 workdir : Path | None = None ,
3535 output_dir : Path | None = None ,
3636 is_docker : bool = False ,
37- ) -> int | Container :
37+ ) -> int :
3838 """Run a process with defined arguments in the proper setting for bare metal or docker
3939
4040 Args:
@@ -68,12 +68,15 @@ def run(
6868 sys .exit (1 )
6969
7070 if is_docker :
71- return _run_in_docker (
71+ container : Container = _run_in_docker (
7272 args ,
7373 console_output = console_output ,
7474 workdir = workdir ,
7575 output_dir = output_dir ,
7676 )
77+ result = container .wait () # Wait for the container to finish
78+ exit_code : int = result .get ("StatusCode" , 1 ) # Get the exit code, default to 1 on error
79+ return exit_code
7780 else :
7881 return __run_host (
7982 args ,
@@ -100,7 +103,7 @@ def __run_host(
100103 workdir (Path | None, optional): Work directory.
101104 output_dir (Path | None, optional): Output dir is necessary to pass along.
102105 Returns:
103- int: _description_
106+ int: Run status code
104107 """
105108 if admin ():
106109 logging .error ("This script is not allowed to run as admin." )
You can’t perform that action at this time.
0 commit comments