ScriptCollection 3.5.146__py3-none-any.whl → 3.5.148__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 +48 -34
- ScriptCollection/ScriptCollectionCore.py +1 -1
- ScriptCollection/TasksForCommonProjectStructure.py +4 -4
- {scriptcollection-3.5.146.dist-info → scriptcollection-3.5.148.dist-info}/METADATA +1 -1
- {scriptcollection-3.5.146.dist-info → scriptcollection-3.5.148.dist-info}/RECORD +8 -8
- {scriptcollection-3.5.146.dist-info → scriptcollection-3.5.148.dist-info}/WHEEL +0 -0
- {scriptcollection-3.5.146.dist-info → scriptcollection-3.5.148.dist-info}/entry_points.txt +0 -0
- {scriptcollection-3.5.146.dist-info → scriptcollection-3.5.148.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,51 @@ 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
|
+
print_to_std_out: bool = loglevel in (LogLevel.Debug, LogLevel.Information)
|
95
|
+
if self.add_overhead_to_console:
|
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
|
-
if
|
113
|
+
if print_to_logfile:
|
103
114
|
GeneralUtilities.ensure_file_exists(self.log_file)
|
104
|
-
|
115
|
+
if self.add_overhead_to_logfile:
|
116
|
+
GeneralUtilities.append_line_to_file(self.log_file, part1+part2+part3)
|
117
|
+
else:
|
118
|
+
GeneralUtilities.append_line_to_file(self.log_file, message)
|
@@ -3413,11 +3413,11 @@ class TasksForCommonProjectStructure:
|
|
3413
3413
|
self.__sc.install_requirementstxt_file(repository_folde+"/Other/requirements.txt", verbosity)
|
3414
3414
|
|
3415
3415
|
@GeneralUtilities.check_arguments
|
3416
|
-
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"):
|
3417
3417
|
submodule_folder = GeneralUtilities.resolve_relative_path("Other/Resources/Submodules/"+submodule_name, repository_folder)
|
3418
|
-
self.__sc.git_fetch(submodule_folder,
|
3419
|
-
self.__sc.git_checkout(submodule_folder,
|
3420
|
-
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)
|
3421
3421
|
current_version = self.__sc.get_semver_version_from_gitversion(repository_folder)
|
3422
3422
|
changelog_file = os.path.join(repository_folder, "Other", "Resources", "Changelog", f"v{current_version}.md")
|
3423
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=GJ44S6VaBVwX5Dd6MIrdZn6I0dpaaYKVq9w-N0nMXlo,4496
|
10
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=ue-SRkt8EVrFEXTqSJ-g0V-EtaxbN67jbI1J3T3Lk_g,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.148.dist-info/METADATA,sha256=5LUruhTUIaiA13P-RyZTSV_OSgRma7YCEpMuyO4KKG4,7694
|
14
|
+
scriptcollection-3.5.148.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
15
|
+
scriptcollection-3.5.148.dist-info/entry_points.txt,sha256=AvmVO9iyWImExpvzL3YYQ9AOEiUIN9guPRRG_W_VNWY,4116
|
16
|
+
scriptcollection-3.5.148.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
17
|
+
scriptcollection-3.5.148.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|