ScriptCollection 3.5.102__py3-none-any.whl → 3.5.104__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/GeneralUtilities.py +36 -0
- ScriptCollection/SCLog.py +67 -1
- ScriptCollection/ScriptCollectionCore.py +70 -42
- ScriptCollection/TasksForCommonProjectStructure.py +19 -29
- ScriptCollection/UpdateCertificates.py +1 -1
- {scriptcollection-3.5.102.dist-info → scriptcollection-3.5.104.dist-info}/METADATA +6 -6
- scriptcollection-3.5.104.dist-info/RECORD +16 -0
- {scriptcollection-3.5.102.dist-info → scriptcollection-3.5.104.dist-info}/WHEEL +1 -1
- ScriptCollection/RPStream.py +0 -42
- scriptcollection-3.5.102.dist-info/RECORD +0 -17
- {scriptcollection-3.5.102.dist-info → scriptcollection-3.5.104.dist-info}/entry_points.txt +0 -0
- {scriptcollection-3.5.102.dist-info → scriptcollection-3.5.104.dist-info}/top_level.txt +0 -0
@@ -21,6 +21,7 @@ from os.path import isfile, join, isdir
|
|
21
21
|
from pathlib import Path
|
22
22
|
from shutil import copyfile
|
23
23
|
import typing
|
24
|
+
import psutil
|
24
25
|
from defusedxml.minidom import parse
|
25
26
|
from OpenSSL import crypto
|
26
27
|
|
@@ -1027,3 +1028,38 @@ class GeneralUtilities:
|
|
1027
1028
|
GeneralUtilities.assert_condition("." in plain_str)
|
1028
1029
|
splitted: list[str] = plain_str.split(".")
|
1029
1030
|
return splitted[0].zfill(leading_zeroplaces)+"."+splitted[1].ljust(trailing_zeroplaces, '0')
|
1031
|
+
|
1032
|
+
@staticmethod
|
1033
|
+
@check_arguments
|
1034
|
+
def process_is_running_by_name(process_name: str) -> bool:
|
1035
|
+
processes: list[psutil.Process] = list(psutil.process_iter())
|
1036
|
+
for p in processes:
|
1037
|
+
if p.name() == process_name:
|
1038
|
+
return True
|
1039
|
+
return False
|
1040
|
+
|
1041
|
+
|
1042
|
+
@staticmethod
|
1043
|
+
@check_arguments
|
1044
|
+
def process_is_running_by_id(process_id: int) -> bool:
|
1045
|
+
processes: list[psutil.Process] = list(psutil.process_iter())
|
1046
|
+
for p in processes:
|
1047
|
+
if p.pid == process_id:
|
1048
|
+
return True
|
1049
|
+
return False
|
1050
|
+
|
1051
|
+
|
1052
|
+
@staticmethod
|
1053
|
+
@check_arguments
|
1054
|
+
def kill_process(process_id:int,include_child_processes:bool) -> bool:
|
1055
|
+
if GeneralUtilities. process_is_running_by_id(process_id):
|
1056
|
+
GeneralUtilities.write_message_to_stdout(f"Process with id {process_id} is running. Terminating it...")
|
1057
|
+
process = psutil.Process(process_id)
|
1058
|
+
if include_child_processes:
|
1059
|
+
for child in process.children(recursive=True):
|
1060
|
+
if GeneralUtilities.process_is_running_by_id(child.pid):
|
1061
|
+
child.kill()
|
1062
|
+
if GeneralUtilities.process_is_running_by_id(process_id):
|
1063
|
+
process.kill()
|
1064
|
+
else:
|
1065
|
+
GeneralUtilities.write_message_to_stdout(f"Process with id {process_id} is not running anymore.")
|
ScriptCollection/SCLog.py
CHANGED
@@ -1,2 +1,68 @@
|
|
1
|
+
|
2
|
+
from enum import Enum
|
3
|
+
from datetime import datetime
|
4
|
+
from .GeneralUtilities import GeneralUtilities
|
5
|
+
|
6
|
+
|
7
|
+
class LogLevel(Enum):
|
8
|
+
Error = 1
|
9
|
+
Warning = 2
|
10
|
+
Information = 3
|
11
|
+
Debug = 4
|
12
|
+
|
13
|
+
def __int__(self):
|
14
|
+
return self.value
|
15
|
+
|
16
|
+
|
1
17
|
class SCLog:
|
2
|
-
|
18
|
+
loglevel: LogLevel
|
19
|
+
log_file: str
|
20
|
+
add_overhead: bool
|
21
|
+
|
22
|
+
def __init__(self, log_file: str = None):
|
23
|
+
self.add_overhead = False
|
24
|
+
self.loglevel = LogLevel.Information
|
25
|
+
self.log_file = log_file
|
26
|
+
|
27
|
+
@GeneralUtilities.check_arguments
|
28
|
+
def log_exception(self, message: str, ex: Exception, current_traceback):
|
29
|
+
self.log(f"Exception: {message}; Exception-details: {str(ex)}; Traceback: {current_traceback.format_exc()}", LogLevel.Error)
|
30
|
+
|
31
|
+
@GeneralUtilities.check_arguments
|
32
|
+
def log(self, message: str, loglevel: LogLevel):
|
33
|
+
if loglevel is None:
|
34
|
+
loglevel = LogLevel.Information
|
35
|
+
|
36
|
+
if int(loglevel) > int(self.loglevel):
|
37
|
+
return
|
38
|
+
|
39
|
+
if loglevel == LogLevel.Warning:
|
40
|
+
message = f"Warning: {message}"
|
41
|
+
if self.add_overhead:
|
42
|
+
if loglevel == LogLevel.Error:
|
43
|
+
message = f"[Error] {message}"
|
44
|
+
elif loglevel == LogLevel.Warning:
|
45
|
+
message = f"[Warning] {message}"
|
46
|
+
elif loglevel == LogLevel.Debug:
|
47
|
+
message = f"[Debug] {message}"
|
48
|
+
elif loglevel == LogLevel.Information:
|
49
|
+
message = f"[Information] {message}"
|
50
|
+
else:
|
51
|
+
raise ValueError("Unknown loglevel.")
|
52
|
+
|
53
|
+
message = f"[{GeneralUtilities.datetime_to_string_for_logfile_entry(datetime.now())}] {message}"
|
54
|
+
|
55
|
+
if loglevel == LogLevel.Error:
|
56
|
+
GeneralUtilities.write_message_to_stderr(message)
|
57
|
+
elif loglevel == LogLevel.Warning:
|
58
|
+
GeneralUtilities.write_message_to_stderr(message)
|
59
|
+
elif loglevel == LogLevel.Debug:
|
60
|
+
GeneralUtilities.write_message_to_stdout(message)
|
61
|
+
elif loglevel == LogLevel.Information:
|
62
|
+
GeneralUtilities.write_message_to_stdout(message)
|
63
|
+
else:
|
64
|
+
raise ValueError("Unknown loglevel.")
|
65
|
+
|
66
|
+
if self.log_file is not None:
|
67
|
+
GeneralUtilities.ensure_file_exists(self.log_file)
|
68
|
+
GeneralUtilities.append_line_to_file(self.log_file, message)
|
@@ -33,7 +33,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
|
|
33
33
|
from .ProgramRunnerPopen import ProgramRunnerPopen
|
34
34
|
from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
|
35
35
|
|
36
|
-
version = "3.5.
|
36
|
+
version = "3.5.104"
|
37
37
|
__version__ = version
|
38
38
|
|
39
39
|
|
@@ -292,7 +292,7 @@ class ScriptCollectionCore:
|
|
292
292
|
|
293
293
|
@GeneralUtilities.check_arguments
|
294
294
|
def git_push_with_retry(self, folder: str, remotename: str, localbranchname: str, remotebranchname: str, forcepush: bool = False, pushalltags: bool = True, verbosity: int = 0, amount_of_attempts: int = 5) -> None:
|
295
|
-
GeneralUtilities.retry_action(lambda: self.git_push(folder, remotename, localbranchname, remotebranchname, forcepush, pushalltags,verbosity), amount_of_attempts)
|
295
|
+
GeneralUtilities.retry_action(lambda: self.git_push(folder, remotename, localbranchname, remotebranchname, forcepush, pushalltags, verbosity), amount_of_attempts)
|
296
296
|
|
297
297
|
@GeneralUtilities.check_arguments
|
298
298
|
def git_push(self, folder: str, remotename: str, localbranchname: str, remotebranchname: str, forcepush: bool = False, pushalltags: bool = True, verbosity: int = 0) -> None:
|
@@ -770,6 +770,74 @@ class ScriptCollectionCore:
|
|
770
770
|
if exit_code != 0:
|
771
771
|
raise ValueError(f"Fatal error occurrs while copying '{source}' to '{target}'. StdErr: '{stderr}'")
|
772
772
|
|
773
|
+
@GeneralUtilities.check_arguments
|
774
|
+
def create_file(self, path: str, error_if_already_exists: bool, create_necessary_folder: bool) -> None:
|
775
|
+
"""This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
|
776
|
+
if self.program_runner.will_be_executed_locally():
|
777
|
+
if not os.path.isabs(path):
|
778
|
+
path = os.path.join(os.getcwd(), path)
|
779
|
+
|
780
|
+
if os.path.isfile(path) and error_if_already_exists:
|
781
|
+
raise ValueError(f"File '{path}' already exists.")
|
782
|
+
|
783
|
+
# TODO maybe it should be checked if there is a folder with the same path which already exists.
|
784
|
+
|
785
|
+
folder = os.path.dirname(path)
|
786
|
+
|
787
|
+
if not os.path.isdir(folder):
|
788
|
+
if create_necessary_folder:
|
789
|
+
GeneralUtilities.ensure_directory_exists(folder) # TODO check if this also create nested folders if required
|
790
|
+
else:
|
791
|
+
raise ValueError(f"Folder '{folder}' does not exist.")
|
792
|
+
|
793
|
+
GeneralUtilities.ensure_file_exists(path)
|
794
|
+
else:
|
795
|
+
arguments = ["--path", path]
|
796
|
+
|
797
|
+
if error_if_already_exists:
|
798
|
+
arguments = arguments+["--errorwhenexists"]
|
799
|
+
|
800
|
+
if create_necessary_folder:
|
801
|
+
arguments = arguments+["--createnecessaryfolder"]
|
802
|
+
|
803
|
+
exit_code, _, stderr, _ = self.run_program_argsasarray("sccreatefile", arguments, throw_exception_if_exitcode_is_not_zero=False) # works platform-indepent
|
804
|
+
if exit_code != 0:
|
805
|
+
raise ValueError(f"Fatal error occurrs while create file '{path}'. StdErr: '{stderr}'")
|
806
|
+
|
807
|
+
@GeneralUtilities.check_arguments
|
808
|
+
def create_folder(self, path: str, error_if_already_exists: bool, create_necessary_folder: bool) -> None:
|
809
|
+
"""This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
|
810
|
+
if self.program_runner.will_be_executed_locally():
|
811
|
+
if not os.path.isabs(path):
|
812
|
+
path = os.path.join(os.getcwd(), path)
|
813
|
+
|
814
|
+
if os.path.isdir(path) and error_if_already_exists:
|
815
|
+
raise ValueError(f"Folder '{path}' already exists.")
|
816
|
+
|
817
|
+
# TODO maybe it should be checked if there is a file with the same path which already exists.
|
818
|
+
|
819
|
+
folder = os.path.dirname(path)
|
820
|
+
|
821
|
+
if not os.path.isdir(folder):
|
822
|
+
if create_necessary_folder:
|
823
|
+
GeneralUtilities.ensure_directory_exists(folder) # TODO check if this also create nested folders if required
|
824
|
+
else:
|
825
|
+
raise ValueError(f"Folder '{folder}' does not exist.")
|
826
|
+
|
827
|
+
GeneralUtilities.ensure_directory_exists(path)
|
828
|
+
else:
|
829
|
+
arguments = ["--path", path]
|
830
|
+
|
831
|
+
if error_if_already_exists:
|
832
|
+
arguments = arguments+["--errorwhenexists"]
|
833
|
+
|
834
|
+
if create_necessary_folder:
|
835
|
+
arguments = arguments+["--createnecessaryfolder"]
|
836
|
+
|
837
|
+
exit_code, _, stderr, _ = self.run_program_argsasarray("sccreatefolder", arguments, throw_exception_if_exitcode_is_not_zero=False) # works platform-indepent
|
838
|
+
if exit_code != 0:
|
839
|
+
raise ValueError(f"Fatal error occurrs while create folder '{path}'. StdErr: '{stderr}'")
|
840
|
+
|
773
841
|
@GeneralUtilities.check_arguments
|
774
842
|
def __sort_fmd(self, line: str):
|
775
843
|
splitted: list = line.split(";")
|
@@ -2203,46 +2271,6 @@ TXDX
|
|
2203
2271
|
def create_local_docker_network(self, network_name: str) -> None:
|
2204
2272
|
self.run_program("docker", f"network create {network_name}")
|
2205
2273
|
|
2206
|
-
@GeneralUtilities.check_arguments
|
2207
|
-
def create_file(self, path: str, error_if_already_exists: bool, create_necessary_folder: bool) -> None:
|
2208
|
-
if not os.path.isabs(path):
|
2209
|
-
path = os.path.join(os.getcwd(), path)
|
2210
|
-
|
2211
|
-
if os.path.isfile(path) and error_if_already_exists:
|
2212
|
-
raise ValueError(f"File '{path}' already exists.")
|
2213
|
-
|
2214
|
-
# TODO maybe it should be checked if there is a folder with the same path which already exists.
|
2215
|
-
|
2216
|
-
folder = os.path.dirname(path)
|
2217
|
-
|
2218
|
-
if not os.path.isdir(folder):
|
2219
|
-
if create_necessary_folder:
|
2220
|
-
GeneralUtilities.ensure_directory_exists(folder) # TODO check if this also create nested folders if required
|
2221
|
-
else:
|
2222
|
-
raise ValueError(f"Folder '{folder}' does not exist.")
|
2223
|
-
|
2224
|
-
GeneralUtilities.ensure_file_exists(path)
|
2225
|
-
|
2226
|
-
@GeneralUtilities.check_arguments
|
2227
|
-
def create_folder(self, path: str, error_if_already_exists: bool, create_necessary_folder: bool) -> None:
|
2228
|
-
if not os.path.isabs(path):
|
2229
|
-
path = os.path.join(os.getcwd(), path)
|
2230
|
-
|
2231
|
-
if os.path.isdir(path) and error_if_already_exists:
|
2232
|
-
raise ValueError(f"Folder '{path}' already exists.")
|
2233
|
-
|
2234
|
-
# TODO maybe it should be checked if there is a file with the same path which already exists.
|
2235
|
-
|
2236
|
-
folder = os.path.dirname(path)
|
2237
|
-
|
2238
|
-
if not os.path.isdir(folder):
|
2239
|
-
if create_necessary_folder:
|
2240
|
-
GeneralUtilities.ensure_directory_exists(folder) # TODO check if this also create nested folders if required
|
2241
|
-
else:
|
2242
|
-
raise ValueError(f"Folder '{folder}' does not exist.")
|
2243
|
-
|
2244
|
-
GeneralUtilities.ensure_directory_exists(path)
|
2245
|
-
|
2246
2274
|
@GeneralUtilities.check_arguments
|
2247
2275
|
def format_xml_file(self, file: str) -> None:
|
2248
2276
|
encoding = "utf-8"
|
@@ -1237,18 +1237,17 @@ class TasksForCommonProjectStructure:
|
|
1237
1237
|
|
1238
1238
|
@GeneralUtilities.check_arguments
|
1239
1239
|
def get_codeunits(self, repository_folder: str, ignore_disabled_codeunits: bool = True) -> list[str]:
|
1240
|
-
|
1241
|
-
|
1242
|
-
for
|
1243
|
-
|
1244
|
-
codeunit_file = os.path.join(
|
1245
|
-
if os.path.
|
1246
|
-
if (
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
return result
|
1240
|
+
codeunits_with_dependent_codeunits: dict[str, set[str]] = dict[str, set[str]]()
|
1241
|
+
subfolders = GeneralUtilities.get_direct_folders_of_folder(repository_folder)
|
1242
|
+
for subfolder in subfolders:
|
1243
|
+
codeunit_name: str = os.path.basename(subfolder)
|
1244
|
+
codeunit_file = os.path.join(subfolder, f"{codeunit_name}.codeunit.xml")
|
1245
|
+
if os.path.exists(codeunit_file):
|
1246
|
+
if ignore_disabled_codeunits and not self.codeunit_is_enabled(codeunit_file):
|
1247
|
+
continue
|
1248
|
+
codeunits_with_dependent_codeunits[codeunit_name] = self.get_dependent_code_units(codeunit_file)
|
1249
|
+
sorted_codeunits = self._internal_get_sorted_codeunits_by_dict(codeunits_with_dependent_codeunits)
|
1250
|
+
return sorted_codeunits
|
1252
1251
|
|
1253
1252
|
@GeneralUtilities.check_arguments
|
1254
1253
|
def codeunit_is_enabled(self, codeunit_file: str) -> bool:
|
@@ -2355,10 +2354,11 @@ class TasksForCommonProjectStructure:
|
|
2355
2354
|
|
2356
2355
|
if append_cli_args_at_end:
|
2357
2356
|
command_with_args = f"{command_with_args} {{{{.CLI_ARGS}}}}"
|
2357
|
+
cwd_literal = cwd.replace("\\", "\\\\")
|
2358
2358
|
lines.append(f" {name}:")
|
2359
2359
|
lines.append(f' desc: "{description}"')
|
2360
2360
|
lines.append(' silent: true')
|
2361
|
-
lines.append(f' dir: "{
|
2361
|
+
lines.append(f' dir: "{cwd_literal}"')
|
2362
2362
|
lines.append(" cmds:")
|
2363
2363
|
lines.append(f" - {command_with_args}")
|
2364
2364
|
lines.append(' aliases:')
|
@@ -2456,18 +2456,6 @@ class TasksForCommonProjectStructure:
|
|
2456
2456
|
GeneralUtilities.ensure_directory_exists(ca_target_folder)
|
2457
2457
|
GeneralUtilities.copy_content_of_folder(ca_source_folder, ca_target_folder)
|
2458
2458
|
|
2459
|
-
@GeneralUtilities.check_arguments
|
2460
|
-
def get_sorted_codeunits(self, repository_folder: str) -> list[str]:
|
2461
|
-
codeunits_with_dependent_codeunits: dict[str, set[str]] = dict[str, set[str]]()
|
2462
|
-
subfolders = GeneralUtilities.get_direct_folders_of_folder(repository_folder)
|
2463
|
-
for subfolder in subfolders:
|
2464
|
-
codeunit_name: str = os.path.basename(subfolder)
|
2465
|
-
codeunit_file = os.path.join(subfolder, f"{codeunit_name}.codeunit.xml")
|
2466
|
-
if os.path.exists(codeunit_file):
|
2467
|
-
codeunits_with_dependent_codeunits[codeunit_name] = self.get_dependent_code_units(codeunit_file)
|
2468
|
-
sorted_codeunits = self._internal_get_sorted_codeunits_by_dict(codeunits_with_dependent_codeunits)
|
2469
|
-
return sorted_codeunits
|
2470
|
-
|
2471
2459
|
@GeneralUtilities.check_arguments
|
2472
2460
|
def _internal_get_sorted_codeunits_by_dict(self, codeunits=dict[str, set[str]]) -> list[str]:
|
2473
2461
|
result_typed = list(TopologicalSorter(codeunits).static_order())
|
@@ -2525,7 +2513,7 @@ class TasksForCommonProjectStructure:
|
|
2525
2513
|
PrepareBuildCodeunits_script_name = "PrepareBuildCodeunits.py"
|
2526
2514
|
prepare_build_codeunits_scripts = os.path.join(project_resources_folder, PrepareBuildCodeunits_script_name)
|
2527
2515
|
|
2528
|
-
if do_git_clean_when_no_changes:
|
2516
|
+
if do_git_clean_when_no_changes and not self.__sc.git_repository_has_uncommitted_changes(repository_folder):
|
2529
2517
|
self.__sc.run_program("git", "clean -dfx", repository_folder)
|
2530
2518
|
if os.path.isfile(prepare_build_codeunits_scripts):
|
2531
2519
|
GeneralUtilities.write_message_to_stdout(f'Run "{PrepareBuildCodeunits_script_name}"')
|
@@ -2557,7 +2545,7 @@ class TasksForCommonProjectStructure:
|
|
2557
2545
|
codeunit_file = os.path.join(subfolder, f"{codeunit_name}.codeunit.xml")
|
2558
2546
|
GeneralUtilities.assert_condition(os.path.exists(codeunit_file), f"Codeunit-file '{codeunit_file}' does nost exist.")
|
2559
2547
|
codeunits_with_dependent_codeunits[codeunit_name] = self.get_dependent_code_units(codeunit_file)
|
2560
|
-
sorted_codeunits = self.
|
2548
|
+
sorted_codeunits = self.get_codeunits(repository_folder)
|
2561
2549
|
sorted_codeunits = [codeunit for codeunit in sorted_codeunits if codeunit in codeunits]
|
2562
2550
|
project_version = self.get_version_of_project(repository_folder)
|
2563
2551
|
|
@@ -2959,6 +2947,7 @@ class TasksForCommonProjectStructure:
|
|
2959
2947
|
self.assert_is_codeunit_folder(codeunit_folder)
|
2960
2948
|
now = datetime.now()
|
2961
2949
|
codeunit_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(codeunit_folder)
|
2950
|
+
repository_folder = GeneralUtilities.resolve_relative_path("..", codeunit_folder)
|
2962
2951
|
codeunit_name: str = os.path.basename(codeunit_folder)
|
2963
2952
|
if verbosity > 2:
|
2964
2953
|
GeneralUtilities.write_message_to_stdout(f"Start building codeunit {codeunit_name}")
|
@@ -2973,7 +2962,8 @@ class TasksForCommonProjectStructure:
|
|
2973
2962
|
|
2974
2963
|
GeneralUtilities.write_message_to_stdout(f"Start building codeunit {codeunit_name}.")
|
2975
2964
|
GeneralUtilities.write_message_to_stdout(f"Build-environmenttype: {target_environmenttype}")
|
2976
|
-
self.__sc.
|
2965
|
+
if not self.__sc.git_repository_has_uncommitted_changes(repository_folder):
|
2966
|
+
self.__sc.run_program("git", "clean -dfx", codeunit_folder)
|
2977
2967
|
|
2978
2968
|
verbosity_for_executed_programs = self.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
|
2979
2969
|
|
@@ -3079,7 +3069,7 @@ class TasksForCommonProjectStructure:
|
|
3079
3069
|
# Prepare
|
3080
3070
|
GeneralUtilities.write_message_to_stdout("Update dependencies...")
|
3081
3071
|
self.__sc.assert_is_git_repository(repository_folder)
|
3082
|
-
codeunits = self.
|
3072
|
+
codeunits = self.get_codeunits(repository_folder)
|
3083
3073
|
update_dependencies_script_filename = "UpdateDependencies.py"
|
3084
3074
|
target_environmenttype = "QualityCheck"
|
3085
3075
|
self.build_codeunits(repository_folder, target_environmenttype=target_environmenttype, do_git_clean_when_no_changes=True, note="Prepare dependency-update") # Required because update dependencies is not always possible for not-buildet codeunits (depends on the programming language or package manager)
|
@@ -27,7 +27,7 @@ class CertificateUpdater:
|
|
27
27
|
@GeneralUtilities.check_arguments
|
28
28
|
def __get_latest_index_by_domain(self, domain: str) -> int:
|
29
29
|
result = self.__get_latest_index_by_filelist(GeneralUtilities.get_all_files_of_folder(os.path.join(self.__letsencrypt_archive_folder, domain)))
|
30
|
-
GeneralUtilities.write_message_to_stdout(f"Debug: Latest found existing number for domain {domain}: {result}")
|
30
|
+
#GeneralUtilities.write_message_to_stdout(f"Debug: Latest found existing number for domain {domain}: {result}")
|
31
31
|
return result
|
32
32
|
|
33
33
|
@GeneralUtilities.check_arguments
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: ScriptCollection
|
3
|
-
Version: 3.5.
|
3
|
+
Version: 3.5.104
|
4
4
|
Summary: The ScriptCollection is the place for reusable scripts.
|
5
5
|
Home-page: https://github.com/anionDev/ScriptCollection
|
6
6
|
Author: Marius Göcke
|
@@ -23,7 +23,7 @@ Classifier: Topic :: Utilities
|
|
23
23
|
Requires-Python: >=3.10
|
24
24
|
Description-Content-Type: text/markdown
|
25
25
|
Requires-Dist: build>=1.2.2.post1
|
26
|
-
Requires-Dist: coverage>=7.
|
26
|
+
Requires-Dist: coverage>=7.8.0
|
27
27
|
Requires-Dist: cyclonedx-bom>=5.3.0
|
28
28
|
Requires-Dist: defusedxml>=0.7.1
|
29
29
|
Requires-Dist: keyboard>=0.13.5
|
@@ -33,15 +33,15 @@ Requires-Dist: ntplib>=0.4.0
|
|
33
33
|
Requires-Dist: Pillow>=11.1.0
|
34
34
|
Requires-Dist: pycdlib>=1.14.0
|
35
35
|
Requires-Dist: Pygments>=2.19.1
|
36
|
-
Requires-Dist: pylint>=3.3.
|
36
|
+
Requires-Dist: pylint>=3.3.6
|
37
37
|
Requires-Dist: pyOpenSSL>=25.0.0
|
38
38
|
Requires-Dist: PyPDF>=5.4.0
|
39
39
|
Requires-Dist: pytest>=8.3.5
|
40
40
|
Requires-Dist: PyYAML>=6.0.2
|
41
|
-
Requires-Dist: qrcode>=8.
|
41
|
+
Requires-Dist: qrcode>=8.1
|
42
42
|
Requires-Dist: send2trash>=1.8.3
|
43
43
|
Requires-Dist: twine>=6.1.0
|
44
|
-
Requires-Dist: xmlschema>=3.4.
|
44
|
+
Requires-Dist: xmlschema>=3.4.5
|
45
45
|
|
46
46
|
# ScriptCollection
|
47
47
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
ScriptCollection/Executables.py,sha256=HI9Pxs5Z9QxPGyqeJU2lWslEggFyGYANCqYVQZp6eJ0,30490
|
2
|
+
ScriptCollection/GeneralUtilities.py,sha256=jkJu6y8Wv-j_braS_0zsjF6JzDo46NshMeeAphsXGX4,43848
|
3
|
+
ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
|
4
|
+
ScriptCollection/ProgramRunnerBase.py,sha256=2kMIAqdc65UjBAddOZkzy_aFx9h5roZ5a4bQNM6RV6Y,2480
|
5
|
+
ScriptCollection/ProgramRunnerEpew.py,sha256=4pjEd0r9Fcz3TTDv0MdTSd5KkigYXcWUVI1X43regfU,6477
|
6
|
+
ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
|
7
|
+
ScriptCollection/SCLog.py,sha256=Gw27Oclcb0ten7_89PD5CdNMoO-at2hGUOYbF-x1HPQ,2296
|
8
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=08UGdNP-Ji04KIkoG_1Ks7EdbLlSpnM-dI0WBNMzrOc,125705
|
9
|
+
ScriptCollection/TasksForCommonProjectStructure.py,sha256=4EcmpWaLxfJHPSW47EXeJivk4hypqPasgbX-joj9isE,229844
|
10
|
+
ScriptCollection/UpdateCertificates.py,sha256=xRebqD2etBD7ILHL-7fg-Y-kPF0Tbmnwexv4FhwDntQ,7791
|
11
|
+
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
|
+
scriptcollection-3.5.104.dist-info/METADATA,sha256=oZ-T6ilqqw29o0VDog_vtgJvC7yYrKWd2Tm1PT_BDJE,7664
|
13
|
+
scriptcollection-3.5.104.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
14
|
+
scriptcollection-3.5.104.dist-info/entry_points.txt,sha256=fYCGWGNGijBQHhFe6UAO-BEpfEOxLyNJemukt5ElSzs,3644
|
15
|
+
scriptcollection-3.5.104.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
16
|
+
scriptcollection-3.5.104.dist-info/RECORD,,
|
ScriptCollection/RPStream.py
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import psutil
|
3
|
-
from .GeneralUtilities import GeneralUtilities
|
4
|
-
from .ProcessesRunner import ProcessStartInformation, ProcessesRunner
|
5
|
-
# streams the local libcam-vid-stream to a rtsp-server
|
6
|
-
|
7
|
-
|
8
|
-
class RPStream:
|
9
|
-
|
10
|
-
__working_directory: str = None
|
11
|
-
__pid_file: str = None
|
12
|
-
|
13
|
-
def __init__(self, working_directory: str):
|
14
|
-
self.__working_directory = working_directory
|
15
|
-
self.__pid_file = os.path.join(self.__working_directory, "pid.txt")
|
16
|
-
|
17
|
-
def __get_pid(self) -> str:
|
18
|
-
GeneralUtilities.ensure_file_exists(self.__pid_file)
|
19
|
-
return GeneralUtilities.read_text_from_file(self.__pid_file)
|
20
|
-
|
21
|
-
def __set_pid(self, pid: str):
|
22
|
-
GeneralUtilities.ensure_file_exists(self.__pid_file)
|
23
|
-
GeneralUtilities.write_text_to_file(self.__pid_file, pid)
|
24
|
-
|
25
|
-
def __ensure_previous_process_is_not_running(self):
|
26
|
-
pid = self.__get_pid()
|
27
|
-
if GeneralUtilities.string_has_content(pid):
|
28
|
-
for proc in psutil.process_iter():
|
29
|
-
if proc.pid == pid and proc.name() == "python":
|
30
|
-
proc.kill()
|
31
|
-
|
32
|
-
def __start_stream(self):
|
33
|
-
prinfo: list[ProcessStartInformation] = list[ProcessStartInformation]()
|
34
|
-
prinfo.append(ProcessStartInformation(None, "", ""))
|
35
|
-
prinfo.append(ProcessStartInformation(None, "", ""))
|
36
|
-
processesRunner: ProcessesRunner = ProcessesRunner(prinfo)
|
37
|
-
self.__set_pid(str(os.getpid()))
|
38
|
-
processesRunner.run()
|
39
|
-
|
40
|
-
def start(self):
|
41
|
-
self.__ensure_previous_process_is_not_running()
|
42
|
-
self.__start_stream()
|
@@ -1,17 +0,0 @@
|
|
1
|
-
ScriptCollection/Executables.py,sha256=HI9Pxs5Z9QxPGyqeJU2lWslEggFyGYANCqYVQZp6eJ0,30490
|
2
|
-
ScriptCollection/GeneralUtilities.py,sha256=unOZbHDqlxwPHXY1epy4gdGYwDbHEETF1XKZYPGX2hw,42429
|
3
|
-
ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
|
4
|
-
ScriptCollection/ProgramRunnerBase.py,sha256=2kMIAqdc65UjBAddOZkzy_aFx9h5roZ5a4bQNM6RV6Y,2480
|
5
|
-
ScriptCollection/ProgramRunnerEpew.py,sha256=4pjEd0r9Fcz3TTDv0MdTSd5KkigYXcWUVI1X43regfU,6477
|
6
|
-
ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
|
7
|
-
ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
|
8
|
-
ScriptCollection/SCLog.py,sha256=l4aekBiGoNkKGtvO_Er3NY_K7ts4ZWtIGlhq07I-4LY,30
|
9
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=7ZBvCfF2lM_s8XoPur8TiVvUysD1kadcWVfrW0ioELg,123984
|
10
|
-
ScriptCollection/TasksForCommonProjectStructure.py,sha256=3k8IT1ny-C9eVbZzk7VQrOaeRNrG3l0OmOZ_o03ushQ,230181
|
11
|
-
ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
|
12
|
-
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
-
scriptcollection-3.5.102.dist-info/METADATA,sha256=9AayQS3GIEdZw4dpGWfhXOR11tGd59K3Ek9e0YEYieE,7664
|
14
|
-
scriptcollection-3.5.102.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
|
15
|
-
scriptcollection-3.5.102.dist-info/entry_points.txt,sha256=fYCGWGNGijBQHhFe6UAO-BEpfEOxLyNJemukt5ElSzs,3644
|
16
|
-
scriptcollection-3.5.102.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
17
|
-
scriptcollection-3.5.102.dist-info/RECORD,,
|
File without changes
|
File without changes
|