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 26
26
from orthw .utils .required import require_initialized
27
27
28
28
29
- def find (package_id : str ) -> int :
29
+ def find (package_id : str ) -> None :
30
30
require_initialized ()
31
31
32
32
ort_config_package_configurations_dir : Path = config .ort_config_package_configurations_dir
Original file line number Diff line number Diff line change 19
19
from pathlib import Path
20
20
21
21
import click
22
- from docker .models .containers import Container
23
22
24
23
from orthw .utils import logging
25
24
from orthw .utils .cmdgroups import command_group
@@ -31,7 +30,7 @@ def scan(
31
30
output_dir : str | None = None ,
32
31
format_ : str = "JSON" ,
33
32
docker : bool = False ,
34
- ) -> int | Container :
33
+ ) -> int :
35
34
"""Runs ORT Scanner on given source code directory to detect licenses and copyrights
36
35
37
36
Args:
Original file line number Diff line number Diff line change 20
20
import pkgutil
21
21
import sys
22
22
from pathlib import Path
23
+ from typing import Any
23
24
24
25
import click
25
26
@@ -42,7 +43,7 @@ def __init__(self) -> None:
42
43
43
44
for module in pkgutil .iter_modules ():
44
45
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
46
47
self .module_import (path )
47
48
48
49
def module_import (self , path : Path ) -> None :
@@ -76,7 +77,7 @@ def run(self) -> int:
76
77
return 1
77
78
78
79
@property
79
- def commands (self ) -> list [ click . MultiCommand ] | None :
80
+ def commands (self ) -> Any :
80
81
"""Return the dynamic commands from plugins"""
81
82
return command_group ().commands ()
82
83
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ def run(
34
34
workdir : Path | None = None ,
35
35
output_dir : Path | None = None ,
36
36
is_docker : bool = False ,
37
- ) -> int | Container :
37
+ ) -> int :
38
38
"""Run a process with defined arguments in the proper setting for bare metal or docker
39
39
40
40
Args:
@@ -68,12 +68,15 @@ def run(
68
68
sys .exit (1 )
69
69
70
70
if is_docker :
71
- return _run_in_docker (
71
+ container : Container = _run_in_docker (
72
72
args ,
73
73
console_output = console_output ,
74
74
workdir = workdir ,
75
75
output_dir = output_dir ,
76
76
)
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
77
80
else :
78
81
return __run_host (
79
82
args ,
@@ -100,7 +103,7 @@ def __run_host(
100
103
workdir (Path | None, optional): Work directory.
101
104
output_dir (Path | None, optional): Output dir is necessary to pass along.
102
105
Returns:
103
- int: _description_
106
+ int: Run status code
104
107
"""
105
108
if admin ():
106
109
logging .error ("This script is not allowed to run as admin." )
You can’t perform that action at this time.
0 commit comments