ScriptCollection 3.5.46__py3-none-any.whl → 3.5.48__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/ScriptCollectionCore.py +44 -27
- ScriptCollection/TasksForCommonProjectStructure.py +36 -21
- {ScriptCollection-3.5.46.dist-info → ScriptCollection-3.5.48.dist-info}/METADATA +1 -1
- {ScriptCollection-3.5.46.dist-info → ScriptCollection-3.5.48.dist-info}/RECORD +7 -7
- {ScriptCollection-3.5.46.dist-info → ScriptCollection-3.5.48.dist-info}/WHEEL +0 -0
- {ScriptCollection-3.5.46.dist-info → ScriptCollection-3.5.48.dist-info}/entry_points.txt +0 -0
- {ScriptCollection-3.5.46.dist-info → ScriptCollection-3.5.48.dist-info}/top_level.txt +0 -0
|
@@ -31,7 +31,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
|
|
|
31
31
|
from .ProgramRunnerPopen import ProgramRunnerPopen
|
|
32
32
|
from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
|
|
33
33
|
|
|
34
|
-
version = "3.5.
|
|
34
|
+
version = "3.5.48"
|
|
35
35
|
__version__ = version
|
|
36
36
|
|
|
37
37
|
|
|
@@ -117,38 +117,38 @@ class ScriptCollectionCore:
|
|
|
117
117
|
self.run_program("dotnet", f"nuget push {nupkg_file_name} --force-english-output --source {registry_address} --api-key {api_key}", nupkg_file_folder, verbosity)
|
|
118
118
|
|
|
119
119
|
@GeneralUtilities.check_arguments
|
|
120
|
-
def dotnet_build(self,
|
|
121
|
-
self.run_program("dotnet", f"clean -c {configuration}",
|
|
122
|
-
self.run_program("dotnet", f"build {projectname}/{projectname}.csproj -c {configuration}",
|
|
120
|
+
def dotnet_build(self, folder: str, projectname: str, configuration: str):
|
|
121
|
+
self.run_program("dotnet", f"clean -c {configuration}", folder)
|
|
122
|
+
self.run_program("dotnet", f"build {projectname}/{projectname}.csproj -c {configuration}", folder)
|
|
123
123
|
|
|
124
124
|
@GeneralUtilities.check_arguments
|
|
125
|
-
def find_file_by_extension(self, folder: str,
|
|
126
|
-
result = [file for file in GeneralUtilities.get_direct_files_of_folder(folder) if file.endswith(f".{
|
|
125
|
+
def find_file_by_extension(self, folder: str, extension_without_dot: str):
|
|
126
|
+
result = [file for file in GeneralUtilities.get_direct_files_of_folder(folder) if file.endswith(f".{extension_without_dot}")]
|
|
127
127
|
result_length = len(result)
|
|
128
128
|
if result_length == 0:
|
|
129
|
-
raise FileNotFoundError(f"No file available in folder '{folder}' with extension '{
|
|
129
|
+
raise FileNotFoundError(f"No file available in folder '{folder}' with extension '{extension_without_dot}'.")
|
|
130
130
|
if result_length == 1:
|
|
131
131
|
return result[0]
|
|
132
132
|
else:
|
|
133
|
-
raise ValueError(f"Multiple values available in folder '{folder}' with extension '{
|
|
133
|
+
raise ValueError(f"Multiple values available in folder '{folder}' with extension '{extension_without_dot}'.")
|
|
134
134
|
|
|
135
135
|
@GeneralUtilities.check_arguments
|
|
136
|
-
def
|
|
136
|
+
def find_last_file_by_extension(self, folder: str, extension_without_dot: str) -> str:
|
|
137
137
|
files: list[str] = GeneralUtilities.get_direct_files_of_folder(folder)
|
|
138
138
|
possible_results: list[str] = []
|
|
139
139
|
for file in files:
|
|
140
|
-
if file.endswith(f".{
|
|
140
|
+
if file.endswith(f".{extension_without_dot}"):
|
|
141
141
|
possible_results.append(file)
|
|
142
142
|
result_length = len(possible_results)
|
|
143
143
|
if result_length == 0:
|
|
144
|
-
raise FileNotFoundError(f"No file available in folder '{folder}' with extension '{
|
|
144
|
+
raise FileNotFoundError(f"No file available in folder '{folder}' with extension '{extension_without_dot}'.")
|
|
145
145
|
else:
|
|
146
146
|
return possible_results[-1]
|
|
147
147
|
|
|
148
148
|
@GeneralUtilities.check_arguments
|
|
149
149
|
def commit_is_signed_by_key(self, repository_folder: str, revision_identifier: str, key: str) -> bool:
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
151
|
+
result = self.run_program("git", f"verify-commit {revision_identifier}", repository_folder, throw_exception_if_exitcode_is_not_zero=False)
|
|
152
152
|
if (result[0] != 0):
|
|
153
153
|
return False
|
|
154
154
|
if (not GeneralUtilities.contains_line(result[1].splitlines(), f"gpg\\:\\ using\\ [A-Za-z0-9]+\\ key\\ [A-Za-z0-9]+{key}")):
|
|
@@ -161,10 +161,12 @@ class ScriptCollectionCore:
|
|
|
161
161
|
|
|
162
162
|
@GeneralUtilities.check_arguments
|
|
163
163
|
def get_parent_commit_ids_of_commit(self, repository_folder: str, commit_id: str) -> str:
|
|
164
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
164
165
|
return self.run_program("git", f'log --pretty=%P -n 1 "{commit_id}"', repository_folder, throw_exception_if_exitcode_is_not_zero=True)[1].replace("\r", "").replace("\n", "").split(" ")
|
|
165
166
|
|
|
166
167
|
@GeneralUtilities.check_arguments
|
|
167
168
|
def get_all_authors_and_committers_of_repository(self, repository_folder: str, subfolder: str = None, verbosity: int = 1) -> list[tuple[str, str]]:
|
|
169
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
168
170
|
space_character = "_"
|
|
169
171
|
if subfolder is None:
|
|
170
172
|
subfolder_argument = ""
|
|
@@ -184,6 +186,7 @@ class ScriptCollectionCore:
|
|
|
184
186
|
|
|
185
187
|
@GeneralUtilities.check_arguments
|
|
186
188
|
def get_commit_ids_between_dates(self, repository_folder: str, since: datetime, until: datetime, ignore_commits_which_are_not_in_history_of_head: bool = True) -> None:
|
|
189
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
187
190
|
since_as_string = self.__datetime_to_string_for_git(since)
|
|
188
191
|
until_as_string = self.__datetime_to_string_for_git(until)
|
|
189
192
|
result = filter(lambda line: not GeneralUtilities.string_is_none_or_whitespace(line), self.run_program("git", f'log --since "{since_as_string}" --until "{until_as_string}" --pretty=format:"%H" --no-patch', repository_folder, throw_exception_if_exitcode_is_not_zero=True)[1].split("\n").replace("\r", ""))
|
|
@@ -198,6 +201,7 @@ class ScriptCollectionCore:
|
|
|
198
201
|
|
|
199
202
|
@GeneralUtilities.check_arguments
|
|
200
203
|
def git_commit_is_ancestor(self, repository_folder: str, ancestor: str, descendant: str = "HEAD") -> bool:
|
|
204
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
201
205
|
result = self.run_program_argsasarray("git", ["merge-base", "--is-ancestor", ancestor, descendant], repository_folder, throw_exception_if_exitcode_is_not_zero=False)
|
|
202
206
|
exit_code = result[0]
|
|
203
207
|
if exit_code == 0:
|
|
@@ -209,6 +213,7 @@ class ScriptCollectionCore:
|
|
|
209
213
|
|
|
210
214
|
@GeneralUtilities.check_arguments
|
|
211
215
|
def __git_changes_helper(self, repository_folder: str, arguments_as_array: list[str]) -> bool:
|
|
216
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
212
217
|
lines = GeneralUtilities.string_to_lines(self.run_program_argsasarray("git", arguments_as_array, repository_folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)[1], False)
|
|
213
218
|
for line in lines:
|
|
214
219
|
if GeneralUtilities.string_has_content(line):
|
|
@@ -216,27 +221,32 @@ class ScriptCollectionCore:
|
|
|
216
221
|
return False
|
|
217
222
|
|
|
218
223
|
@GeneralUtilities.check_arguments
|
|
219
|
-
def git_repository_has_new_untracked_files(self,
|
|
220
|
-
|
|
224
|
+
def git_repository_has_new_untracked_files(self, repository_folder: str):
|
|
225
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
226
|
+
return self.__git_changes_helper(repository_folder, ["ls-files", "--exclude-standard", "--others"])
|
|
221
227
|
|
|
222
228
|
@GeneralUtilities.check_arguments
|
|
223
|
-
def git_repository_has_unstaged_changes_of_tracked_files(self,
|
|
224
|
-
|
|
229
|
+
def git_repository_has_unstaged_changes_of_tracked_files(self, repository_folder: str):
|
|
230
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
231
|
+
return self.__git_changes_helper(repository_folder, ["--no-pager", "diff"])
|
|
225
232
|
|
|
226
233
|
@GeneralUtilities.check_arguments
|
|
227
|
-
def git_repository_has_staged_changes(self,
|
|
228
|
-
|
|
234
|
+
def git_repository_has_staged_changes(self, repository_folder: str):
|
|
235
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
236
|
+
return self.__git_changes_helper(repository_folder, ["--no-pager", "diff", "--cached"])
|
|
229
237
|
|
|
230
238
|
@GeneralUtilities.check_arguments
|
|
231
|
-
def git_repository_has_uncommitted_changes(self,
|
|
232
|
-
|
|
239
|
+
def git_repository_has_uncommitted_changes(self, repository_folder: str) -> bool:
|
|
240
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
241
|
+
if (self.git_repository_has_unstaged_changes(repository_folder)):
|
|
233
242
|
return True
|
|
234
|
-
if (self.git_repository_has_staged_changes(
|
|
243
|
+
if (self.git_repository_has_staged_changes(repository_folder)):
|
|
235
244
|
return True
|
|
236
245
|
return False
|
|
237
246
|
|
|
238
247
|
@GeneralUtilities.check_arguments
|
|
239
248
|
def git_repository_has_unstaged_changes(self, repository_folder: str) -> bool:
|
|
249
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
240
250
|
if (self.git_repository_has_unstaged_changes_of_tracked_files(repository_folder)):
|
|
241
251
|
return True
|
|
242
252
|
if (self.git_repository_has_new_untracked_files(repository_folder)):
|
|
@@ -245,11 +255,13 @@ class ScriptCollectionCore:
|
|
|
245
255
|
|
|
246
256
|
@GeneralUtilities.check_arguments
|
|
247
257
|
def git_get_commit_id(self, repository_folder: str, commit: str = "HEAD") -> str:
|
|
258
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
248
259
|
result: tuple[int, str, str, int] = self.run_program_argsasarray("git", ["rev-parse", "--verify", commit], repository_folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
|
|
249
260
|
return result[1].replace('\n', '')
|
|
250
261
|
|
|
251
262
|
@GeneralUtilities.check_arguments
|
|
252
263
|
def git_get_commit_date(self, repository_folder: str, commit: str = "HEAD") -> datetime:
|
|
264
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
253
265
|
result: tuple[int, str, str, int] = self.run_program_argsasarray("git", ["show", "-s", "--format=%ci", commit], repository_folder, throw_exception_if_exitcode_is_not_zero=True, verbosity=0)
|
|
254
266
|
date_as_string = result[1].replace('\n', '')
|
|
255
267
|
result = datetime.strptime(date_as_string, '%Y-%m-%d %H:%M:%S %z')
|
|
@@ -524,25 +536,28 @@ class ScriptCollectionCore:
|
|
|
524
536
|
|
|
525
537
|
@GeneralUtilities.check_arguments
|
|
526
538
|
def get_current_git_branch_has_tag(self, repository_folder: str) -> bool:
|
|
539
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
527
540
|
result = self.run_program_argsasarray("git", ["describe", "--tags", "--abbrev=0"], repository_folder, verbosity=0, throw_exception_if_exitcode_is_not_zero=False)
|
|
528
541
|
return result[0] == 0
|
|
529
542
|
|
|
530
543
|
@GeneralUtilities.check_arguments
|
|
531
544
|
def get_latest_git_tag(self, repository_folder: str) -> str:
|
|
532
|
-
|
|
533
|
-
|
|
545
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
546
|
+
result = self.run_program_argsasarray("git", ["describe", "--tags", "--abbrev=0"], repository_folder, verbosity=0)
|
|
534
547
|
result = result[1].replace("\r", "").replace("\n", "")
|
|
535
548
|
return result
|
|
536
549
|
|
|
537
550
|
@GeneralUtilities.check_arguments
|
|
538
551
|
def get_staged_or_committed_git_ignored_files(self, repository_folder: str) -> list[str]:
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
552
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
553
|
+
temp_result = self.run_program_argsasarray("git", ["ls-files", "-i", "-c", "--exclude-standard"], repository_folder, verbosity=0)
|
|
554
|
+
temp_result = temp_result[1].replace("\r", "")
|
|
555
|
+
result = [line for line in temp_result.split("\n") if len(line) > 0]
|
|
542
556
|
return result
|
|
543
557
|
|
|
544
558
|
@GeneralUtilities.check_arguments
|
|
545
559
|
def git_repository_has_commits(self, repository_folder: str) -> bool:
|
|
560
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
546
561
|
return self.run_program_argsasarray("git", ["rev-parse", "--verify", "HEAD"], repository_folder, throw_exception_if_exitcode_is_not_zero=False)[0] == 0
|
|
547
562
|
|
|
548
563
|
@GeneralUtilities.check_arguments
|
|
@@ -1107,6 +1122,7 @@ class ScriptCollectionCore:
|
|
|
1107
1122
|
return tor_version
|
|
1108
1123
|
|
|
1109
1124
|
def run_testcases_for_python_project(self, repository_folder: str):
|
|
1125
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1110
1126
|
self.run_program("coverage", "run -m pytest", repository_folder)
|
|
1111
1127
|
self.run_program("coverage", "xml", repository_folder)
|
|
1112
1128
|
GeneralUtilities.ensure_directory_exists(os.path.join(repository_folder, "Other/TestCoverage"))
|
|
@@ -1513,6 +1529,7 @@ class ScriptCollectionCore:
|
|
|
1513
1529
|
|
|
1514
1530
|
@GeneralUtilities.check_arguments
|
|
1515
1531
|
def get_semver_version_from_gitversion(self, repository_folder: str) -> str:
|
|
1532
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1516
1533
|
if (self.git_repository_has_commits(repository_folder)):
|
|
1517
1534
|
result = self.get_version_from_gitversion(repository_folder, "MajorMinorPatch")
|
|
1518
1535
|
if self.git_repository_has_uncommitted_changes(repository_folder):
|
|
@@ -39,6 +39,7 @@ class CreateReleaseConfiguration():
|
|
|
39
39
|
|
|
40
40
|
def __init__(self, projectname: str, remotename: str, build_artifacts_target_folder: str, push_artifacts_scripts_folder: str, verbosity: int, repository_folder: str, additional_arguments_file: str, repository_folder_name: str):
|
|
41
41
|
|
|
42
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
42
43
|
self.__sc = ScriptCollectionCore()
|
|
43
44
|
self.projectname = projectname
|
|
44
45
|
self.remotename = remotename
|
|
@@ -134,14 +135,17 @@ class TasksForCommonProjectStructure:
|
|
|
134
135
|
|
|
135
136
|
@GeneralUtilities.check_arguments
|
|
136
137
|
def get_build_folder(self, repository_folder: str, codeunit_name: str) -> str:
|
|
138
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
137
139
|
return os.path.join(repository_folder, codeunit_name, "Other", "Build")
|
|
138
140
|
|
|
139
141
|
@GeneralUtilities.check_arguments
|
|
140
142
|
def get_artifacts_folder(self, repository_folder: str, codeunit_name: str) -> str:
|
|
143
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
141
144
|
return os.path.join(repository_folder, codeunit_name, "Other", "Artifacts")
|
|
142
145
|
|
|
143
146
|
@GeneralUtilities.check_arguments
|
|
144
147
|
def get_wheel_file(self, repository_folder: str, codeunit_name: str) -> str:
|
|
148
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
145
149
|
return self.__sc.find_file_by_extension(os.path.join(self.get_artifacts_folder(repository_folder, codeunit_name), "BuildResult_Wheel"), "whl")
|
|
146
150
|
|
|
147
151
|
@GeneralUtilities.check_arguments
|
|
@@ -171,6 +175,7 @@ class TasksForCommonProjectStructure:
|
|
|
171
175
|
|
|
172
176
|
@GeneralUtilities.check_arguments
|
|
173
177
|
def check_testcoverage(self, testcoverage_file_in_cobertura_format: str, repository_folder: str, codeunitname: str) -> None:
|
|
178
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
174
179
|
GeneralUtilities.write_message_to_stdout("Check testcoverage..")
|
|
175
180
|
root: etree._ElementTree = etree.parse(testcoverage_file_in_cobertura_format)
|
|
176
181
|
if len(root.xpath('//coverage/packages/package')) != 1:
|
|
@@ -338,8 +343,7 @@ class TasksForCommonProjectStructure:
|
|
|
338
343
|
@GeneralUtilities.check_arguments
|
|
339
344
|
def get_version_of_codeunit_file_content(self, codeunit_file_content: str) -> str:
|
|
340
345
|
root: etree._ElementTree = etree.fromstring(codeunit_file_content.encode("utf-8"))
|
|
341
|
-
result = str(root.xpath('//cps:version/text()',
|
|
342
|
-
namespaces={'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure'})[0])
|
|
346
|
+
result = str(root.xpath('//cps:version/text()', namespaces={'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure'})[0])
|
|
343
347
|
return result
|
|
344
348
|
|
|
345
349
|
@GeneralUtilities.check_arguments
|
|
@@ -628,6 +632,7 @@ class TasksForCommonProjectStructure:
|
|
|
628
632
|
|
|
629
633
|
@GeneralUtilities.check_arguments
|
|
630
634
|
def __standardized_tasks_build_for_dotnet_build(self, csproj_file: str, originaloutputfolder: str, files_to_sign: dict[str, str], commitid: str, verbosity: int, runtimes: list[str], target_environmenttype: str, target_environmenttype_mapping: dict[str, str], copy_license_file_to_target_folder: bool, repository_folder: str, codeunit_name: str, commandline_arguments: list[str]) -> None:
|
|
635
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
631
636
|
csproj_filename = os.path.basename(csproj_file)
|
|
632
637
|
GeneralUtilities.write_message_to_stdout(f"Build {csproj_filename}...")
|
|
633
638
|
dotnet_build_configuration: str = target_environmenttype_mapping[target_environmenttype]
|
|
@@ -676,8 +681,7 @@ class TasksForCommonProjectStructure:
|
|
|
676
681
|
# this function builds an exe
|
|
677
682
|
target_environmenttype = self.get_targetenvironmenttype_from_commandline_arguments(commandline_arguments, default_target_environmenttype)
|
|
678
683
|
self.__standardized_tasks_build_for_dotnet_project(
|
|
679
|
-
buildscript_file, target_environmenttype_mapping, default_target_environmenttype, verbosity, target_environmenttype,
|
|
680
|
-
runtimes, True, commandline_arguments)
|
|
684
|
+
buildscript_file, target_environmenttype_mapping, default_target_environmenttype, verbosity, target_environmenttype, runtimes, True, commandline_arguments)
|
|
681
685
|
|
|
682
686
|
@GeneralUtilities.check_arguments
|
|
683
687
|
def standardized_tasks_build_for_dotnet_library_project(self, buildscript_file: str, default_target_environmenttype: str, target_environmenttype_mapping: dict[str, str], runtimes: list[str], verbosity: int, commandline_arguments: list[str]) -> None:
|
|
@@ -778,6 +782,7 @@ class TasksForCommonProjectStructure:
|
|
|
778
782
|
This script expectes that the testcoverage-reportfolder is '<repositorybasefolder>/<codeunitname>/Other/Artifacts/TestCoverageReport'.
|
|
779
783
|
This script expectes that a test-coverage-badges should be added to '<repositorybasefolder>/<codeunitname>/Other/Resources/Badges'."""
|
|
780
784
|
GeneralUtilities.write_message_to_stdout("Generate testcoverage report..")
|
|
785
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
781
786
|
codeunit_version = self.get_version_of_codeunit(os.path.join(repository_folder, codeunitname, f"{codeunitname}.codeunit.xml"))
|
|
782
787
|
verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
|
|
783
788
|
if verbosity == 0:
|
|
@@ -847,6 +852,7 @@ class TasksForCommonProjectStructure:
|
|
|
847
852
|
|
|
848
853
|
@GeneralUtilities.check_arguments
|
|
849
854
|
def run_testcases_common_post_task(self, repository_folder: str, codeunit_name: str, verbosity: int, generate_badges: bool, targetenvironmenttype: str, commandline_arguments: list[str]) -> None:
|
|
855
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
850
856
|
coverage_file_folder = os.path.join(repository_folder, codeunit_name, "Other/Artifacts/TestCoverage")
|
|
851
857
|
coveragefiletarget = os.path.join(coverage_file_folder, "TestCoverage.xml")
|
|
852
858
|
self.update_path_of_source_in_testcoverage_file(repository_folder, codeunit_name)
|
|
@@ -856,6 +862,7 @@ class TasksForCommonProjectStructure:
|
|
|
856
862
|
@staticmethod
|
|
857
863
|
@GeneralUtilities.check_arguments
|
|
858
864
|
def update_path_of_source_in_testcoverage_file(repository_folder: str, codeunitname: str) -> None:
|
|
865
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
859
866
|
GeneralUtilities.write_message_to_stdout("Update paths of source files in testcoverage files..")
|
|
860
867
|
folder = f"{repository_folder}/{codeunitname}/Other/Artifacts/TestCoverage"
|
|
861
868
|
filename = "TestCoverage.xml"
|
|
@@ -875,6 +882,7 @@ class TasksForCommonProjectStructure:
|
|
|
875
882
|
@staticmethod
|
|
876
883
|
@GeneralUtilities.check_arguments
|
|
877
884
|
def __remove_not_existing_files_from_testcoverage_file(testcoveragefile: str, repository_folder: str, codeunit_name: str) -> None:
|
|
885
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
878
886
|
root: etree._ElementTree = etree.parse(testcoveragefile)
|
|
879
887
|
codeunit_folder = os.path.join(repository_folder, codeunit_name)
|
|
880
888
|
xpath = f"//coverage/packages/package[@name='{codeunit_name}']/classes/class"
|
|
@@ -1131,6 +1139,7 @@ class TasksForCommonProjectStructure:
|
|
|
1131
1139
|
|
|
1132
1140
|
@GeneralUtilities.check_arguments
|
|
1133
1141
|
def generate_certificate_for_development_purposes_for_product(self, repository_folder: str):
|
|
1142
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1134
1143
|
product_name = os.path.basename(repository_folder)
|
|
1135
1144
|
ca_folder: str = os.path.join(repository_folder, "Other", "Resources", "CA")
|
|
1136
1145
|
self.__generate_certificate_for_development_purposes(product_name, os.path.join(repository_folder, "Other", "Resources"), ca_folder, None)
|
|
@@ -1171,7 +1180,7 @@ class TasksForCommonProjectStructure:
|
|
|
1171
1180
|
GeneralUtilities.write_message_to_stdout("Generate TLS-certificate for development-purposes.")
|
|
1172
1181
|
self.__sc.generate_certificate(certificate_folder, domain, resource_content_filename, "DE", "SubjST", "SubjL", "SubjO", "SubjOU")
|
|
1173
1182
|
self.__sc.generate_certificate_sign_request(certificate_folder, domain, resource_content_filename, "DE", "SubjST", "SubjL", "SubjO", "SubjOU")
|
|
1174
|
-
ca_name = os.path.basename(self.__sc.
|
|
1183
|
+
ca_name = os.path.basename(self.__sc.find_last_file_by_extension(ca_folder, "crt"))[:-4]
|
|
1175
1184
|
self.__sc.sign_certificate(certificate_folder, ca_folder, ca_name, domain, resource_content_filename)
|
|
1176
1185
|
GeneralUtilities.ensure_file_does_not_exist(unsignedcertificate_file)
|
|
1177
1186
|
|
|
@@ -1227,7 +1236,7 @@ class TasksForCommonProjectStructure:
|
|
|
1227
1236
|
raise ValueError(f"Can not merge because the source-branch and the target-branch are on the same commit (commit-id: {src_branch_commit_id})")
|
|
1228
1237
|
|
|
1229
1238
|
self.__sc.git_checkout(repository_folder, source_branch)
|
|
1230
|
-
self.build_codeunits(repository_folder, verbosity,
|
|
1239
|
+
self.build_codeunits(repository_folder, verbosity, TasksForCommonProjectStructure.get_qualitycheck_environment_name(), additional_arguments_file, True, None, [], True)
|
|
1231
1240
|
self.__sc.git_merge(repository_folder, source_branch, target_branch, False, False, None)
|
|
1232
1241
|
self.__sc.git_commit(repository_folder, f'Merge branch {source_branch} into {target_branch}', stage_all_changes=True, no_changes_behavior=1)
|
|
1233
1242
|
self.__sc.git_checkout(repository_folder, target_branch)
|
|
@@ -1423,6 +1432,7 @@ class TasksForCommonProjectStructure:
|
|
|
1423
1432
|
raise ValueError('An empty array as argument for the "commandline_arguments"-parameter is not valid.')
|
|
1424
1433
|
commandline_arguments = commandline_arguments[1:]
|
|
1425
1434
|
repository_folder: str = str(Path(os.path.dirname(common_tasks_scripts_file)).parent.parent.absolute())
|
|
1435
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1426
1436
|
codeunit_name: str = str(os.path.basename(Path(os.path.dirname(common_tasks_scripts_file)).parent.absolute()))
|
|
1427
1437
|
verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
|
|
1428
1438
|
project_version = self.get_version_of_project(repository_folder)
|
|
@@ -1435,8 +1445,7 @@ class TasksForCommonProjectStructure:
|
|
|
1435
1445
|
if not os.path.isfile(codeunit_file):
|
|
1436
1446
|
raise ValueError(f'Codeunitfile "{codeunit_file}" does not exist.')
|
|
1437
1447
|
# TODO implement usage of self.reference_latest_version_of_xsd_when_generating_xml
|
|
1438
|
-
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure',
|
|
1439
|
-
'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
1448
|
+
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
1440
1449
|
root: etree._ElementTree = etree.parse(codeunit_file)
|
|
1441
1450
|
|
|
1442
1451
|
# Check codeunit-spcecification-version
|
|
@@ -1544,6 +1553,7 @@ class TasksForCommonProjectStructure:
|
|
|
1544
1553
|
|
|
1545
1554
|
@GeneralUtilities.check_arguments
|
|
1546
1555
|
def __suport_information_exists(self, repository_folder: str, version_of_product: str) -> bool:
|
|
1556
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1547
1557
|
folder = os.path.join(repository_folder, "Other", "Resources", "Support")
|
|
1548
1558
|
file = os.path.join(folder, "InformationAboutSupportedVersions.csv")
|
|
1549
1559
|
if not os.path.isfile(file):
|
|
@@ -1556,6 +1566,7 @@ class TasksForCommonProjectStructure:
|
|
|
1556
1566
|
|
|
1557
1567
|
@GeneralUtilities.check_arguments
|
|
1558
1568
|
def get_versions(self, repository_folder: str) -> list[(str, datetime, datetime)]:
|
|
1569
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1559
1570
|
folder = os.path.join(repository_folder, "Other", "Resources", "Support")
|
|
1560
1571
|
file = os.path.join(folder, "InformationAboutSupportedVersions.csv")
|
|
1561
1572
|
result: list[str] = list[(str, datetime, datetime)]()
|
|
@@ -1568,6 +1579,7 @@ class TasksForCommonProjectStructure:
|
|
|
1568
1579
|
|
|
1569
1580
|
@GeneralUtilities.check_arguments
|
|
1570
1581
|
def get_supported_versions(self, repository_folder: str, moment: datetime) -> list[(str, datetime, datetime)]:
|
|
1582
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1571
1583
|
result: list[str] = list[(str, datetime, datetime)]()
|
|
1572
1584
|
for entry in self.get_versions(repository_folder):
|
|
1573
1585
|
if entry[1] <= moment and moment <= entry[2]:
|
|
@@ -1576,6 +1588,7 @@ class TasksForCommonProjectStructure:
|
|
|
1576
1588
|
|
|
1577
1589
|
@GeneralUtilities.check_arguments
|
|
1578
1590
|
def get_unsupported_versions(self, repository_folder: str, moment: datetime) -> list[(str, datetime, datetime)]:
|
|
1591
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1579
1592
|
result: list[str] = list[(str, datetime, datetime)]()
|
|
1580
1593
|
for entry in self.get_versions(repository_folder):
|
|
1581
1594
|
if not (entry[1] <= moment and moment <= entry[2]):
|
|
@@ -1584,6 +1597,7 @@ class TasksForCommonProjectStructure:
|
|
|
1584
1597
|
|
|
1585
1598
|
@GeneralUtilities.check_arguments
|
|
1586
1599
|
def mark_current_version_as_supported(self, repository_folder: str, version_of_product: str, supported_from: datetime, supported_until: datetime):
|
|
1600
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1587
1601
|
if self.__suport_information_exists(repository_folder, version_of_product):
|
|
1588
1602
|
raise ValueError(f"Version-support for v{version_of_product} already defined.")
|
|
1589
1603
|
folder = os.path.join(repository_folder, "Other", "Resources", "Support")
|
|
@@ -1596,22 +1610,21 @@ class TasksForCommonProjectStructure:
|
|
|
1596
1610
|
|
|
1597
1611
|
@GeneralUtilities.check_arguments
|
|
1598
1612
|
def get_codeunit_owner_name(self, codeunit_file: str) -> None:
|
|
1599
|
-
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure',
|
|
1600
|
-
'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
1613
|
+
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
1601
1614
|
root: etree._ElementTree = etree.parse(codeunit_file)
|
|
1602
1615
|
result = root.xpath('//cps:codeunit/cps:codeunitownername/text()', namespaces=namespaces)[0]
|
|
1603
1616
|
return result
|
|
1604
1617
|
|
|
1605
1618
|
@GeneralUtilities.check_arguments
|
|
1606
1619
|
def get_codeunit_owner_emailaddress(self, codeunit_file: str) -> None:
|
|
1607
|
-
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure',
|
|
1608
|
-
'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
1620
|
+
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
1609
1621
|
root: etree._ElementTree = etree.parse(codeunit_file)
|
|
1610
1622
|
result = root.xpath('//cps:codeunit/cps:codeunitowneremailaddress/text()', namespaces=namespaces)[0]
|
|
1611
1623
|
return result
|
|
1612
1624
|
|
|
1613
1625
|
@GeneralUtilities.check_arguments
|
|
1614
1626
|
def generate_diff_report(self, repository_folder: str, codeunit_name: str, current_version: str) -> None:
|
|
1627
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
1615
1628
|
codeunit_folder = os.path.join(repository_folder, codeunit_name)
|
|
1616
1629
|
target_folder = GeneralUtilities.resolve_relative_path("Other/Artifacts/DiffReport", codeunit_folder)
|
|
1617
1630
|
GeneralUtilities.ensure_directory_does_not_exist(target_folder)
|
|
@@ -2114,6 +2127,7 @@ class TasksForCommonProjectStructure:
|
|
|
2114
2127
|
|
|
2115
2128
|
@GeneralUtilities.check_arguments
|
|
2116
2129
|
def add_github_release(self, productname: str, projectversion: str, build_artifacts_folder: str, github_username: str, repository_folder: str, commandline_arguments: list[str]) -> None:
|
|
2130
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2117
2131
|
GeneralUtilities.write_message_to_stdout(f"Create GitHub-release for {productname}.")
|
|
2118
2132
|
verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, 1)
|
|
2119
2133
|
github_repo = f"{github_username}/{productname}"
|
|
@@ -2126,8 +2140,7 @@ class TasksForCommonProjectStructure:
|
|
|
2126
2140
|
|
|
2127
2141
|
@GeneralUtilities.check_arguments
|
|
2128
2142
|
def get_dependencies_which_are_ignored_from_updates(self, codeunit_folder: str, print_warnings_for_ignored_dependencies: bool) -> list[str]:
|
|
2129
|
-
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure',
|
|
2130
|
-
'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
2143
|
+
namespaces = {'cps': 'https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/tree/main/Conventions/RepositoryStructure/CommonProjectStructure', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
2131
2144
|
codeunit_name = os.path.basename(codeunit_folder)
|
|
2132
2145
|
codeunit_file = os.path.join(codeunit_folder, f"{codeunit_name}.codeunit.xml")
|
|
2133
2146
|
root: etree._ElementTree = etree.parse(codeunit_file)
|
|
@@ -2200,6 +2213,7 @@ class TasksForCommonProjectStructure:
|
|
|
2200
2213
|
|
|
2201
2214
|
@GeneralUtilities.check_arguments
|
|
2202
2215
|
def generate_tasksfile_from_workspace_file(self, repository_folder: str, append_cli_args_at_end: bool = False) -> None:
|
|
2216
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2203
2217
|
sc: ScriptCollectionCore = ScriptCollectionCore()
|
|
2204
2218
|
workspace_file: str = sc.find_file_by_extension(repository_folder, "code-workspace")
|
|
2205
2219
|
task_file: str = os.path.join(repository_folder, "Taskfile.yml")
|
|
@@ -2342,6 +2356,7 @@ class TasksForCommonProjectStructure:
|
|
|
2342
2356
|
|
|
2343
2357
|
@GeneralUtilities.check_arguments
|
|
2344
2358
|
def get_project_name(self, repository_folder: str) -> str:
|
|
2359
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2345
2360
|
for file in GeneralUtilities.get_direct_files_of_folder(repository_folder):
|
|
2346
2361
|
if file.endswith(".code-workspace"):
|
|
2347
2362
|
return Path(file).stem
|
|
@@ -2361,6 +2376,7 @@ class TasksForCommonProjectStructure:
|
|
|
2361
2376
|
|
|
2362
2377
|
@GeneralUtilities.check_arguments
|
|
2363
2378
|
def build_codeunitsC(self, repository_folder: str, image: str, verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None, commandlinearguments: list[str] = []) -> None:
|
|
2379
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2364
2380
|
if target_environmenttype == "Development":
|
|
2365
2381
|
raise ValueError(f"build_codeunitsC is not available for target_environmenttype {target_environmenttype}.")
|
|
2366
2382
|
# TODO handle additional_arguments_file
|
|
@@ -2371,13 +2387,14 @@ class TasksForCommonProjectStructure:
|
|
|
2371
2387
|
@GeneralUtilities.check_arguments
|
|
2372
2388
|
def build_codeunits(self, repository_folder: str, verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None, is_pre_merge: bool = False, export_target_directory: str = None, commandline_arguments: list[str] = [], do_git_clean_when_no_changes: bool = False) -> None:
|
|
2373
2389
|
self.__check_target_environmenttype(target_environmenttype)
|
|
2374
|
-
repository_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(repository_folder)
|
|
2375
2390
|
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2391
|
+
repository_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(repository_folder)
|
|
2376
2392
|
codeunits = self.get_codeunits(repository_folder, False)
|
|
2377
2393
|
self.build_specific_codeunits(repository_folder, codeunits, verbosity, target_environmenttype, additional_arguments_file, is_pre_merge, export_target_directory, False, commandline_arguments, do_git_clean_when_no_changes)
|
|
2378
2394
|
|
|
2379
2395
|
@GeneralUtilities.check_arguments
|
|
2380
2396
|
def build_specific_codeunits(self, repository_folder: str, codeunits: list[str], verbosity: int = 1, target_environmenttype: str = "QualityCheck", additional_arguments_file: str = None, is_pre_merge: bool = False, export_target_directory: str = None, assume_dependent_codeunits_are_already_built: bool = True, commandline_arguments: list[str] = [], do_git_clean_when_no_changes: bool = False) -> None:
|
|
2397
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2381
2398
|
self.__check_target_environmenttype(target_environmenttype)
|
|
2382
2399
|
repository_folder = GeneralUtilities.resolve_relative_path_from_current_working_directory(repository_folder)
|
|
2383
2400
|
contains_uncommitted_changes = self.__sc.git_repository_has_uncommitted_changes(repository_folder)
|
|
@@ -2449,19 +2466,15 @@ class TasksForCommonProjectStructure:
|
|
|
2449
2466
|
|
|
2450
2467
|
@GeneralUtilities.check_arguments
|
|
2451
2468
|
def __do_repository_checks(self, repository_folder: str, project_version: str) -> None:
|
|
2452
|
-
|
|
2469
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2453
2470
|
self.__check_if_changelog_exists(repository_folder, project_version)
|
|
2454
2471
|
self.__check_whether_security_txt_exists(repository_folder)
|
|
2455
2472
|
self.__check_whether_workspace_file_exists(repository_folder)
|
|
2456
2473
|
self.__check_for_staged_or_committed_ignored_files(repository_folder)
|
|
2457
2474
|
|
|
2458
|
-
@GeneralUtilities.check_arguments
|
|
2459
|
-
def __check_if_folder_is_git_repository(self, repository_folder: str) -> None:
|
|
2460
|
-
if (not self.__sc.is_git_repository(repository_folder)):
|
|
2461
|
-
raise ValueError(f"Folder {repository_folder} is not a git-repository")
|
|
2462
|
-
|
|
2463
2475
|
@GeneralUtilities.check_arguments
|
|
2464
2476
|
def __check_if_changelog_exists(self, repository_folder: str, project_version: str) -> None:
|
|
2477
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2465
2478
|
changelog_folder = os.path.join(repository_folder, "Other", "Resources", "Changelog")
|
|
2466
2479
|
changelog_file = os.path.join(changelog_folder, f"v{project_version}.md")
|
|
2467
2480
|
if not os.path.isfile(changelog_file):
|
|
@@ -2800,6 +2813,7 @@ class TasksForCommonProjectStructure:
|
|
|
2800
2813
|
@GeneralUtilities.check_arguments
|
|
2801
2814
|
def generic_update_dependencies(self, repository_folder: str, verbosity: int = 1):
|
|
2802
2815
|
# Prepare
|
|
2816
|
+
GeneralUtilities.assert_is_git_repository(repository_folder)
|
|
2803
2817
|
codeunits = self.get_codeunits(repository_folder)
|
|
2804
2818
|
updated_dependencies = False
|
|
2805
2819
|
update_dependencies_script_filename = "UpdateDependencies.py"
|
|
@@ -2955,6 +2969,7 @@ class TasksForCommonProjectStructure:
|
|
|
2955
2969
|
|
|
2956
2970
|
@GeneralUtilities.check_arguments
|
|
2957
2971
|
def create_changelog_entry(self, repositoryfolder: str, message: str, commit: bool):
|
|
2972
|
+
GeneralUtilities.assert_is_git_repository(repositoryfolder)
|
|
2958
2973
|
current_version = self.get_version_of_project(repositoryfolder)
|
|
2959
2974
|
changelog_file = os.path.join(repositoryfolder, "Other", "Resources", "Changelog", f"v{current_version}.md")
|
|
2960
2975
|
if os.path.isdir(changelog_file):
|
|
@@ -5,12 +5,12 @@ ScriptCollection/ProgramRunnerBase.py,sha256=7QAjoqOz6XPmJH19F2k-Z1fFQB_uZnPFvn-
|
|
|
5
5
|
ScriptCollection/ProgramRunnerEpew.py,sha256=C2Rs3YWOWWWJct7XmKphp5CF1tf0j4Fp-ljV2drLTfs,6349
|
|
6
6
|
ScriptCollection/ProgramRunnerPopen.py,sha256=UGWUK0345DmtnD1gsKa1B3tBLDzKKXUGnSbIuCSWzLU,3714
|
|
7
7
|
ScriptCollection/RPStream.py,sha256=NRRHL3YSP3D9MuAV2jB_--0KUKCsvJGxeKnxgrRZ9kY,1545
|
|
8
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
|
9
|
-
ScriptCollection/TasksForCommonProjectStructure.py,sha256=
|
|
8
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=8aoN36g4-uqj5KAcz4jLtL5DBbHZDnNkLQlBS3EYy8o,105123
|
|
9
|
+
ScriptCollection/TasksForCommonProjectStructure.py,sha256=FCWMbqkmtXGulMoXuOGMRdEi9xN5hU4-U_YlVIy9kE4,210066
|
|
10
10
|
ScriptCollection/UpdateCertificates.py,sha256=Eynbgu7k9jLxApP2D_8Il77B6BFjJap6K7oTeEAZYbk,7790
|
|
11
11
|
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
ScriptCollection-3.5.
|
|
13
|
-
ScriptCollection-3.5.
|
|
14
|
-
ScriptCollection-3.5.
|
|
15
|
-
ScriptCollection-3.5.
|
|
16
|
-
ScriptCollection-3.5.
|
|
12
|
+
ScriptCollection-3.5.48.dist-info/METADATA,sha256=MHLmAHz3Q3FmM43QZnLtA4JbwCozrcqwcz_PteFxeBQ,7665
|
|
13
|
+
ScriptCollection-3.5.48.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
14
|
+
ScriptCollection-3.5.48.dist-info/entry_points.txt,sha256=_O7BmQ81LdDfrj5uOhjshg9Xc-tABHQJIxDOyOGRzzI,2397
|
|
15
|
+
ScriptCollection-3.5.48.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
|
16
|
+
ScriptCollection-3.5.48.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|