ScriptCollection 3.5.145__py3-none-any.whl → 3.5.147__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/SCLog.py +49 -34
- ScriptCollection/ScriptCollectionCore.py +1 -1
- ScriptCollection/TasksForCommonProjectStructure.py +7 -5
- {scriptcollection-3.5.145.dist-info → scriptcollection-3.5.147.dist-info}/METADATA +1 -1
- {scriptcollection-3.5.145.dist-info → scriptcollection-3.5.147.dist-info}/RECORD +8 -8
- {scriptcollection-3.5.145.dist-info → scriptcollection-3.5.147.dist-info}/WHEEL +0 -0
- {scriptcollection-3.5.145.dist-info → scriptcollection-3.5.147.dist-info}/entry_points.txt +0 -0
- {scriptcollection-3.5.145.dist-info → scriptcollection-3.5.147.dist-info}/top_level.txt +0 -0
ScriptCollection/SCLog.py
CHANGED
@@ -19,17 +19,19 @@ class LogLevel(Enum):
|
|
19
19
|
class SCLog:
|
20
20
|
loglevel: LogLevel
|
21
21
|
log_file: str
|
22
|
-
|
22
|
+
add_overhead_to_console: bool
|
23
|
+
add_overhead_to_logfile: bool
|
23
24
|
print_as_color: bool
|
24
25
|
zone_of_time: timezone = None
|
25
26
|
|
26
|
-
def __init__(self, log_file: str = None, loglevel: LogLevel = None,
|
27
|
+
def __init__(self, log_file: str = None, loglevel: LogLevel = None,print_as_color: bool = True):
|
27
28
|
self.log_file = log_file
|
28
29
|
if loglevel is None:
|
29
30
|
self.loglevel = LogLevel.Information
|
30
31
|
else:
|
31
32
|
self.loglevel = loglevel
|
32
|
-
self.
|
33
|
+
self.add_overhead_to_console = False
|
34
|
+
self.add_overhead_to_logfile = False
|
33
35
|
self.print_as_color = print_as_color
|
34
36
|
|
35
37
|
@GeneralUtilities.check_arguments
|
@@ -43,6 +45,10 @@ class SCLog:
|
|
43
45
|
|
44
46
|
@GeneralUtilities.check_arguments
|
45
47
|
def __log_line(self, message: str, loglevel: LogLevel = None):
|
48
|
+
|
49
|
+
print_to_console:bool=True
|
50
|
+
print_to_logfile:bool=self.log_file is not None
|
51
|
+
|
46
52
|
if loglevel is None:
|
47
53
|
loglevel = LogLevel.Information
|
48
54
|
|
@@ -62,43 +68,52 @@ class SCLog:
|
|
62
68
|
part3 = f"Debug: {message}"
|
63
69
|
if loglevel == LogLevel.Diagnostic:
|
64
70
|
part3 = f"Diagnostic: {message}"
|
65
|
-
if self.add_overhead:
|
66
|
-
moment: datetime = None
|
67
|
-
if self.zone_of_time is None:
|
68
|
-
moment = datetime.now()
|
69
|
-
else:
|
70
|
-
moment = datetime.now(self.zone_of_time)
|
71
|
-
part1 = f"[{GeneralUtilities.datetime_to_string_for_logfile_entry(moment)}] ["
|
72
|
-
if loglevel == LogLevel.Information:
|
73
|
-
part2 = f"Information"
|
74
|
-
elif loglevel == LogLevel.Error:
|
75
|
-
part2 = f"Error"
|
76
|
-
elif loglevel == LogLevel.Warning:
|
77
|
-
part2 = f"Warning"
|
78
|
-
elif loglevel == LogLevel.Debug:
|
79
|
-
part2 = f"Debug"
|
80
|
-
elif loglevel == LogLevel.Diagnostic:
|
81
|
-
part2 = f"Diagnostic"
|
82
|
-
else:
|
83
|
-
raise ValueError("Unknown loglevel.")
|
84
|
-
part3 = f"] {message}"
|
85
71
|
|
86
|
-
|
87
|
-
|
72
|
+
moment: datetime = None
|
73
|
+
if self.zone_of_time is None:
|
74
|
+
moment = datetime.now()
|
75
|
+
else:
|
76
|
+
moment = datetime.now(self.zone_of_time)
|
77
|
+
|
78
|
+
part1 = f"[{GeneralUtilities.datetime_to_string_for_logfile_entry(moment)}] ["
|
88
79
|
if loglevel == LogLevel.Information:
|
89
|
-
|
80
|
+
part2 = f"Information"
|
90
81
|
elif loglevel == LogLevel.Error:
|
91
|
-
|
82
|
+
part2 = f"Error"
|
92
83
|
elif loglevel == LogLevel.Warning:
|
93
|
-
|
94
|
-
elif loglevel == LogLevel.Debug:
|
95
|
-
GeneralUtilities.print_text_in_cyan(part2, print_to_std_out, self.print_as_color)
|
84
|
+
part2 = f"Warning"
|
96
85
|
elif loglevel == LogLevel.Debug:
|
97
|
-
|
86
|
+
part2 = f"Debug"
|
87
|
+
elif loglevel == LogLevel.Diagnostic:
|
88
|
+
part2 = f"Diagnostic"
|
98
89
|
else:
|
99
90
|
raise ValueError("Unknown loglevel.")
|
100
|
-
|
91
|
+
part3 = f"] {message}"
|
92
|
+
|
93
|
+
if print_to_console:
|
94
|
+
if self.add_overhead_to_console:
|
95
|
+
print_to_std_out: bool = loglevel in (LogLevel.Debug, LogLevel.Information)
|
96
|
+
GeneralUtilities.print_text(part1, print_to_std_out)
|
97
|
+
if loglevel == LogLevel.Information:
|
98
|
+
GeneralUtilities.print_text_in_green(part2, print_to_std_out, self.print_as_color)
|
99
|
+
elif loglevel == LogLevel.Error:
|
100
|
+
GeneralUtilities.print_text_in_red(part2, print_to_std_out, self.print_as_color)
|
101
|
+
elif loglevel == LogLevel.Warning:
|
102
|
+
GeneralUtilities.print_text_in_yellow(part2, print_to_std_out, self.print_as_color)
|
103
|
+
elif loglevel == LogLevel.Debug:
|
104
|
+
GeneralUtilities.print_text_in_cyan(part2, print_to_std_out, self.print_as_color)
|
105
|
+
elif loglevel == LogLevel.Debug:
|
106
|
+
GeneralUtilities.print_text_in_cyan(part2, print_to_std_out, self.print_as_color)
|
107
|
+
else:
|
108
|
+
raise ValueError("Unknown loglevel.")
|
109
|
+
GeneralUtilities.print_text(part3+"\n", print_to_std_out)
|
110
|
+
else:
|
111
|
+
GeneralUtilities.print_text(message+"\n", print_to_std_out)
|
101
112
|
|
102
|
-
|
113
|
+
|
114
|
+
if print_to_logfile:
|
103
115
|
GeneralUtilities.ensure_file_exists(self.log_file)
|
104
|
-
|
116
|
+
if self.add_overhead_to_logfile:
|
117
|
+
GeneralUtilities.append_line_to_file(self.log_file, part1+part2+part3)
|
118
|
+
else:
|
119
|
+
GeneralUtilities.append_line_to_file(self.log_file, message)
|
@@ -2149,9 +2149,11 @@ class TasksForCommonProjectStructure:
|
|
2149
2149
|
|
2150
2150
|
@GeneralUtilities.check_arguments
|
2151
2151
|
def set_version_of_openapigenerator(self, codeunit_folder: str, used_version: str = None) -> None:
|
2152
|
-
|
2152
|
+
target_folder: str = os.path.join(codeunit_folder, "Other", "Resources", "Dependencies", "OpenAPIGenerator")
|
2153
|
+
version_file = os.path.join(target_folder, "Version.txt")
|
2153
2154
|
if used_version is None:
|
2154
2155
|
used_version = self.get_latest_version_of_openapigenerator()
|
2156
|
+
GeneralUtilities.ensure_directory_exists(target_folder)
|
2155
2157
|
GeneralUtilities.ensure_file_exists(version_file)
|
2156
2158
|
GeneralUtilities.write_text_to_file(version_file, used_version)
|
2157
2159
|
|
@@ -3411,11 +3413,11 @@ class TasksForCommonProjectStructure:
|
|
3411
3413
|
self.__sc.install_requirementstxt_file(repository_folde+"/Other/requirements.txt", verbosity)
|
3412
3414
|
|
3413
3415
|
@GeneralUtilities.check_arguments
|
3414
|
-
def update_submodule(self, repository_folder: str, submodule_name: str):
|
3416
|
+
def update_submodule(self, repository_folder: str, submodule_name: str,local_branch:str="main",remote_branch:str="main",remote:str="origin"):
|
3415
3417
|
submodule_folder = GeneralUtilities.resolve_relative_path("Other/Resources/Submodules/"+submodule_name, repository_folder)
|
3416
|
-
self.__sc.git_fetch(submodule_folder,
|
3417
|
-
self.__sc.git_checkout(submodule_folder,
|
3418
|
-
self.__sc.git_pull(submodule_folder,
|
3418
|
+
self.__sc.git_fetch(submodule_folder, remote)
|
3419
|
+
self.__sc.git_checkout(submodule_folder, local_branch)
|
3420
|
+
self.__sc.git_pull(submodule_folder, remote, local_branch, remote_branch, True)
|
3419
3421
|
current_version = self.__sc.get_semver_version_from_gitversion(repository_folder)
|
3420
3422
|
changelog_file = os.path.join(repository_folder, "Other", "Resources", "Changelog", f"v{current_version}.md")
|
3421
3423
|
if (not os.path.isfile(changelog_file)):
|
@@ -6,12 +6,12 @@ ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZ
|
|
6
6
|
ScriptCollection/ProgramRunnerBase.py,sha256=2kMIAqdc65UjBAddOZkzy_aFx9h5roZ5a4bQNM6RV6Y,2480
|
7
7
|
ScriptCollection/ProgramRunnerEpew.py,sha256=4pjEd0r9Fcz3TTDv0MdTSd5KkigYXcWUVI1X43regfU,6477
|
8
8
|
ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
|
9
|
-
ScriptCollection/SCLog.py,sha256=
|
10
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
11
|
-
ScriptCollection/TasksForCommonProjectStructure.py,sha256=
|
9
|
+
ScriptCollection/SCLog.py,sha256=VSQdklttjq1XlQMHbrlKLzNmTf1u_AevayWwhl0KBeM,4494
|
10
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=isnzIuTRVO_97Xc0NBaukbTcZeF7BA_aRwsWHqvPjkw,136482
|
11
|
+
ScriptCollection/TasksForCommonProjectStructure.py,sha256=aVwQq2kQwZmL-NAhOVo_G4ikYHsI92SGvhkmmGJlSw8,240711
|
12
12
|
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
-
scriptcollection-3.5.
|
14
|
-
scriptcollection-3.5.
|
15
|
-
scriptcollection-3.5.
|
16
|
-
scriptcollection-3.5.
|
17
|
-
scriptcollection-3.5.
|
13
|
+
scriptcollection-3.5.147.dist-info/METADATA,sha256=1rxb3N70WU29OYTWmBvSV7yHVGvs0K775qc9sHVRo0s,7694
|
14
|
+
scriptcollection-3.5.147.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
15
|
+
scriptcollection-3.5.147.dist-info/entry_points.txt,sha256=AvmVO9iyWImExpvzL3YYQ9AOEiUIN9guPRRG_W_VNWY,4116
|
16
|
+
scriptcollection-3.5.147.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
17
|
+
scriptcollection-3.5.147.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|