ScriptCollection 4.2.129__py3-none-any.whl → 4.2.131__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ScriptCollection/AnionBuildPlatform.py +9 -9
- ScriptCollection/GeneralUtilities.py +4 -4
- ScriptCollection/OCIImages/OCIImageManager.py +216 -216
- ScriptCollection/ProcessesRunner.py +2 -2
- ScriptCollection/ProgramRunnerSudo.py +110 -110
- ScriptCollection/SCLog.py +6 -6
- ScriptCollection/ScriptCollectionCore.py +3706 -3706
- ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py +2 -2
- ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py +3 -3
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py +8 -8
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py +352 -352
- ScriptCollection/TFCPS/TFCPS_CreateRelease.py +18 -18
- ScriptCollection/TFCPS/TFCPS_Generic.py +44 -44
- ScriptCollection/TFCPS/TFCPS_MergeToMain.py +128 -128
- ScriptCollection/TFCPS/TFCPS_MergeToStable.py +355 -355
- ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py +6 -6
- ScriptCollection/TFCPS/TFCPS_Tools_General.py +51 -15
- ScriptCollection/UnassignedVariablesCheck.py +94 -0
- {scriptcollection-4.2.129.dist-info → scriptcollection-4.2.131.dist-info}/METADATA +1 -1
- {scriptcollection-4.2.129.dist-info → scriptcollection-4.2.131.dist-info}/RECORD +23 -22
- {scriptcollection-4.2.129.dist-info → scriptcollection-4.2.131.dist-info}/WHEEL +0 -0
- {scriptcollection-4.2.129.dist-info → scriptcollection-4.2.131.dist-info}/entry_points.txt +0 -0
- {scriptcollection-4.2.129.dist-info → scriptcollection-4.2.131.dist-info}/top_level.txt +0 -0
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
from subprocess import Popen
|
|
2
|
-
from .GeneralUtilities import GeneralUtilities
|
|
3
|
-
from .ProgramRunnerBase import ProgramRunnerBase
|
|
4
|
-
from .ScriptCollectionCore import ScriptCollectionCore
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class SudoPopenReader:
|
|
8
|
-
content: bytes = None
|
|
9
|
-
|
|
10
|
-
def __init__(self, content: bytes):
|
|
11
|
-
self.content = content
|
|
12
|
-
|
|
13
|
-
def readable(self) -> bool:
|
|
14
|
-
return True
|
|
15
|
-
|
|
16
|
-
def read(self) -> bytes:
|
|
17
|
-
return self.content
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class SudoPopen:
|
|
21
|
-
returncode: int = None
|
|
22
|
-
stdout_str: str = None
|
|
23
|
-
stderr_str: str = None
|
|
24
|
-
pid: int = None
|
|
25
|
-
stdout: bytes = None
|
|
26
|
-
stderr: bytes = None
|
|
27
|
-
|
|
28
|
-
def __init__(self, exitcode: int, stdout: str, stderr: str, pid: int):
|
|
29
|
-
self.returncode: int = exitcode
|
|
30
|
-
self.stdout_str: str = stdout
|
|
31
|
-
self.stdout = str.encode(self.stdout_str)
|
|
32
|
-
self.stderr_str: str = stderr
|
|
33
|
-
self.stderr = str.encode(self.stderr_str)
|
|
34
|
-
self.pid = pid
|
|
35
|
-
|
|
36
|
-
def communicate(self):
|
|
37
|
-
return (self.stdout, self.stderr)
|
|
38
|
-
|
|
39
|
-
def wait(self):
|
|
40
|
-
return self.returncode
|
|
41
|
-
|
|
42
|
-
def poll(self) -> object:
|
|
43
|
-
return self.returncode
|
|
44
|
-
|
|
45
|
-
def __enter__(self):
|
|
46
|
-
return self
|
|
47
|
-
|
|
48
|
-
def __exit__(self, exc_type, exc_value, traceback):
|
|
49
|
-
pass
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
class ProgramRunnerSudo(ProgramRunnerBase):
|
|
53
|
-
__sc: ScriptCollectionCore
|
|
54
|
-
__password: str
|
|
55
|
-
|
|
56
|
-
@GeneralUtilities.check_arguments
|
|
57
|
-
def __init__(self,user_password:str):
|
|
58
|
-
GeneralUtilities.assert_condition(GeneralUtilities.current_system_is_linux(), "SudoRunner can only be only executed on Linux.")
|
|
59
|
-
self.__sc = ScriptCollectionCore()
|
|
60
|
-
self.__password = user_password
|
|
61
|
-
|
|
62
|
-
@GeneralUtilities.check_arguments
|
|
63
|
-
def will_be_executed_locally(self) -> bool:
|
|
64
|
-
return True
|
|
65
|
-
|
|
66
|
-
@GeneralUtilities.check_arguments
|
|
67
|
-
def run_program_internal(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, env_vars: dict = None) -> tuple[int, str, str, int]:
|
|
68
|
-
if env_vars is not None:
|
|
69
|
-
raise ValueError("env_vars is not supported in Sudo-runner")
|
|
70
|
-
argument = program+" " + ' '.join(GeneralUtilities.args_array_surround_with_quotes_if_required(arguments_as_array))
|
|
71
|
-
argument = f"echo {self.__password} | sudo -k -S {argument}" # TODO maybe add "exit" somewhere before argument or before sudo to correctly return the exit-code"
|
|
72
|
-
result = self.__sc.run_program_argsasarray("sh", ["-c", argument], working_directory)
|
|
73
|
-
return result
|
|
74
|
-
|
|
75
|
-
@GeneralUtilities.check_arguments
|
|
76
|
-
def run_program_argsasarray_async_helper(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive: bool = False, env_vars: dict = None) -> Popen:
|
|
77
|
-
if interactive:
|
|
78
|
-
raise ValueError("Interactive execution is not supported in Sudo-runner")
|
|
79
|
-
r: tuple[int, str, str, int] = self.run_program_internal(program, arguments_as_array, working_directory, custom_argument, env_vars)
|
|
80
|
-
popen: SudoPopen = SudoPopen(r[0], r[1], r[2], r[3])
|
|
81
|
-
return popen
|
|
82
|
-
|
|
83
|
-
# Return-values program_runner: Exitcode, StdOut, StdErr, Pid
|
|
84
|
-
@GeneralUtilities.check_arguments
|
|
85
|
-
def wait(self, process: Popen, custom_argument: object) -> tuple[int, str, str, int]:
|
|
86
|
-
raise ValueError("Wait is not supported in Sudo-runner")
|
|
87
|
-
|
|
88
|
-
# Return-values program_runner: Exitcode, StdOut, StdErr, Pid
|
|
89
|
-
@GeneralUtilities.check_arguments
|
|
90
|
-
def run_program_argsasarray(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive: bool = False, env_vars: dict = None) -> tuple[int, str, str, int]:
|
|
91
|
-
if interactive:
|
|
92
|
-
raise ValueError("Interactive execution is not supported in Sudo-runner")
|
|
93
|
-
return self.run_program_internal(program, arguments_as_array, working_directory, custom_argument, env_vars)
|
|
94
|
-
|
|
95
|
-
# Return-values program_runner: Exitcode, StdOut, StdErr, Pid
|
|
96
|
-
@GeneralUtilities.check_arguments
|
|
97
|
-
def run_program(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None, interactive: bool = False, env_vars: dict = None) -> tuple[int, str, str, int]:
|
|
98
|
-
if interactive:
|
|
99
|
-
raise ValueError("Interactive execution is not supported in Sudo-runner")
|
|
100
|
-
return self.run_program_internal(program, arguments.split(" "), working_directory, custom_argument, env_vars)
|
|
101
|
-
|
|
102
|
-
# Return-values program_runner: Pid
|
|
103
|
-
@GeneralUtilities.check_arguments
|
|
104
|
-
def run_program_argsasarray_async(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive: bool = False, env_vars: dict = None) -> int:
|
|
105
|
-
raise ValueError("Async execution is not supported in Sudo-runner")
|
|
106
|
-
|
|
107
|
-
# Return-values program_runner: Pid
|
|
108
|
-
@GeneralUtilities.check_arguments
|
|
109
|
-
def run_program_async(self, program: str, arguments: str, working_directory: str, custom_argument: object, interactive: bool = False, env_vars: dict = None) -> int:
|
|
110
|
-
raise ValueError("Async execution is not supported in Sudo-runner")
|
|
1
|
+
from subprocess import Popen
|
|
2
|
+
from .GeneralUtilities import GeneralUtilities
|
|
3
|
+
from .ProgramRunnerBase import ProgramRunnerBase
|
|
4
|
+
from .ScriptCollectionCore import ScriptCollectionCore
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SudoPopenReader:
|
|
8
|
+
content: bytes = None
|
|
9
|
+
|
|
10
|
+
def __init__(self, content: bytes):
|
|
11
|
+
self.content = content
|
|
12
|
+
|
|
13
|
+
def readable(self) -> bool:
|
|
14
|
+
return True
|
|
15
|
+
|
|
16
|
+
def read(self) -> bytes:
|
|
17
|
+
return self.content
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class SudoPopen:
|
|
21
|
+
returncode: int = None
|
|
22
|
+
stdout_str: str = None
|
|
23
|
+
stderr_str: str = None
|
|
24
|
+
pid: int = None
|
|
25
|
+
stdout: bytes = None
|
|
26
|
+
stderr: bytes = None
|
|
27
|
+
|
|
28
|
+
def __init__(self, exitcode: int, stdout: str, stderr: str, pid: int):
|
|
29
|
+
self.returncode: int = exitcode
|
|
30
|
+
self.stdout_str: str = stdout
|
|
31
|
+
self.stdout = str.encode(self.stdout_str)
|
|
32
|
+
self.stderr_str: str = stderr
|
|
33
|
+
self.stderr = str.encode(self.stderr_str)
|
|
34
|
+
self.pid = pid
|
|
35
|
+
|
|
36
|
+
def communicate(self):
|
|
37
|
+
return (self.stdout, self.stderr)
|
|
38
|
+
|
|
39
|
+
def wait(self):
|
|
40
|
+
return self.returncode
|
|
41
|
+
|
|
42
|
+
def poll(self) -> object:
|
|
43
|
+
return self.returncode
|
|
44
|
+
|
|
45
|
+
def __enter__(self):
|
|
46
|
+
return self
|
|
47
|
+
|
|
48
|
+
def __exit__(self, exc_type, exc_value, traceback):
|
|
49
|
+
pass
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class ProgramRunnerSudo(ProgramRunnerBase):
|
|
53
|
+
__sc: ScriptCollectionCore = None
|
|
54
|
+
__password: str = None
|
|
55
|
+
|
|
56
|
+
@GeneralUtilities.check_arguments
|
|
57
|
+
def __init__(self,user_password:str):
|
|
58
|
+
GeneralUtilities.assert_condition(GeneralUtilities.current_system_is_linux(), "SudoRunner can only be only executed on Linux.")
|
|
59
|
+
self.__sc = ScriptCollectionCore()
|
|
60
|
+
self.__password = user_password
|
|
61
|
+
|
|
62
|
+
@GeneralUtilities.check_arguments
|
|
63
|
+
def will_be_executed_locally(self) -> bool:
|
|
64
|
+
return True
|
|
65
|
+
|
|
66
|
+
@GeneralUtilities.check_arguments
|
|
67
|
+
def run_program_internal(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, env_vars: dict = None) -> tuple[int, str, str, int]:
|
|
68
|
+
if env_vars is not None:
|
|
69
|
+
raise ValueError("env_vars is not supported in Sudo-runner")
|
|
70
|
+
argument = program+" " + ' '.join(GeneralUtilities.args_array_surround_with_quotes_if_required(arguments_as_array))
|
|
71
|
+
argument = f"echo {self.__password} | sudo -k -S {argument}" # TODO maybe add "exit" somewhere before argument or before sudo to correctly return the exit-code"
|
|
72
|
+
result = self.__sc.run_program_argsasarray("sh", ["-c", argument], working_directory)
|
|
73
|
+
return result
|
|
74
|
+
|
|
75
|
+
@GeneralUtilities.check_arguments
|
|
76
|
+
def run_program_argsasarray_async_helper(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive: bool = False, env_vars: dict = None) -> Popen:
|
|
77
|
+
if interactive:
|
|
78
|
+
raise ValueError("Interactive execution is not supported in Sudo-runner")
|
|
79
|
+
r: tuple[int, str, str, int] = self.run_program_internal(program, arguments_as_array, working_directory, custom_argument, env_vars)
|
|
80
|
+
popen: SudoPopen = SudoPopen(r[0], r[1], r[2], r[3])
|
|
81
|
+
return popen
|
|
82
|
+
|
|
83
|
+
# Return-values program_runner: Exitcode, StdOut, StdErr, Pid
|
|
84
|
+
@GeneralUtilities.check_arguments
|
|
85
|
+
def wait(self, process: Popen, custom_argument: object) -> tuple[int, str, str, int]:
|
|
86
|
+
raise ValueError("Wait is not supported in Sudo-runner")
|
|
87
|
+
|
|
88
|
+
# Return-values program_runner: Exitcode, StdOut, StdErr, Pid
|
|
89
|
+
@GeneralUtilities.check_arguments
|
|
90
|
+
def run_program_argsasarray(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive: bool = False, env_vars: dict = None) -> tuple[int, str, str, int]:
|
|
91
|
+
if interactive:
|
|
92
|
+
raise ValueError("Interactive execution is not supported in Sudo-runner")
|
|
93
|
+
return self.run_program_internal(program, arguments_as_array, working_directory, custom_argument, env_vars)
|
|
94
|
+
|
|
95
|
+
# Return-values program_runner: Exitcode, StdOut, StdErr, Pid
|
|
96
|
+
@GeneralUtilities.check_arguments
|
|
97
|
+
def run_program(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None, interactive: bool = False, env_vars: dict = None) -> tuple[int, str, str, int]:
|
|
98
|
+
if interactive:
|
|
99
|
+
raise ValueError("Interactive execution is not supported in Sudo-runner")
|
|
100
|
+
return self.run_program_internal(program, arguments.split(" "), working_directory, custom_argument, env_vars)
|
|
101
|
+
|
|
102
|
+
# Return-values program_runner: Pid
|
|
103
|
+
@GeneralUtilities.check_arguments
|
|
104
|
+
def run_program_argsasarray_async(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive: bool = False, env_vars: dict = None) -> int:
|
|
105
|
+
raise ValueError("Async execution is not supported in Sudo-runner")
|
|
106
|
+
|
|
107
|
+
# Return-values program_runner: Pid
|
|
108
|
+
@GeneralUtilities.check_arguments
|
|
109
|
+
def run_program_async(self, program: str, arguments: str, working_directory: str, custom_argument: object, interactive: bool = False, env_vars: dict = None) -> int:
|
|
110
|
+
raise ValueError("Async execution is not supported in Sudo-runner")
|
ScriptCollection/SCLog.py
CHANGED
|
@@ -17,12 +17,12 @@ class LogLevel(Enum):
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class SCLog:
|
|
20
|
-
loglevel: LogLevel#minimum loglevel
|
|
21
|
-
log_file: str
|
|
22
|
-
add_overhead_to_console: bool
|
|
23
|
-
add_overhead_to_logfile: bool
|
|
24
|
-
print_as_color: bool
|
|
25
|
-
add_milliseconds_to_logfile_entry: bool
|
|
20
|
+
loglevel: LogLevel = None #minimum loglevel
|
|
21
|
+
log_file: str = None
|
|
22
|
+
add_overhead_to_console: bool = None
|
|
23
|
+
add_overhead_to_logfile: bool = None
|
|
24
|
+
print_as_color: bool = None
|
|
25
|
+
add_milliseconds_to_logfile_entry: bool = None
|
|
26
26
|
|
|
27
27
|
def __init__(self, log_file: str = None, loglevel: LogLevel = None, print_as_color: bool = True):
|
|
28
28
|
self.log_file = log_file
|