ScriptCollection 4.4.73__py3-none-any.whl → 5.0.0__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 +14 -14
- ScriptCollection/GeneralUtilities.py +11 -11
- ScriptCollection/OCIImages/AbstractImageHandler.py +3 -3
- ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerDebian.py +3 -3
- ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerDebianSlim.py +3 -3
- ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerGeneric.py +3 -3
- ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerGenericV.py +3 -3
- ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerGitlabCE.py +3 -3
- ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerGitlabEE.py +3 -3
- ScriptCollection/OCIImages/OCIImageManager.py +24 -24
- ScriptCollection/ProgramRunnerPopen.py +4 -2
- ScriptCollection/ProgramRunnerSudo.py +11 -5
- ScriptCollection/Resources/CultureChooser/CultureChooser.js +0 -0
- ScriptCollection/Resources/CultureChooser/index.html +0 -0
- ScriptCollection/Resources/Dependencies/JRE/Version.txt +0 -0
- ScriptCollection/Resources/Dependencies/OpenAPIGenerator/Version.txt +0 -0
- ScriptCollection/Resources/MaintenanceSite/MaintenanceSite.html +0 -0
- ScriptCollection/ScriptCollectionCore.py +40 -28
- ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py +3 -3
- ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py +6 -6
- ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py +3 -3
- ScriptCollection/TFCPS/PlantUMLRenderer.py +1 -1
- ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py +13 -13
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py +172 -7
- ScriptCollection/TFCPS/TFCPS_Tools_General.py +34 -16
- ScriptCollection/TFCPS/TFCPS_VisualRegressionTests.py +1 -1
- {scriptcollection-4.4.73.dist-info → scriptcollection-5.0.0.dist-info}/METADATA +3 -1
- {scriptcollection-4.4.73.dist-info → scriptcollection-5.0.0.dist-info}/RECORD +26 -26
- {scriptcollection-4.4.73.dist-info → scriptcollection-5.0.0.dist-info}/entry_points.txt +2 -2
- {scriptcollection-4.4.73.dist-info → scriptcollection-5.0.0.dist-info}/WHEEL +0 -0
- {scriptcollection-4.4.73.dist-info → scriptcollection-5.0.0.dist-info}/top_level.txt +0 -0
|
@@ -41,7 +41,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
|
|
|
41
41
|
from .ProgramRunnerPopen import ProgramRunnerPopen
|
|
42
42
|
from .SCLog import SCLog, LogLevel
|
|
43
43
|
|
|
44
|
-
version = "
|
|
44
|
+
version = "5.0.0"
|
|
45
45
|
__version__ = version
|
|
46
46
|
|
|
47
47
|
class VSCodeWorkspaceShellTask:
|
|
@@ -959,7 +959,7 @@ class ScriptCollectionCore:
|
|
|
959
959
|
return remote_is_ancestor_of_local and not local_is_ancestor_of_remote
|
|
960
960
|
|
|
961
961
|
@GeneralUtilities.check_arguments
|
|
962
|
-
def git_push(self, folder: str, remotename: str, localbranchname: str, remotebranchname: str, forcepush: bool = False, pushalltags: bool = True, verbosity: LogLevel = LogLevel.Quiet,
|
|
962
|
+
def git_push(self, folder: str, remotename: str, localbranchname: str, remotebranchname: str, forcepush: bool = False, pushalltags: bool = True, verbosity: LogLevel = LogLevel.Quiet,recurse_submodules:bool=False) -> None:
|
|
963
963
|
"""Pushes localbranchname to remotebranchname on the given remote (with pushalltags also all tags).
|
|
964
964
|
Without forcepush (and if folder is not a bare repository) the push is skipped (only logged on debug-level) when the
|
|
965
965
|
remote-branch is not strictly behind the local-branch, i.e. when it is equal, ahead or diverged (see git_branch_is_pushable),
|
|
@@ -974,7 +974,7 @@ class ScriptCollectionCore:
|
|
|
974
974
|
self.log.log(f"Skip pushing '{localbranchname}' to '{remotebranchname}' on '{remotename}' in '{folder}' because the remote-branch is not behind the local-branch.", LogLevel.Debug)
|
|
975
975
|
return
|
|
976
976
|
argument = ["push"]
|
|
977
|
-
if
|
|
977
|
+
if recurse_submodules:
|
|
978
978
|
argument = argument + ["--recurse-submodules=on-demand"]
|
|
979
979
|
argument = argument + [remotename, f"{localbranchname}:{remotebranchname}"]
|
|
980
980
|
if (forcepush):
|
|
@@ -1406,9 +1406,9 @@ class ScriptCollectionCore:
|
|
|
1406
1406
|
for file_or_folder, item_type in items.items():
|
|
1407
1407
|
truncated_file = file_or_folder[path_prefix:]
|
|
1408
1408
|
if (filter_function is None or filter_function(folder, truncated_file)):
|
|
1409
|
-
|
|
1410
|
-
user =
|
|
1411
|
-
permissions =
|
|
1409
|
+
owner_and_permission = self.get_file_owner_and_file_permission(file_or_folder)
|
|
1410
|
+
user = owner_and_permission[0]
|
|
1411
|
+
permissions = owner_and_permission[1]
|
|
1412
1412
|
lines.append(f"{truncated_file};{item_type};{user};{permissions}")
|
|
1413
1413
|
lines = sorted(lines, key=str.casefold)
|
|
1414
1414
|
with open(target_file, "w", encoding=encoding) as file_object:
|
|
@@ -1521,13 +1521,13 @@ class ScriptCollectionCore:
|
|
|
1521
1521
|
arguments = arguments+["--excludedirectories"]
|
|
1522
1522
|
if printonlynamewithoutpath:
|
|
1523
1523
|
arguments = arguments+["--printonlynamewithoutpath"]
|
|
1524
|
-
exit_code, stdout, stderr, _ = self.run_program_argsasarray("sclistfoldercontent", arguments)
|
|
1524
|
+
exit_code, stdout, stderr, _ = self.run_program_argsasarray("sclistfoldercontent", arguments, throw_exception_if_exitcode_is_not_zero=False)
|
|
1525
1525
|
if exit_code == 0:
|
|
1526
1526
|
for line in stdout.split("\n"):
|
|
1527
1527
|
normalized_line = line.replace("\r", "")
|
|
1528
1528
|
result.append(normalized_line)
|
|
1529
1529
|
else:
|
|
1530
|
-
raise ValueError(f"Fatal error occurred while
|
|
1530
|
+
raise ValueError(f"Fatal error occurred while listing the content of folder '{path}'. Exitcode: {exit_code}, StdErr: '{stderr}'")
|
|
1531
1531
|
result = [item for item in result if GeneralUtilities.string_has_nonwhitespace_content(item)]
|
|
1532
1532
|
return result
|
|
1533
1533
|
|
|
@@ -1793,7 +1793,7 @@ class ScriptCollectionCore:
|
|
|
1793
1793
|
raise ValueError(f"{filetype_full} '{full_path_of_file_or_folder}' does not exist")
|
|
1794
1794
|
|
|
1795
1795
|
@GeneralUtilities.check_arguments
|
|
1796
|
-
def
|
|
1796
|
+
def __calculate_length_in_seconds(self, filename: str, folder: str) -> float:
|
|
1797
1797
|
argument = ['-v', 'error', '-show_entries', 'format=duration', '-of', 'default=noprint_wrappers=1:nokey=1', filename]
|
|
1798
1798
|
result = self.run_program_argsasarray("ffprobe", argument, folder, throw_exception_if_exitcode_is_not_zero=True)
|
|
1799
1799
|
return float(result[1].replace('\n', ''))
|
|
@@ -1850,15 +1850,15 @@ class ScriptCollectionCore:
|
|
|
1850
1850
|
filename_without_extension = Path(file).stem
|
|
1851
1851
|
preview_files: list[str] = []
|
|
1852
1852
|
try:
|
|
1853
|
-
length_in_seconds = self.
|
|
1853
|
+
length_in_seconds = self.__calculate_length_in_seconds(filename, folder)
|
|
1854
1854
|
# frames per second, example: frames_per_second="20fps" => 20 frames per second
|
|
1855
1855
|
frames_per_second = self.__roundup(float(frames_per_second[:-3]), 2)
|
|
1856
1856
|
frames_per_second_as_string = str(frames_per_second)
|
|
1857
1857
|
preview_files = self.__create_thumbnails(filename, frames_per_second_as_string, folder, tempname_for_thumbnails)
|
|
1858
1858
|
if hook is not None:
|
|
1859
1859
|
hook(file, preview_files)
|
|
1860
|
-
|
|
1861
|
-
self.__create_thumbnail(filename_without_extension, folder, length_in_seconds, tempname_for_thumbnails,
|
|
1860
|
+
actual_amount_of_previewframes = len(preview_files)
|
|
1861
|
+
self.__create_thumbnail(filename_without_extension, folder, length_in_seconds, tempname_for_thumbnails, actual_amount_of_previewframes)
|
|
1862
1862
|
finally:
|
|
1863
1863
|
for thumbnail_to_delete in preview_files:
|
|
1864
1864
|
os.remove(thumbnail_to_delete)
|
|
@@ -1874,14 +1874,14 @@ class ScriptCollectionCore:
|
|
|
1874
1874
|
filename_without_extension = Path(file).stem
|
|
1875
1875
|
preview_files: list[str] = []
|
|
1876
1876
|
try:
|
|
1877
|
-
length_in_seconds = self.
|
|
1878
|
-
|
|
1879
|
-
frames_per_second_as_string = f"{
|
|
1877
|
+
length_in_seconds = self.__calculate_length_in_seconds(filename, folder)
|
|
1878
|
+
amount_of_previewframes = int(amount_of_columns*amount_of_rows)
|
|
1879
|
+
frames_per_second_as_string = f"{amount_of_previewframes-2}/{length_in_seconds}"
|
|
1880
1880
|
preview_files = self.__create_thumbnails(filename, frames_per_second_as_string, folder, tempname_for_thumbnails)
|
|
1881
1881
|
if hook is not None:
|
|
1882
1882
|
hook(file, preview_files)
|
|
1883
|
-
|
|
1884
|
-
self.__create_thumbnail2(filename_without_extension, folder, length_in_seconds, amount_of_rows, amount_of_columns, tempname_for_thumbnails,
|
|
1883
|
+
actual_amount_of_previewframes = len(preview_files)
|
|
1884
|
+
self.__create_thumbnail2(filename_without_extension, folder, length_in_seconds, amount_of_rows, amount_of_columns, tempname_for_thumbnails, actual_amount_of_previewframes)
|
|
1885
1885
|
finally:
|
|
1886
1886
|
for thumbnail_to_delete in preview_files:
|
|
1887
1887
|
os.remove(thumbnail_to_delete)
|
|
@@ -2300,7 +2300,7 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
|
|
|
2300
2300
|
namemappingfile, "Original filename;new filename;SHA2-hash of file")
|
|
2301
2301
|
for file in GeneralUtilities.absolute_file_paths(inputfolder):
|
|
2302
2302
|
if os.path.isfile(os.path.join(inputfolder, file)):
|
|
2303
|
-
if obfuscate_all_files or self.
|
|
2303
|
+
if obfuscate_all_files or self.__extension_matches(file, obfuscate_file_extensions):
|
|
2304
2304
|
files.append(file)
|
|
2305
2305
|
for file in files:
|
|
2306
2306
|
hash_value = GeneralUtilities.get_sha256_of_file(file)
|
|
@@ -2314,7 +2314,7 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
|
|
|
2314
2314
|
raise ValueError(f"Directory not found: '{inputfolder}'")
|
|
2315
2315
|
|
|
2316
2316
|
@GeneralUtilities.check_arguments
|
|
2317
|
-
def
|
|
2317
|
+
def __extension_matches(self, file: str, obfuscate_file_extensions) -> bool:
|
|
2318
2318
|
for extension in obfuscate_file_extensions:
|
|
2319
2319
|
if file.lower().endswith("."+extension.lower()):
|
|
2320
2320
|
return True
|
|
@@ -2336,7 +2336,7 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
|
|
|
2336
2336
|
inputfolder = newd
|
|
2337
2337
|
if (os.path.isdir(inputfolder)):
|
|
2338
2338
|
for file in GeneralUtilities.absolute_file_paths(inputfolder):
|
|
2339
|
-
if obfuscate_all_files or self.
|
|
2339
|
+
if obfuscate_all_files or self.__extension_matches(file, obfuscate_file_extensions):
|
|
2340
2340
|
self.changeHashOfProgram(file)
|
|
2341
2341
|
os.remove(file)
|
|
2342
2342
|
os.rename(file + ".modified", file)
|
|
@@ -2371,7 +2371,7 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
|
|
|
2371
2371
|
# -1 → a < b
|
|
2372
2372
|
# 0 → a = b
|
|
2373
2373
|
# 1 → a > b
|
|
2374
|
-
# dpkg --compare-versions <a> lt <b> → exit 0
|
|
2374
|
+
# dpkg --compare-versions <a> lt <b> → exit 0 if a < b
|
|
2375
2375
|
def dpkg_compare(op: str) -> bool:
|
|
2376
2376
|
result = self.run_program_argsasarray("docker", [ "run", "--rm",image, "dpkg", "--compare-versions", a, op, b],throw_exception_if_exitcode_is_not_zero=False)
|
|
2377
2377
|
GeneralUtilities.assert_condition(result[1]==GeneralUtilities.empty_string)
|
|
@@ -2626,9 +2626,21 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
|
|
|
2626
2626
|
ScriptCollectionCore.__process_stdout_lines(q_stdout, stdout_result, print_live_output, log)
|
|
2627
2627
|
ScriptCollectionCore.__process_stderr_lines(q_stderr, stderr_result, print_live_output, print_errors_as_information, log)
|
|
2628
2628
|
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2629
|
+
# Leaving the with-block waits until both reader-threads are terminated, so their result is final here.
|
|
2630
|
+
if timed_out:
|
|
2631
|
+
raise TimeoutError(f"The process with process-id {p_id} did not finish within the configured timeout of {timeoutInSeconds} second(s) and was killed.")
|
|
2632
|
+
ScriptCollectionCore.__raise_if_reading_failed(readers, p_id)
|
|
2633
|
+
return (stdout_result, stderr_result)
|
|
2634
|
+
|
|
2635
|
+
@staticmethod
|
|
2636
|
+
def __raise_if_reading_failed(readers: list, p_id: int) -> None:
|
|
2637
|
+
"""Raises the error of a reader-thread which failed.
|
|
2638
|
+
Without this check such an error (for example a program-runner whose popen-object does not provide readable text-streams)
|
|
2639
|
+
would be swallowed by the thread-pool, so that the program-run would look like a successful run without any output."""
|
|
2640
|
+
for reader in readers:
|
|
2641
|
+
reader_error: BaseException = reader.exception()
|
|
2642
|
+
if reader_error is not None:
|
|
2643
|
+
raise ValueError(f"Reading the output of the process with process-id {p_id} failed.") from reader_error
|
|
2632
2644
|
|
|
2633
2645
|
@GeneralUtilities.check_arguments
|
|
2634
2646
|
def run_program_argsasarray(self, program: str, arguments_as_array: list[str] = [], working_directory: str = None, print_errors_as_information: bool = False, log_file: str = None, timeoutInSeconds: int = None, addLogOverhead: bool = False, title: str = None, log_namespace: str = "", arguments_for_log: list[str] = None, throw_exception_if_exitcode_is_not_zero: bool = True, custom_argument: object = None, interactive: bool = False, print_live_output: bool = False, env_vars: dict = None) -> tuple[int, str, str, int]:
|
|
@@ -3906,10 +3918,10 @@ OCR-content:
|
|
|
3906
3918
|
service_url = service_url + f"&languages={language}"
|
|
3907
3919
|
headers = {'Cache-Control': 'no-cache'}
|
|
3908
3920
|
with open(file, "rb") as f:
|
|
3909
|
-
|
|
3921
|
+
files_to_analyze = {
|
|
3910
3922
|
"fileContent": (os.path.basename(file), f, mime_type)
|
|
3911
3923
|
}
|
|
3912
|
-
r = requests.put(service_url, timeout=3600, headers=headers, files=
|
|
3924
|
+
r = requests.put(service_url, timeout=3600, headers=headers, files=files_to_analyze,verify=True)
|
|
3913
3925
|
if r.status_code != 200:
|
|
3914
3926
|
if r.status_code == 400:
|
|
3915
3927
|
return f"Could not calculate ocr-content for file \"{file}\". File may be broken."
|
|
@@ -4366,7 +4378,7 @@ OCR-content:
|
|
|
4366
4378
|
health = state.get("Health")
|
|
4367
4379
|
|
|
4368
4380
|
if health is None:
|
|
4369
|
-
return False #
|
|
4381
|
+
return False # no HEALTHCHECK defined
|
|
4370
4382
|
|
|
4371
4383
|
return health["Status"] == "healthy"
|
|
4372
4384
|
|
|
@@ -4982,7 +4994,7 @@ OCR-content:
|
|
|
4982
4994
|
GeneralUtilities.write_lines_to_file(target_file, commits)
|
|
4983
4995
|
|
|
4984
4996
|
@GeneralUtilities.check_arguments
|
|
4985
|
-
def
|
|
4997
|
+
def is_running_in_container(self) ->bool:
|
|
4986
4998
|
"""this function is based on a convention and does not do a real check."""
|
|
4987
4999
|
return os.environ.get("ISRUNNINGINCONTAINER") == "true"
|
|
4988
5000
|
|
|
@@ -10,7 +10,7 @@ from lxml import etree
|
|
|
10
10
|
import yaml
|
|
11
11
|
from packaging.version import Version
|
|
12
12
|
from .CertificateGeneratorInformationBase import CertificateGeneratorInformationBase
|
|
13
|
-
from ...GeneralUtilities import GeneralUtilities,
|
|
13
|
+
from ...GeneralUtilities import GeneralUtilities, VersionEchelon
|
|
14
14
|
from ...SCLog import LogLevel
|
|
15
15
|
from .NuGetPackageSourceRegistration import NuGetPackageSourceRegistration
|
|
16
16
|
from ..TFCPS_CodeUnitSpecific_Base import TFCPS_CodeUnitSpecific_Base,TFCPS_CodeUnitSpecific_Base_CLI
|
|
@@ -841,13 +841,13 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
841
841
|
return sorted(three_part_versions, key=Version, reverse=True)
|
|
842
842
|
|
|
843
843
|
@GeneralUtilities.check_arguments
|
|
844
|
-
def
|
|
844
|
+
def update_dependencies_with_specific_echelon(self, echelon: VersionEchelon) -> None:
|
|
845
845
|
"""Updates the dependencies of this codeunit and confirms the result in its lock-files.
|
|
846
846
|
|
|
847
847
|
The update changes the versions the project-files ask for, and the lock-files still state the versions which were
|
|
848
848
|
resolved before. Writing them again is part of the update: without it the next build fails with NU1004, and the
|
|
849
849
|
state of the dependencies of the codeunit would be spread over two places which do not agree."""
|
|
850
|
-
super().
|
|
850
|
+
super().update_dependencies_with_specific_echelon(echelon)
|
|
851
851
|
self.synchronize_dependency_versions_across_project_files()
|
|
852
852
|
self.tfcps_Tools_General.update_lock_files_of_dotnet_codeunit(self.get_codeunit_folder())
|
|
853
853
|
|
|
@@ -11,7 +11,7 @@ import zipfile
|
|
|
11
11
|
import yaml
|
|
12
12
|
|
|
13
13
|
from ...ArbTranslationsOrganizer import ArbTranslationsOrganizer
|
|
14
|
-
from ...GeneralUtilities import GeneralUtilities,
|
|
14
|
+
from ...GeneralUtilities import GeneralUtilities, VersionEchelon
|
|
15
15
|
from ...SCLog import LogLevel
|
|
16
16
|
from ...ScriptCollectionCore import ScriptCollectionCore
|
|
17
17
|
from ..PubDependencies import PubDependencies
|
|
@@ -90,11 +90,11 @@ class TFCPS_CodeUnitSpecific_Flutter_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
90
90
|
self._protected_sc.log.log(f"Build flutter-codeunit {codeunit_name} for target {target_names[target]}...")
|
|
91
91
|
if target == "web":
|
|
92
92
|
self._protected_sc.run_with_epew("flutter", "build web", src_folder)
|
|
93
|
-
|
|
93
|
+
web_release_folder = os.path.join(src_folder, "build/web")
|
|
94
94
|
web_folder = os.path.join(artifacts_folder, "BuildResult_WebApplication")
|
|
95
95
|
GeneralUtilities.ensure_directory_does_not_exist(web_folder)
|
|
96
96
|
GeneralUtilities.ensure_directory_exists(web_folder)
|
|
97
|
-
GeneralUtilities.copy_content_of_folder(
|
|
97
|
+
GeneralUtilities.copy_content_of_folder(web_release_folder, web_folder)
|
|
98
98
|
elif target == "windows":
|
|
99
99
|
# Windows-builds prefer a Windows-task-runner - even when building on a Windows-client - so that all builds
|
|
100
100
|
# are produced uniformly in the same defined environment. See the remote-build-article in the reference. If
|
|
@@ -725,7 +725,7 @@ class TFCPS_CodeUnitSpecific_Flutter_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
725
725
|
def __is_running_in_container(self) -> bool:
|
|
726
726
|
# The filesystem-marker is checked in addition to the convention-based environment-variable because a wrong
|
|
727
727
|
# result here does not only change a message but makes the sibling-container access the wrong folder.
|
|
728
|
-
return os.path.exists("/.dockerenv") or self._protected_sc.
|
|
728
|
+
return os.path.exists("/.dockerenv") or self._protected_sc.is_running_in_container()
|
|
729
729
|
|
|
730
730
|
@GeneralUtilities.check_arguments
|
|
731
731
|
def __get_own_container_id(self) -> str:
|
|
@@ -786,7 +786,7 @@ class TFCPS_CodeUnitSpecific_Flutter_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
786
786
|
GeneralUtilities.assert_condition(dependency_was_set, f"No package of the codeunit \"{self.get_codeunit_name()}\" contains a dependency which is named \"{name}\".")
|
|
787
787
|
|
|
788
788
|
@GeneralUtilities.check_arguments
|
|
789
|
-
def
|
|
789
|
+
def update_dependencies_with_specific_echelon(self, echelon: VersionEchelon) -> None:
|
|
790
790
|
"""Updates the dependencies of this codeunit and confirms the result in the lock-files of its packages.
|
|
791
791
|
|
|
792
792
|
The update changes the versions the package-files ask for, and the lock-files still state the versions which
|
|
@@ -797,7 +797,7 @@ class TFCPS_CodeUnitSpecific_Flutter_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
797
797
|
The lock-files are only written when the update really changed a version, because writing them means
|
|
798
798
|
resolving the dependencies again, which is the most expensive part of an update-run."""
|
|
799
799
|
dependencies_before_the_update: dict[str, set[str]] = self.get_dependencies()
|
|
800
|
-
super().
|
|
800
|
+
super().update_dependencies_with_specific_echelon(echelon)
|
|
801
801
|
if dependencies_before_the_update == self.get_dependencies():
|
|
802
802
|
return
|
|
803
803
|
for package_folder in self.__get_package_folders():
|
|
@@ -4,7 +4,7 @@ import json
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
import xml.etree.ElementTree as ET
|
|
6
6
|
from lxml import etree
|
|
7
|
-
from ...GeneralUtilities import GeneralUtilities,
|
|
7
|
+
from ...GeneralUtilities import GeneralUtilities, VersionEchelon
|
|
8
8
|
from ...SCLog import LogLevel
|
|
9
9
|
from ..TFCPS_CodeUnitSpecific_Base import TFCPS_CodeUnitSpecific_Base,TFCPS_CodeUnitSpecific_Base_CLI
|
|
10
10
|
from ..NpmDependencies import NpmDependencies
|
|
@@ -147,7 +147,7 @@ class TFCPS_CodeUnitSpecific_NodeJS_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
147
147
|
self._protected_sc.format_json_file(package_json_file)
|
|
148
148
|
|
|
149
149
|
@GeneralUtilities.check_arguments
|
|
150
|
-
def
|
|
150
|
+
def update_dependencies_with_specific_echelon(self,echelon:VersionEchelon)->None:
|
|
151
151
|
"""Updates the dependencies of this codeunit and confirms the result in its lock-file.
|
|
152
152
|
|
|
153
153
|
The update changes the versions the package-file asks for, and the lock-file still states the versions which
|
|
@@ -158,7 +158,7 @@ class TFCPS_CodeUnitSpecific_NodeJS_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
158
158
|
The lock-file is only written when the update really changed a version, because writing it means installing
|
|
159
159
|
the dependencies again, which is the most expensive part of an update-run."""
|
|
160
160
|
dependencies_before_the_update:dict[str,set[str]]=self.get_dependencies()
|
|
161
|
-
super().
|
|
161
|
+
super().update_dependencies_with_specific_echelon(echelon)
|
|
162
162
|
if dependencies_before_the_update!=self.get_dependencies():
|
|
163
163
|
#The cache must not be used here: the whole point of this install is to resolve the dependencies again.
|
|
164
164
|
self.tfcps_Tools_General.do_npm_install(self.get_codeunit_folder(),True,False)
|
|
@@ -94,7 +94,7 @@ class PlantUMLRenderer:
|
|
|
94
94
|
self.__sc.docker_pull(image_address, image_tag)
|
|
95
95
|
# Inside a build-container the forwarded docker-socket belongs to the daemon of the host, so the container
|
|
96
96
|
# started here is a sibling-container and not a child. See get_container_call_configuration.
|
|
97
|
-
own_container_id: str = self.__sc.get_own_container_id() if self.__sc.
|
|
97
|
+
own_container_id: str = self.__sc.get_own_container_id() if self.__sc.is_running_in_container() else None
|
|
98
98
|
for plantuml_file in plantuml_files:
|
|
99
99
|
folder: str = os.path.dirname(plantuml_file)
|
|
100
100
|
container_call: PlantUMLContainerCall = PlantUMLRenderer.get_container_call_configuration(folder, own_container_id)
|
|
@@ -9,7 +9,7 @@ import yaml
|
|
|
9
9
|
import xmlschema
|
|
10
10
|
from packaging.version import Version
|
|
11
11
|
from lxml import etree
|
|
12
|
-
from ..GeneralUtilities import GeneralUtilities,
|
|
12
|
+
from ..GeneralUtilities import GeneralUtilities, VersionEchelon
|
|
13
13
|
from ..ScriptCollectionCore import ScriptCollectionCore
|
|
14
14
|
from ..SCLog import LogLevel
|
|
15
15
|
from .TFCPS_Tools_General import TFCPS_Tools_General, CommonProjectStructureVersion
|
|
@@ -32,10 +32,10 @@ class TFCPS_CodeUnitSpecific_Base(ABC):
|
|
|
32
32
|
__validate_developers_of_repository:bool=True#TODO must be settable to false
|
|
33
33
|
codeunit_namespace:str= TFCPS_Tools_General.get_common_project_structure_namespace(CommonProjectStructureVersion)
|
|
34
34
|
|
|
35
|
-
def __init__(self,current_file:str,verbosity:LogLevel,
|
|
35
|
+
def __init__(self,current_file:str,verbosity:LogLevel,target_environment_type:str,use_cache:bool,is_pre_merge:bool):
|
|
36
36
|
self.__verbosity=verbosity
|
|
37
37
|
self.__use_cache=use_cache
|
|
38
|
-
self.__target_environment_type=
|
|
38
|
+
self.__target_environment_type=target_environment_type
|
|
39
39
|
self.__current_file = str(Path(current_file).absolute())
|
|
40
40
|
self.__current_folder = os.path.dirname(self.__current_file)
|
|
41
41
|
self.__codeunit_folder=self.__search_codeunit_folder()
|
|
@@ -77,9 +77,9 @@ class TFCPS_CodeUnitSpecific_Base(ABC):
|
|
|
77
77
|
raise ValueError(f"Operation is abstract.")
|
|
78
78
|
|
|
79
79
|
def update_dependencies(self):
|
|
80
|
-
self.
|
|
80
|
+
self.update_dependencies_with_specific_echelon(VersionEchelon.LatestPatchOrLatestMinor)
|
|
81
81
|
|
|
82
|
-
def
|
|
82
|
+
def update_dependencies_with_specific_echelon(self, echelon: VersionEchelon):
|
|
83
83
|
ignored_dependencies=self.tfcps_Tools_General.get_dependencies_which_are_ignored_from_updates(self.get_codeunit_folder())
|
|
84
84
|
for ignored_dependency in ignored_dependencies:
|
|
85
85
|
self._protected_sc.log.log(f"Codeunit {self.get_codeunit_name()} ignores the dependency {ignored_dependency} in update-checks.", LogLevel.Warning)
|
|
@@ -95,7 +95,7 @@ class TFCPS_CodeUnitSpecific_Base(ABC):
|
|
|
95
95
|
available_versions:list[str]=self.get_available_versions(dependencyname)
|
|
96
96
|
for available_version in available_versions:
|
|
97
97
|
GeneralUtilities.assert_condition(re.match(r"^(\d+).(\d+).(\d+)$", available_version) is not None,f"Invalid-version-string: {available_version}")
|
|
98
|
-
desired_version=GeneralUtilities.choose_version(available_versions,latest_currently_used_version,
|
|
98
|
+
desired_version=GeneralUtilities.choose_version(available_versions,latest_currently_used_version,echelon)
|
|
99
99
|
GeneralUtilities.assert_condition(Version(dependency_version)<=Version(desired_version),f"Desired version {desired_version} for dependency {dependencyname} is less than the actual used version {latest_currently_used_version}.")
|
|
100
100
|
update_dependency:bool=desired_version!=latest_currently_used_version
|
|
101
101
|
if update_dependency:
|
|
@@ -150,7 +150,7 @@ class TFCPS_CodeUnitSpecific_Base(ABC):
|
|
|
150
150
|
namespaces = {'cps': TFCPS_CodeUnitSpecific_Base.codeunit_namespace, 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
|
|
151
151
|
root: etree._ElementTree = etree.parse(codeunit_file)
|
|
152
152
|
|
|
153
|
-
# check codeunit-
|
|
153
|
+
# check codeunit-specification-version
|
|
154
154
|
try:
|
|
155
155
|
codeunit_file_version = root.xpath('//cps:codeunit/@codeunitspecificationversion', namespaces=namespaces)[0]
|
|
156
156
|
if codeunit_file_version != supported_codeunitspecificationversion:
|
|
@@ -256,7 +256,7 @@ class TFCPS_CodeUnitSpecific_Base(ABC):
|
|
|
256
256
|
raise ValueError(f"Hints-file '{hints_file}' does not exist.")
|
|
257
257
|
|
|
258
258
|
# Copy license-file
|
|
259
|
-
self.tfcps_Tools_General.
|
|
259
|
+
self.tfcps_Tools_General.copy_license_file(self.get_codeunit_folder())
|
|
260
260
|
|
|
261
261
|
# Propagate the repository-level dependency-version-pins (e.g. PlantUML, OpenAPIGenerator, JRE) into the codeunit
|
|
262
262
|
# so each codeunit carries its own copy of the versions that are defined once at repository-level.
|
|
@@ -510,11 +510,11 @@ class TFCPS_CodeUnitSpecific_Base(ABC):
|
|
|
510
510
|
|
|
511
511
|
# Generating badges
|
|
512
512
|
if generate_badges:
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
GeneralUtilities.ensure_directory_does_not_exist(
|
|
516
|
-
GeneralUtilities.ensure_directory_exists(
|
|
517
|
-
self._protected_sc.run_program("reportgenerator", f"-reports:Other/Artifacts/TestCoverage/TestCoverage.xml -targetdir:{
|
|
513
|
+
testcoverage_subfolder = "Other/Resources/TestCoverageBadges"
|
|
514
|
+
full_testcoverage_subfolder = os.path.join(repository_folder, codeunitname, testcoverage_subfolder)
|
|
515
|
+
GeneralUtilities.ensure_directory_does_not_exist(full_testcoverage_subfolder)
|
|
516
|
+
GeneralUtilities.ensure_directory_exists(full_testcoverage_subfolder)
|
|
517
|
+
self._protected_sc.run_program("reportgenerator", f"-reports:Other/Artifacts/TestCoverage/TestCoverage.xml -targetdir:{testcoverage_subfolder} -reporttypes:Badges --verbosity:{verbose_argument_for_reportgenerator}", os.path.join(repository_folder, codeunitname))
|
|
518
518
|
|
|
519
519
|
@GeneralUtilities.check_arguments
|
|
520
520
|
def __update_path_of_source_in_testcoverage_file(self, repository_folder: str, codeunitname: str) -> None:
|