ScriptCollection 3.5.1__py3-none-any.whl → 3.5.3__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/Executables.py +5 -4
- ScriptCollection/ProgramRunnerBase.py +10 -5
- ScriptCollection/ProgramRunnerEpew.py +10 -10
- ScriptCollection/ProgramRunnerPopen.py +12 -9
- ScriptCollection/ScriptCollectionCore.py +475 -252
- ScriptCollection/TasksForCommonProjectStructure.py +34 -20
- {ScriptCollection-3.5.1.dist-info → ScriptCollection-3.5.3.dist-info}/METADATA +5 -5
- ScriptCollection-3.5.3.dist-info/RECORD +14 -0
- ScriptCollection-3.5.1.dist-info/RECORD +0 -14
- {ScriptCollection-3.5.1.dist-info → ScriptCollection-3.5.3.dist-info}/WHEEL +0 -0
- {ScriptCollection-3.5.1.dist-info → ScriptCollection-3.5.3.dist-info}/entry_points.txt +0 -0
- {ScriptCollection-3.5.1.dist-info → ScriptCollection-3.5.3.dist-info}/top_level.txt +0 -0
ScriptCollection/Executables.py
CHANGED
|
@@ -2,6 +2,7 @@ import os
|
|
|
2
2
|
import argparse
|
|
3
3
|
import time
|
|
4
4
|
import traceback
|
|
5
|
+
import sys
|
|
5
6
|
import keyboard
|
|
6
7
|
from .TasksForCommonProjectStructure import TasksForCommonProjectStructure
|
|
7
8
|
from .ScriptCollectionCore import ScriptCollectionCore
|
|
@@ -262,7 +263,7 @@ def BuildCodeUnit() -> int:
|
|
|
262
263
|
parser.add_argument('--additionalargumentsfile', required=False, default=None)
|
|
263
264
|
parser.add_argument('--assume_dependent_codeunits_are_already_built', type=GeneralUtilities.string_to_boolean, const=True, default=False, nargs='?')
|
|
264
265
|
args = parser.parse_args()
|
|
265
|
-
TasksForCommonProjectStructure().build_codeunit(args.codeunitfolder, int(args.verbosity), args.targetenvironment, args.additionalargumentsfile,
|
|
266
|
+
TasksForCommonProjectStructure().build_codeunit(args.codeunitfolder, int(args.verbosity), args.targetenvironment, args.additionalargumentsfile,False, None, args.assume_dependent_codeunits_are_already_built,sys.argv)
|
|
266
267
|
return 0
|
|
267
268
|
|
|
268
269
|
|
|
@@ -273,7 +274,7 @@ def BuildCodeUnits() -> int:
|
|
|
273
274
|
parser.add_argument('--targetenvironment', required=False, default="Development")
|
|
274
275
|
parser.add_argument('--additionalargumentsfile', required=False, default=None)
|
|
275
276
|
args = parser.parse_args()
|
|
276
|
-
TasksForCommonProjectStructure().build_codeunits(args.repositoryfolder, int(args.verbosity), args.targetenvironment, args.additionalargumentsfile)
|
|
277
|
+
TasksForCommonProjectStructure().build_codeunits(args.repositoryfolder, int(args.verbosity), args.targetenvironment, args.additionalargumentsfile,False,None,sys.argv)
|
|
277
278
|
return 0
|
|
278
279
|
|
|
279
280
|
|
|
@@ -286,7 +287,7 @@ def BuildCodeUnitsC() -> int:
|
|
|
286
287
|
parser.add_argument('--image', required=False, default="scbuilder:latest")
|
|
287
288
|
args = parser.parse_args()
|
|
288
289
|
GeneralUtilities.reconfigure_standrd_input_and_outputs()
|
|
289
|
-
TasksForCommonProjectStructure().build_codeunitsC(args.repositoryfolder, args.image, int(args.verbosity), args.targetenvironment, args.additionalargumentsfile)
|
|
290
|
+
TasksForCommonProjectStructure().build_codeunitsC(args.repositoryfolder, args.image, int(args.verbosity), args.targetenvironment, args.additionalargumentsfile,sys.argv)
|
|
290
291
|
return 0
|
|
291
292
|
|
|
292
293
|
|
|
@@ -317,7 +318,7 @@ def GenerateCertificate() -> int:
|
|
|
317
318
|
parser.add_argument('--days_until_expire', required=False, default=None, type=int)
|
|
318
319
|
parser.add_argument('--password', required=False, default=None)
|
|
319
320
|
args = parser.parse_args()
|
|
320
|
-
ScriptCollectionCore().generate_certificate(os.getcwd(), args.domain, args.filename, args.subj_c, args.subj_st,
|
|
321
|
+
ScriptCollectionCore().generate_certificate(os.getcwd(), args.domain, args.filename, args.subj_c, args.subj_st, args.subj_l, args.subj_o, args.subj_ou, args.days_until_expire, args.password)
|
|
321
322
|
return 0
|
|
322
323
|
|
|
323
324
|
|
|
@@ -8,7 +8,12 @@ class ProgramRunnerBase:
|
|
|
8
8
|
# Return-values program_runner: Pid
|
|
9
9
|
@abstractmethod
|
|
10
10
|
@GeneralUtilities.check_arguments
|
|
11
|
-
def run_program_argsasarray_async_helper(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None) -> Popen:
|
|
11
|
+
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) -> Popen:
|
|
12
|
+
# Verbosity:
|
|
13
|
+
# 0=Quiet (No output will be printed.)
|
|
14
|
+
# 1=Normal (If the exitcode of the executed program is not 0 then the StdErr will be printed.)
|
|
15
|
+
# 2=Full (Prints StdOut and StdErr of the executed program.)
|
|
16
|
+
# 3=Verbose (Same as "Full" but with some more information.)
|
|
12
17
|
raise NotImplementedError
|
|
13
18
|
|
|
14
19
|
# Return-values program_runner: Exitcode, StdOut, StdErr, Pid
|
|
@@ -20,23 +25,23 @@ class ProgramRunnerBase:
|
|
|
20
25
|
# Return-values program_runner: Exitcode, StdOut, StdErr, Pid
|
|
21
26
|
@abstractmethod
|
|
22
27
|
@GeneralUtilities.check_arguments
|
|
23
|
-
def run_program_argsasarray(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None) -> tuple[int, str, str, int]:
|
|
28
|
+
def run_program_argsasarray(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> tuple[int, str, str, int]:
|
|
24
29
|
raise NotImplementedError
|
|
25
30
|
|
|
26
31
|
# Return-values program_runner: Exitcode, StdOut, StdErr, Pid
|
|
27
32
|
@abstractmethod
|
|
28
33
|
@GeneralUtilities.check_arguments
|
|
29
|
-
def run_program(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None) -> tuple[int, str, str, int]:
|
|
34
|
+
def run_program(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> tuple[int, str, str, int]:
|
|
30
35
|
raise NotImplementedError
|
|
31
36
|
|
|
32
37
|
# Return-values program_runner: Pid
|
|
33
38
|
@abstractmethod
|
|
34
39
|
@GeneralUtilities.check_arguments
|
|
35
|
-
def run_program_argsasarray_async(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None) -> int:
|
|
40
|
+
def run_program_argsasarray_async(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> int:
|
|
36
41
|
raise NotImplementedError
|
|
37
42
|
|
|
38
43
|
# Return-values program_runner: Pid
|
|
39
44
|
@abstractmethod
|
|
40
45
|
@GeneralUtilities.check_arguments
|
|
41
|
-
def run_program_async(self, program: str, arguments: str, working_directory: str, custom_argument: object) -> int:
|
|
46
|
+
def run_program_async(self, program: str, arguments: str, working_directory: str, custom_argument: object, interactive:bool=False) -> int:
|
|
42
47
|
raise NotImplementedError
|
|
@@ -39,7 +39,7 @@ class CustomEpewArgument:
|
|
|
39
39
|
class ProgramRunnerEpew(ProgramRunnerBase):
|
|
40
40
|
|
|
41
41
|
@GeneralUtilities.check_arguments
|
|
42
|
-
def run_program_argsasarray_async_helper(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None) -> Popen:
|
|
42
|
+
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) -> Popen:
|
|
43
43
|
if GeneralUtilities.epew_is_available():
|
|
44
44
|
custom_argument: CustomEpewArgument = custom_argument
|
|
45
45
|
args = []
|
|
@@ -67,7 +67,7 @@ class ProgramRunnerEpew(ProgramRunnerBase):
|
|
|
67
67
|
if custom_argument.addLogOverhead:
|
|
68
68
|
args.append("-g")
|
|
69
69
|
args.append("-v "+str(custom_argument.verbosity))
|
|
70
|
-
return ProgramRunnerPopen().run_program_argsasarray_async_helper("epew", args, working_directory)
|
|
70
|
+
return ProgramRunnerPopen().run_program_argsasarray_async_helper("epew", args, working_directory,custom_argument,interactive)
|
|
71
71
|
else:
|
|
72
72
|
raise ValueError("Epew is not available.")
|
|
73
73
|
|
|
@@ -85,21 +85,21 @@ class ProgramRunnerEpew(ProgramRunnerBase):
|
|
|
85
85
|
return result
|
|
86
86
|
|
|
87
87
|
@GeneralUtilities.check_arguments
|
|
88
|
-
def run_program_argsasarray(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None) -> tuple[int, str, str, int]:
|
|
89
|
-
process: Popen = self.run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, custom_argument)
|
|
88
|
+
def run_program_argsasarray(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> tuple[int, str, str, int]:
|
|
89
|
+
process: Popen = self.run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, custom_argument,interactive)
|
|
90
90
|
return self.wait(process, custom_argument)
|
|
91
91
|
|
|
92
92
|
@GeneralUtilities.check_arguments
|
|
93
|
-
def run_program(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None) -> tuple[int, str, str, int]:
|
|
94
|
-
return self.run_program_argsasarray(program, GeneralUtilities.arguments_to_array(arguments), working_directory, custom_argument)
|
|
93
|
+
def run_program(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> tuple[int, str, str, int]:
|
|
94
|
+
return self.run_program_argsasarray(program, GeneralUtilities.arguments_to_array(arguments), working_directory, custom_argument,interactive)
|
|
95
95
|
|
|
96
96
|
@GeneralUtilities.check_arguments
|
|
97
|
-
def run_program_argsasarray_async(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None) -> int:
|
|
98
|
-
return self.run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, custom_argument).pid
|
|
97
|
+
def run_program_argsasarray_async(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> int:
|
|
98
|
+
return self.run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, custom_argument,interactive).pid
|
|
99
99
|
|
|
100
100
|
@GeneralUtilities.check_arguments
|
|
101
|
-
def run_program_async(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None) -> int:
|
|
102
|
-
return self.run_program_argsasarray_async(program, GeneralUtilities.arguments_to_array(arguments), working_directory, custom_argument)
|
|
101
|
+
def run_program_async(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> int:
|
|
102
|
+
return self.run_program_argsasarray_async(program, GeneralUtilities.arguments_to_array(arguments), working_directory, custom_argument,interactive)
|
|
103
103
|
|
|
104
104
|
@GeneralUtilities.check_arguments
|
|
105
105
|
def __get_number_from_filecontent(self, filecontent: str) -> int:
|
|
@@ -7,14 +7,17 @@ from .ProgramRunnerBase import ProgramRunnerBase
|
|
|
7
7
|
class ProgramRunnerPopen(ProgramRunnerBase):
|
|
8
8
|
|
|
9
9
|
@GeneralUtilities.check_arguments
|
|
10
|
-
def run_program_argsasarray_async_helper(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None) -> Popen:
|
|
10
|
+
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) -> Popen:
|
|
11
11
|
arguments_for_process = [program]
|
|
12
12
|
arguments_for_process.extend(arguments_as_array)
|
|
13
13
|
# "shell=True" is not allowed because it is not recommended and also something like
|
|
14
14
|
# "ScriptCollectionCore().run_program('curl', 'https://example.com/dataset?id=1&format=json')"
|
|
15
15
|
# would not be possible anymore because the ampersand will be treated as shell-command.
|
|
16
16
|
try:
|
|
17
|
-
|
|
17
|
+
if interactive:
|
|
18
|
+
result = Popen(arguments_for_process, cwd=working_directory , stdout=PIPE, stderr=PIPE, shell=False, stdin = sys.stdin) # pylint: disable=consider-using-with
|
|
19
|
+
else:
|
|
20
|
+
result = Popen(arguments_for_process, cwd=working_directory, stdout=PIPE, stderr=PIPE, shell=False) # pylint: disable=consider-using-with
|
|
18
21
|
except FileNotFoundError as fileNotFoundError:
|
|
19
22
|
raise FileNotFoundError(f"Starting '{program}' in '{working_directory}' resulted in a FileNotFoundError: '{fileNotFoundError.filename}'")
|
|
20
23
|
return result
|
|
@@ -31,18 +34,18 @@ class ProgramRunnerPopen(ProgramRunnerBase):
|
|
|
31
34
|
return result
|
|
32
35
|
|
|
33
36
|
@GeneralUtilities.check_arguments
|
|
34
|
-
def run_program_argsasarray(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None) -> tuple[int, str, str, int]:
|
|
35
|
-
process: Popen = self.run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, custom_argument)
|
|
37
|
+
def run_program_argsasarray(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> tuple[int, str, str, int]:
|
|
38
|
+
process: Popen = self.run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, custom_argument,interactive)
|
|
36
39
|
return self.wait(process, custom_argument)
|
|
37
40
|
|
|
38
41
|
@GeneralUtilities.check_arguments
|
|
39
|
-
def run_program(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None) -> tuple[int, str, str, int]:
|
|
42
|
+
def run_program(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> tuple[int, str, str, int]:
|
|
40
43
|
return self.run_program_argsasarray(program, GeneralUtilities.arguments_to_array(arguments), working_directory, custom_argument)
|
|
41
44
|
|
|
42
45
|
@GeneralUtilities.check_arguments
|
|
43
|
-
def run_program_argsasarray_async(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None) -> int:
|
|
44
|
-
return self.run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, custom_argument).pid
|
|
46
|
+
def run_program_argsasarray_async(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> int:
|
|
47
|
+
return self.run_program_argsasarray_async_helper(program, arguments_as_array, working_directory, custom_argument,interactive).pid
|
|
45
48
|
|
|
46
49
|
@GeneralUtilities.check_arguments
|
|
47
|
-
def run_program_async(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None) -> int:
|
|
48
|
-
return self.run_program_argsasarray_async(program, GeneralUtilities.arguments_to_array(arguments), working_directory, custom_argument)
|
|
50
|
+
def run_program_async(self, program: str, arguments: str = "", working_directory: str = None, custom_argument: object = None, interactive:bool=False) -> int:
|
|
51
|
+
return self.run_program_argsasarray_async(program, GeneralUtilities.arguments_to_array(arguments), working_directory, custom_argument,interactive)
|