ScriptCollection 4.4.21__py3-none-any.whl → 4.4.22__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 +22 -5
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py +3 -3
- ScriptCollection/TFCPS/TFCPS_Tools_General.py +77 -52
- {scriptcollection-4.4.21.dist-info → scriptcollection-4.4.22.dist-info}/METADATA +1 -1
- {scriptcollection-4.4.21.dist-info → scriptcollection-4.4.22.dist-info}/RECORD +8 -8
- {scriptcollection-4.4.21.dist-info → scriptcollection-4.4.22.dist-info}/WHEEL +0 -0
- {scriptcollection-4.4.21.dist-info → scriptcollection-4.4.22.dist-info}/entry_points.txt +0 -0
- {scriptcollection-4.4.21.dist-info → scriptcollection-4.4.22.dist-info}/top_level.txt +0 -0
|
@@ -39,7 +39,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
|
|
|
39
39
|
from .ProgramRunnerPopen import ProgramRunnerPopen
|
|
40
40
|
from .SCLog import SCLog, LogLevel
|
|
41
41
|
|
|
42
|
-
version = "4.4.
|
|
42
|
+
version = "4.4.22"
|
|
43
43
|
__version__ = version
|
|
44
44
|
|
|
45
45
|
class VSCodeWorkspaceShellTask:
|
|
@@ -2442,15 +2442,23 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
|
|
|
2442
2442
|
relative entries of 'excluded_folders' are resolved against 'base_folder'."""
|
|
2443
2443
|
resolved_base_folder = GeneralUtilities.resolve_relative_path(base_folder, os.getcwd())
|
|
2444
2444
|
resolved_path = GeneralUtilities.resolve_relative_path(path, resolved_base_folder)
|
|
2445
|
-
|
|
2446
|
-
|
|
2445
|
+
# GeneralUtilities.resolve_relative_path only resolves symlinks (via Path.resolve()) for relative inputs; an
|
|
2446
|
+
# already-absolute input is returned unchanged. On macOS the system temp-folder lies under "/var", which
|
|
2447
|
+
# itself is a symlink to "/private/var" (Linux/Windows temp-folders normally have no such symlink-indirection).
|
|
2448
|
+
# Without canonicalizing all three values the same way here, an absolute base_folder/path (unresolved, still
|
|
2449
|
+
# containing "/var/...") could fail to share a prefix with a relative excluded_folder entry like ".git" (which
|
|
2450
|
+
# got symlink-resolved to "/private/var/..." further above), so the exclusion-check would silently never match.
|
|
2451
|
+
# Resolving symlinks consistently for all three values fixes this and is also the safer choice from a security
|
|
2452
|
+
# standpoint, since it prevents a symlink from being used to bypass the excluded-folders check.
|
|
2453
|
+
normalized_base_folder = os.path.normcase(os.path.normpath(os.path.realpath(resolved_base_folder)))
|
|
2454
|
+
normalized_path = os.path.normcase(os.path.normpath(os.path.realpath(resolved_path)))
|
|
2447
2455
|
# 1. path must be equal to or located inside base_folder
|
|
2448
2456
|
if not (normalized_path == normalized_base_folder or normalized_path.startswith(normalized_base_folder + os.sep)):
|
|
2449
2457
|
return False
|
|
2450
2458
|
# 2. path must not be equal to or located inside any excluded folder
|
|
2451
2459
|
for excluded_folder in excluded_folders:
|
|
2452
2460
|
resolved_excluded_folder = GeneralUtilities.resolve_relative_path(excluded_folder, resolved_base_folder)
|
|
2453
|
-
normalized_excluded_folder = os.path.normcase(os.path.normpath(resolved_excluded_folder))
|
|
2461
|
+
normalized_excluded_folder = os.path.normcase(os.path.normpath(os.path.realpath(resolved_excluded_folder)))
|
|
2454
2462
|
if normalized_path == normalized_excluded_folder or normalized_path.startswith(normalized_excluded_folder + os.sep):
|
|
2455
2463
|
return False
|
|
2456
2464
|
# 3. path is inside base_folder and not inside any excluded folder
|
|
@@ -4577,9 +4585,18 @@ OCR-content:
|
|
|
4577
4585
|
self.assert_scbuilder_image_in_github_workflow_matches_image_definition(repository_folder)
|
|
4578
4586
|
self.__prepare_build_pipeline(repository_folder)
|
|
4579
4587
|
|
|
4588
|
+
def __ensure_branch_is_checked_out(self,repository_folder:str) -> None:
|
|
4589
|
+
current_branch_result = self.run_program_argsasarray("git", ["symbolic-ref", "--short", "HEAD"], repository_folder, throw_exception_if_exitcode_is_not_zero=False)
|
|
4590
|
+
repository_is_on_any_branch:bool = current_branch_result[0] == 0
|
|
4591
|
+
if not repository_is_on_any_branch:
|
|
4592
|
+
timestamp = datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
|
|
4593
|
+
branch_name:str=f"pipeline_{timestamp}"
|
|
4594
|
+
self.run_program_argsasarray("git",["checkout","-b",branch_name], repository_folder)
|
|
4595
|
+
|
|
4580
4596
|
def __prepare_build_pipeline(self,repository_folder:str) -> None:
|
|
4581
4597
|
GeneralUtilities.assert_condition(self.is_running_in_build_container(), "This function should only be run in the build container.")
|
|
4582
|
-
|
|
4598
|
+
self.__ensure_branch_is_checked_out(repository_folder)
|
|
4599
|
+
|
|
4583
4600
|
expected_image = self.__get_scbuilder_image_from_image_definition_file(repository_folder)
|
|
4584
4601
|
GeneralUtilities.assert_condition("scbuilder:" in expected_image, f"The SCBuilder-image '{expected_image}' defined in the image-definition-file of the repository is not a valid SCBuilder-image. It must contain 'scbuilder:'.")
|
|
4585
4602
|
if not expected_image.endswith(":latest"):
|
|
@@ -34,7 +34,7 @@ class TFCPS_UpdateDependenciesHook(TFCPS_BuildCodeUnitsHook):
|
|
|
34
34
|
update_dependencies_script_folder: str = os.path.join(repository, "Other", "Scripts")
|
|
35
35
|
if os.path.isfile(os.path.join(update_dependencies_script_folder, "UpdateDependencies.py")):
|
|
36
36
|
self.__sc.log.log("Update dependencies of the repository...")
|
|
37
|
-
self.__sc.run_program(GeneralUtilities.get_python_executable(), "UpdateDependencies.py", update_dependencies_script_folder)
|
|
37
|
+
self.__sc.run_program(GeneralUtilities.get_python_executable(), "UpdateDependencies.py", update_dependencies_script_folder,print_live_output=True)
|
|
38
38
|
self.__ensure_changelog_is_there(repository)
|
|
39
39
|
|
|
40
40
|
@GeneralUtilities.check_arguments
|
|
@@ -54,7 +54,7 @@ class TFCPS_UpdateDependenciesHook(TFCPS_BuildCodeUnitsHook):
|
|
|
54
54
|
if not self.__tfcps_tools_general.codeunit_has_updatable_dependencies(os.path.join(codeunit_folder, f"{codeunit_name}.codeunit.xml")):
|
|
55
55
|
return
|
|
56
56
|
self.__sc.log.log(f"Update dependencies of codeunit {codeunit_name}...")
|
|
57
|
-
self.__sc.run_program(GeneralUtilities.get_python_executable(), "UpdateDependencies.py", os.path.join(codeunit_folder, "Other"))
|
|
57
|
+
self.__sc.run_program(GeneralUtilities.get_python_executable(), "UpdateDependencies.py", os.path.join(codeunit_folder, "Other"),print_live_output=True)
|
|
58
58
|
self.__ensure_changelog_is_there(repository)
|
|
59
59
|
if self.__sc.git_repository_has_uncommitted_changes(repository):
|
|
60
60
|
#the update changed something, so it has to be verified that the codeunit is still buildable with the updated dependencies.
|
|
@@ -263,7 +263,7 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
263
263
|
self.sc.format_json_file(workspace_file)
|
|
264
264
|
|
|
265
265
|
#TODO add option to define exceptions (means: files which should not be normalized).
|
|
266
|
-
self.sc.normalize_invisible_characters_of_files_in_folder(self.repository, ["txt", "md", "py", "json", "xml", "svg", "csv", "yml", "yaml", "toml","gitignore", "gitattributes", "code-workspace"])
|
|
266
|
+
self.sc.normalize_invisible_characters_of_files_in_folder(self.repository, ["txt", "md", "py", "json", "xml", "svg", "csv", "yml", "yaml", "toml","gitignore", "gitattributes", "code-workspace", "plantuml"])
|
|
267
267
|
|
|
268
268
|
@GeneralUtilities.check_arguments
|
|
269
269
|
def is_working_branch(self)->bool:
|
|
@@ -45,15 +45,8 @@ class TFCPS_Tools_General:
|
|
|
45
45
|
# Font-files (all faces of the diagram-font) bundled with the package and forced via the JVM-font-path when rendering.
|
|
46
46
|
__bundled_diagram_font_filenames:list[str]=["DejaVuSans.ttf","DejaVuSans-Bold.ttf","DejaVuSans-Oblique.ttf","DejaVuSans-BoldOblique.ttf"]
|
|
47
47
|
# Relative path (in the source-repository and in the ScriptCollection.Resources-package) of the file that pins the
|
|
48
|
-
# default Eclipse-Temurin-JRE-version used
|
|
49
|
-
# version in '<repo>/Other/Resources/Dependencies/JRE/Version.txt'. The file contains a build like "21.0.6+7"
|
|
50
|
-
# feature-version is derived from it). Pinning the exact JDK-build (not just the major-version) makes the AWT-font-
|
|
51
|
-
# metrics - and thus the computed SVG-geometry - byte-identical across machines: PlantUML computes the SVG purely as
|
|
52
|
-
# vector-math from the font-metrics, and different JDK-builds (e.g. a Windows-client vs. the Debian-build-container)
|
|
53
|
-
# round these metrics slightly differently. Together with the bundled DejaVu-font (see __default_diagram_font_name)
|
|
54
|
-
# this makes the rendered SVG fully deterministic. The PlantUML-rendering uses this pinned JRE instead of the host's
|
|
55
|
-
# 'java' on the PATH. When the pinned version is bumped, the committed diagram-SVGs must be regenerated and re-committed
|
|
56
|
-
# once so they match the new build's metrics.
|
|
48
|
+
# default Eclipse-Temurin-JRE-version used by ensure_jre_is_available/download_jre when a repository does not pin its
|
|
49
|
+
# own version in '<repo>/Other/Resources/Dependencies/JRE/Version.txt'. The file contains a build like "21.0.6+7".
|
|
57
50
|
__jre_version_resource_relative_path:str="Dependencies/JRE/Version.txt"
|
|
58
51
|
|
|
59
52
|
def __init__(self,sc:ScriptCollectionCore):
|
|
@@ -71,6 +64,8 @@ class TFCPS_Tools_General:
|
|
|
71
64
|
local_resource_name="CycloneDXCLI"
|
|
72
65
|
self.ensure_file_from_github_assets_is_available_with_retry("CycloneDX", "cyclonedx-cli", local_resource_name,"cyclonedx-linux-arm64",lambda latest_version: "cyclonedx-linux-arm64",enforce_update=enforce_update)
|
|
73
66
|
self.ensure_file_from_github_assets_is_available_with_retry("CycloneDX", "cyclonedx-cli", local_resource_name,"cyclonedx-linux-x64",lambda latest_version: "cyclonedx-linux-x64",enforce_update=enforce_update)
|
|
67
|
+
self.ensure_file_from_github_assets_is_available_with_retry("CycloneDX", "cyclonedx-cli", local_resource_name,"cyclonedx-osx-arm64",lambda latest_version: "cyclonedx-osx-arm64",enforce_update=enforce_update)
|
|
68
|
+
self.ensure_file_from_github_assets_is_available_with_retry("CycloneDX", "cyclonedx-cli", local_resource_name,"cyclonedx-osx-x64",lambda latest_version: "cyclonedx-osx-x64",enforce_update=enforce_update)
|
|
74
69
|
self.ensure_file_from_github_assets_is_available_with_retry("CycloneDX", "cyclonedx-cli", local_resource_name,"cyclonedx-win-arm64.exe",lambda latest_version: "cyclonedx-win-arm64.exe",enforce_update=enforce_update)
|
|
75
70
|
self.ensure_file_from_github_assets_is_available_with_retry("CycloneDX", "cyclonedx-cli", local_resource_name, "cyclonedx-win-x64.exe",lambda latest_version: "cyclonedx-win-x64.exe",enforce_update=enforce_update)
|
|
76
71
|
|
|
@@ -92,6 +87,13 @@ class TFCPS_Tools_General:
|
|
|
92
87
|
return os.path.join(resource_folder, "cyclonedx-linux-arm64")
|
|
93
88
|
else:
|
|
94
89
|
raise ValueError("Unsupported architecture for cyclonedx-cli on linux.")
|
|
90
|
+
elif GeneralUtilities.current_system_is_macos():
|
|
91
|
+
if is_x64:
|
|
92
|
+
return os.path.join(resource_folder, "cyclonedx-osx-x64")
|
|
93
|
+
elif is_arm:
|
|
94
|
+
return os.path.join(resource_folder, "cyclonedx-osx-arm64")
|
|
95
|
+
else:
|
|
96
|
+
raise ValueError("Unsupported architecture for cyclonedx-cli on macos.")
|
|
95
97
|
else:
|
|
96
98
|
raise ValueError("Unsupported operating system for cyclonedx-cli.")
|
|
97
99
|
|
|
@@ -129,8 +131,11 @@ class TFCPS_Tools_General:
|
|
|
129
131
|
@GeneralUtilities.check_arguments
|
|
130
132
|
def download_jre(self, enforce_update: bool = False) -> None:
|
|
131
133
|
self.__sc.log.log("Download cachable tool \"JRE\" into global cache...", LogLevel.Debug)
|
|
132
|
-
#
|
|
133
|
-
# build-image
|
|
134
|
+
# No repository-context is available when warming the global cache (e.g. scdownloadcachabletools in a
|
|
135
|
+
# build-image), so download the default version pinned by the ScriptCollection-package. Actual builds
|
|
136
|
+
# pass the version pinned in their own '<repo>/Other/Resources/Dependencies/JRE/Version.txt'. This is
|
|
137
|
+
# independent of the Java used to render PlantUML-diagrams (see __run_plantuml_in_linux_container), which
|
|
138
|
+
# always runs inside a Docker-container instead of this cached JRE.
|
|
134
139
|
self.ensure_jre_is_available(enforce_update)
|
|
135
140
|
|
|
136
141
|
@GeneralUtilities.check_arguments
|
|
@@ -881,18 +886,26 @@ class TFCPS_Tools_General:
|
|
|
881
886
|
def generate_svg_files_from_plantuml_files_for_repository(self, repository_folder: str,use_cache:bool) -> None:
|
|
882
887
|
self.__sc.log.log("Generate svg-files from plantuml-files...")
|
|
883
888
|
self.__sc.assert_is_git_repository(repository_folder)
|
|
889
|
+
# If the currently checked-out commit is itself tagged with a release-version ('v<semver>') and the working-tree
|
|
890
|
+
# is clean, the committed diagram-SVGs were generated for exactly this release-state and must not change; a
|
|
891
|
+
# difference would then indicate a rendering-regression (e.g. a font/JRE-mismatch, see
|
|
892
|
+
# __generate_svg_files_from_plantuml) instead of an expected content-change and must fail loudly.
|
|
893
|
+
current_commit_tags = [tag for tag in GeneralUtilities.string_to_lines(self.__sc.run_program_argsasarray("git", ["tag", "--points-at", "HEAD"], repository_folder, throw_exception_if_exitcode_is_not_zero=False)[1]) if GeneralUtilities.string_has_content(tag)]
|
|
894
|
+
current_commit_has_release_tag = any(re.match(r"^v\d+\.\d+\.\d+$", tag) for tag in current_commit_tags)
|
|
895
|
+
assert_remains_unchanged: bool = current_commit_has_release_tag and not self.__sc.git_repository_has_uncommitted_changes(repository_folder)
|
|
884
896
|
plantuml_jar_file=self.ensure_plantuml_is_available(not use_cache, self.get_plantuml_version(repository_folder))
|
|
885
|
-
java_executable=self.ensure_jre_is_available(not use_cache, repository_folder)
|
|
886
897
|
target_folder = os.path.join(repository_folder, "Other", "Reference")
|
|
887
|
-
self.__generate_svg_files_from_plantuml(target_folder, plantuml_jar_file,
|
|
898
|
+
self.__generate_svg_files_from_plantuml(target_folder, plantuml_jar_file, repository_folder)
|
|
899
|
+
if assert_remains_unchanged:
|
|
900
|
+
GeneralUtilities.assert_condition(not self.__sc.git_repository_has_uncommitted_changes(repository_folder), f"Generating svg-files from plantuml-files in '{repository_folder}' changed the repository unexpectedly.")
|
|
888
901
|
|
|
889
902
|
@GeneralUtilities.check_arguments
|
|
890
903
|
def generate_svg_files_from_plantuml_files_for_codeunit(self, codeunit_folder: str,use_cache:bool) -> None:
|
|
891
904
|
self.assert_is_codeunit_folder(codeunit_folder)
|
|
892
|
-
|
|
893
|
-
|
|
905
|
+
repository_folder = os.path.dirname(codeunit_folder)
|
|
906
|
+
plantuml_jar_file=self.ensure_plantuml_is_available(not use_cache, self.get_plantuml_version(repository_folder))
|
|
894
907
|
target_folder = os.path.join(codeunit_folder, "Other", "Reference")
|
|
895
|
-
self.__generate_svg_files_from_plantuml(target_folder, plantuml_jar_file,
|
|
908
|
+
self.__generate_svg_files_from_plantuml(target_folder, plantuml_jar_file, repository_folder)
|
|
896
909
|
|
|
897
910
|
@GeneralUtilities.check_arguments
|
|
898
911
|
def generate_svg_files_from_vega_files_for_repository(self, repository_folder: str,use_cache:bool) -> None:
|
|
@@ -947,26 +960,10 @@ class TFCPS_Tools_General:
|
|
|
947
960
|
"""Returns the PlantUML-version used when no repository-specific version is pinned (for example when warming
|
|
948
961
|
the global cache via scdownloadcachabletools). The value is read from the version-file bundled with the
|
|
949
962
|
ScriptCollection-package, with a fallback to the source-file for an unbuilt source-checkout."""
|
|
950
|
-
try:
|
|
951
|
-
content = GeneralUtilities._internal_load_resource(TFCPS_Tools_General.__plantuml_version_resource_relative_path)
|
|
952
|
-
return content.decode("utf-8").strip()
|
|
953
|
-
except (FileNotFoundError, ModuleNotFoundError):
|
|
954
|
-
source_version_file = GeneralUtilities.resolve_relative_path(f"../../../Other/Resources/{TFCPS_Tools_General.__plantuml_version_resource_relative_path}", os.path.dirname(__file__))
|
|
955
|
-
GeneralUtilities.assert_file_exists(source_version_file)
|
|
956
|
-
return GeneralUtilities.read_text_from_file(source_version_file).strip()
|
|
957
963
|
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
__jre_version_resource_relative_path). The value is read from the version-file bundled with the
|
|
962
|
-
ScriptCollection-package, with a fallback to the source-file for an unbuilt source-checkout."""
|
|
963
|
-
try:
|
|
964
|
-
content = GeneralUtilities._internal_load_resource(TFCPS_Tools_General.__jre_version_resource_relative_path)
|
|
965
|
-
return content.decode("utf-8").strip()
|
|
966
|
-
except (FileNotFoundError, ModuleNotFoundError):
|
|
967
|
-
source_version_file = GeneralUtilities.resolve_relative_path(f"../../../Other/Resources/{TFCPS_Tools_General.__jre_version_resource_relative_path}", os.path.dirname(__file__))
|
|
968
|
-
GeneralUtilities.assert_file_exists(source_version_file)
|
|
969
|
-
return GeneralUtilities.read_text_from_file(source_version_file).strip()
|
|
964
|
+
content = GeneralUtilities._internal_load_resource(TFCPS_Tools_General.__plantuml_version_resource_relative_path)
|
|
965
|
+
return content.decode("utf-8").strip()
|
|
966
|
+
|
|
970
967
|
|
|
971
968
|
@GeneralUtilities.check_arguments
|
|
972
969
|
def get_jre_version(self, repository_folder: str = None) -> str:
|
|
@@ -978,11 +975,20 @@ class TFCPS_Tools_General:
|
|
|
978
975
|
return GeneralUtilities.read_text_from_file(version_file).strip()
|
|
979
976
|
return self.get_default_jre_version()
|
|
980
977
|
|
|
978
|
+
@GeneralUtilities.check_arguments
|
|
979
|
+
def get_default_jre_version(self) -> str:
|
|
980
|
+
"""Returns the JRE-version used when no repository-specific version is pinned (for example when warming
|
|
981
|
+
the global cache via scdownloadcachabletools). The value is read from the version-file bundled with the
|
|
982
|
+
ScriptCollection-package."""
|
|
983
|
+
content = GeneralUtilities._internal_load_resource(TFCPS_Tools_General.__jre_version_resource_relative_path)
|
|
984
|
+
return content.decode("utf-8").strip()
|
|
985
|
+
|
|
981
986
|
@GeneralUtilities.check_arguments
|
|
982
987
|
def ensure_jre_is_available(self, enforce_update: bool, repository_folder: str = None) -> str:
|
|
983
988
|
"""Ensures the pinned JDK is available in the global cache for the executing platform and returns the absolute path
|
|
984
989
|
to its 'java'-executable. The version is the repository-specific pin if present, otherwise the bundled default (see
|
|
985
|
-
get_jre_version).
|
|
990
|
+
get_jre_version). Used by tools which need a locally-runnable, deterministically-versioned JRE (the PlantUML-diagram
|
|
991
|
+
rendering itself now always runs inside a Docker-container instead, see __run_plantuml_in_linux_container)."""
|
|
986
992
|
local_resource_name = "JRE"
|
|
987
993
|
jre_version = self.get_jre_version(repository_folder)
|
|
988
994
|
feature_version = jre_version.split(".")[0] # e.g. "21" from "21.0.6+7"
|
|
@@ -1040,7 +1046,7 @@ class TFCPS_Tools_General:
|
|
|
1040
1046
|
return java_executable
|
|
1041
1047
|
|
|
1042
1048
|
@GeneralUtilities.check_arguments
|
|
1043
|
-
def __generate_svg_files_from_plantuml(self, diagrams_files_folder: str, plantuml_jar_file: str,
|
|
1049
|
+
def __generate_svg_files_from_plantuml(self, diagrams_files_folder: str, plantuml_jar_file: str, repository_folder: str) -> None:
|
|
1044
1050
|
# Pin the font for all rendered diagrams via a PlantUML-config-file so the resulting SVG is identical across
|
|
1045
1051
|
# machines, without having to add a skinparam to every (also hand-written) .plantuml-file. See the comment at
|
|
1046
1052
|
# __default_diagram_font_name for the reason.
|
|
@@ -1050,17 +1056,22 @@ class TFCPS_Tools_General:
|
|
|
1050
1056
|
# font-version happens to be installed on the host. This makes the text-measurement - and thus the resulting
|
|
1051
1057
|
# SVG-geometry - identical across machines (e.g. a Windows-client and the Debian-build-container), because the
|
|
1052
1058
|
# exact same font-files are used everywhere.
|
|
1053
|
-
java_font_arguments: list[str] = []
|
|
1054
1059
|
bundled_fonts_folder = self.__extract_bundled_fonts_to_temp_folder()
|
|
1055
|
-
|
|
1056
|
-
|
|
1060
|
+
# Pinning the JDK-build and the font is sufficient to get byte-identical SVGs on Windows and Linux, because both
|
|
1061
|
+
# use the same FreeType-based font-rasterizer internally, so the AWT-font-metrics (in particular the vertical
|
|
1062
|
+
# ascent/descent used e.g. for the note-box-positioning) round identically there. macOS-builds of the JDK use
|
|
1063
|
+
# Apple's native CoreText font-manager instead, which rounds those vertical metrics slightly differently even
|
|
1064
|
+
# for the exact same pinned font-file and JDK-build, shifting positions in the rendered SVG by a fraction of a
|
|
1065
|
+
# pixel. To still get an identical result on macOS, the rendering itself does not run on a native macOS-JVM
|
|
1066
|
+
# there but inside a short-lived Docker-container that runs the Java-image the repository itself declares in
|
|
1067
|
+
# '.ScriptCollection/OCIImages/ImageDefinition.csv' (image-name 'Java', see __run_plantuml_in_linux_container) -
|
|
1068
|
+
# i.e. the diagram is always rendered by a Linux-JVM, regardless of host.
|
|
1057
1069
|
try:
|
|
1058
1070
|
for file in GeneralUtilities.get_all_files_of_folder(diagrams_files_folder):
|
|
1059
1071
|
if file.endswith(".plantuml"):
|
|
1060
1072
|
output_filename = self.get_output_filename_for_plantuml_filename(file)
|
|
1061
|
-
argument = java_font_arguments + ['-jar',plantuml_jar_file, '-tsvg', '-config', font_config_file, os.path.basename(file)]
|
|
1062
1073
|
folder = os.path.dirname(file)
|
|
1063
|
-
self.
|
|
1074
|
+
self.__run_plantuml_in_linux_container(folder, os.path.basename(file), plantuml_jar_file, font_config_file, bundled_fonts_folder, repository_folder)
|
|
1064
1075
|
result_file = folder+"/" + output_filename
|
|
1065
1076
|
GeneralUtilities.assert_file_exists(result_file)
|
|
1066
1077
|
self.__sc.format_xml_file(result_file)
|
|
@@ -1069,6 +1080,28 @@ class TFCPS_Tools_General:
|
|
|
1069
1080
|
if bundled_fonts_folder is not None:
|
|
1070
1081
|
GeneralUtilities.ensure_directory_does_not_exist(bundled_fonts_folder)
|
|
1071
1082
|
|
|
1083
|
+
@GeneralUtilities.check_arguments
|
|
1084
|
+
def __run_plantuml_in_linux_container(self, folder: str, plantuml_filename: str, plantuml_jar_file: str, font_config_file: str, bundled_fonts_folder: str, repository_folder: str) -> None:
|
|
1085
|
+
"""Renders a single .plantuml-file into a svg-file by running PlantUML inside a short-lived, disposable Docker-
|
|
1086
|
+
container. All diagram-rendering happens this way, regardless of the host-platform (see __generate_svg_files_from_plantuml
|
|
1087
|
+
for why this is required to get byte-identical results on Windows/Linux/macOS). The image is not hardcoded here: every
|
|
1088
|
+
repository must declare it itself as the image named 'Java' in '<repository>/.ScriptCollection/OCIImages/ImageDefinition.csv'
|
|
1089
|
+
(the same mechanism used for e.g. 'Betterleaks'/'SCBuilder', see __search_for_secrets_in_repository/build_codeunits_in_container
|
|
1090
|
+
in TFCPS_CodeUnit_BuildCodeUnits), so a repository can pin the exact JDK-build it wants rendered with. The bundled font and
|
|
1091
|
+
the font-config are mounted into the container; no network-access is required inside the container for this."""
|
|
1092
|
+
docker_image = self.oci_image_manager.get_registry_address_for_image_with_default_tag(repository_folder, "Java")
|
|
1093
|
+
container_jar_file = "/opt/plantuml.jar"
|
|
1094
|
+
container_font_config_file = "/opt/font-config.cfg"
|
|
1095
|
+
container_fonts_folder = "/opt/fonts"
|
|
1096
|
+
container_work_folder = "/work"
|
|
1097
|
+
docker_arguments = ["run", "--rm", "-v", f"{plantuml_jar_file}:{container_jar_file}:ro", "-v", f"{font_config_file}:{container_font_config_file}:ro", "-v", f"{folder}:{container_work_folder}", "-w", container_work_folder]
|
|
1098
|
+
java_font_arguments: list[str] = []
|
|
1099
|
+
if bundled_fonts_folder is not None:
|
|
1100
|
+
docker_arguments = docker_arguments+["-v", f"{bundled_fonts_folder}:{container_fonts_folder}:ro"]
|
|
1101
|
+
java_font_arguments = [f"-Dsun.java2d.fontpath=prepend:{container_fonts_folder}"]
|
|
1102
|
+
docker_arguments = docker_arguments+[docker_image, "java"]+java_font_arguments+["-jar", container_jar_file, "-tsvg", "-config", container_font_config_file, plantuml_filename]
|
|
1103
|
+
self.__sc.run_program_argsasarray("docker", docker_arguments)
|
|
1104
|
+
|
|
1072
1105
|
@GeneralUtilities.check_arguments
|
|
1073
1106
|
def __extract_bundled_fonts_to_temp_folder(self) -> str:
|
|
1074
1107
|
# Extracts the DejaVu-fonts bundled with the ScriptCollection-package into a temporary folder and returns its path
|
|
@@ -1791,16 +1824,8 @@ class TFCPS_Tools_General:
|
|
|
1791
1824
|
(for example when warming the global cache via scdownloadcachabletools). The value is read from
|
|
1792
1825
|
'<repo>/Other/Resources/Dependencies/OpenAPIGenerator/Version.txt', which the build copies into the
|
|
1793
1826
|
ScriptCollection.Resources-package so it is available at runtime from the installed wheel."""
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
content = GeneralUtilities._internal_load_resource(TFCPS_Tools_General.__openapigenerator_version_resource_relative_path)
|
|
1797
|
-
return content.decode("utf-8").strip()
|
|
1798
|
-
except (FileNotFoundError, ModuleNotFoundError):
|
|
1799
|
-
# Fallback for running from an unbuilt source-checkout where the file has not been copied into the
|
|
1800
|
-
# package-resources yet: read the human-editable source-file directly from the repository.
|
|
1801
|
-
source_version_file = GeneralUtilities.resolve_relative_path(f"../../../Other/Resources/{TFCPS_Tools_General.__openapigenerator_version_resource_relative_path}", os.path.dirname(__file__))
|
|
1802
|
-
GeneralUtilities.assert_file_exists(source_version_file)
|
|
1803
|
-
return GeneralUtilities.read_text_from_file(source_version_file).strip()
|
|
1827
|
+
content = GeneralUtilities._internal_load_resource(TFCPS_Tools_General.__openapigenerator_version_resource_relative_path)
|
|
1828
|
+
return content.decode("utf-8").strip()
|
|
1804
1829
|
|
|
1805
1830
|
@GeneralUtilities.check_arguments
|
|
1806
1831
|
def update_images_in_example_with_default_excluded(self, codeunit_folder: str,custom_updater:AbstractImageHandler):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scriptcollection
|
|
3
|
-
Version: 4.4.
|
|
3
|
+
Version: 4.4.22
|
|
4
4
|
Summary: The ScriptCollection is the place for reusable scripts.
|
|
5
5
|
Author-email: Marius Göcke <marius.goecke@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/anionDev/ScriptCollection
|
|
@@ -12,7 +12,7 @@ ScriptCollection/ProgramRunnerSudo.py,sha256=ot9Ib-plQ8wejR9M2XXfnx6GR-va9k8SH1g
|
|
|
12
12
|
ScriptCollection/RepositoryDiagramGenerator.py,sha256=K_u2NW_p4ozdWD50irJEkkcDVa70TcUJpZN63TeXSLw,7092
|
|
13
13
|
ScriptCollection/RepositoryHistoryAnalyzer.py,sha256=rD8eC5lMUe5MHmCBHfYft_G-N9IbvtsFGkU7EMwPjrY,5779
|
|
14
14
|
ScriptCollection/SCLog.py,sha256=Fjf8Pdi63cXHGMxL_aI6A0dwGm7QIfrv3czjvpSUlaM,4705
|
|
15
|
-
ScriptCollection/ScriptCollectionCore.py,sha256
|
|
15
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=-NV8HHdUfqHruXRTP5iDf7QY9pOzInHEGa4poFeIwMU,272058
|
|
16
16
|
ScriptCollection/TestKind.py,sha256=EBTLR8yBz5VmWA2NZIpDTbQNg6tkfv_kAsIzEJ--mCI,1756
|
|
17
17
|
ScriptCollection/UnassignedVariablesCheck.py,sha256=8xNcp1D5HeOLO1a1NEerq2TsnpFhw7yzYPkaay-oisY,3804
|
|
18
18
|
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -42,7 +42,7 @@ ScriptCollection/TFCPS/SCTaskRunnerServer.py,sha256=tub8_1QBu0nWAaGnBWp2nErOW-SO
|
|
|
42
42
|
ScriptCollection/TFCPS/TFCPS_BuildCodeUnitsHook.py,sha256=67_DQwoH5bhxxSmwtuAeoW1NOCMiLMzOy48OqlJX-KY,1744
|
|
43
43
|
ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=aCfGCbevCOV1IJ444dhvwJkGDKQNH3mqIucPAuSUq-o,40149
|
|
44
44
|
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=Mj9t1SyRpkYZE74cLsGWYv4xB89gXL2ld-RX3xvvGdw,9835
|
|
45
|
-
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=
|
|
45
|
+
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=8AZoZ-A0nHoAIV6xa142GO2ppjsWuwDEFT1bNmAPGTU,48870
|
|
46
46
|
ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=kpEmSnfzfgB4OjcCuS_X6jgW_ftcphxEnjjoLoAHTLY,6582
|
|
47
47
|
ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=mRBcf7XuNWOSXbZYc3NuJow18AMZ30D6Z-BtyNYfNcM,2072
|
|
48
48
|
ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=Krt5oyGNcRAN3szsgU7LoTh8yVTOdHW-Kq7R9MDDV-Q,7673
|
|
@@ -50,7 +50,7 @@ ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=oYEhz5ZWMnbu97_CcYEqdDxakUF
|
|
|
50
50
|
ScriptCollection/TFCPS/TFCPS_OCIImageSecretScan.py,sha256=rhw0glr4gZ5enG9faOD51xE4MMK1cIdNjUdaswiMsrY,14622
|
|
51
51
|
ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=XLVsFTA1jvfDbZ7wYJgIdEByZhF_bYVbA5jkisuvK4k,2322
|
|
52
52
|
ScriptCollection/TFCPS/TFCPS_RemoteBuild.py,sha256=gQQbk7Va7c_0VL2pu_UYM-GPkbQxe0vvs2D_gJdZulI,21103
|
|
53
|
-
ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=
|
|
53
|
+
ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=vLqP2EuLOWILRDI2MQZF-ryRetbn21f-k_BukAlhuNQ,169373
|
|
54
54
|
ScriptCollection/TFCPS/TFCPS_VisualRegressionTests.py,sha256=6_63udxHnPlu_TMk_ftLZTnzriJO8MCxVCVAsweZqHs,37073
|
|
55
55
|
ScriptCollection/TFCPS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
56
|
ScriptCollection/TFCPS/CPP/TFCPS_CodeUnitSpecific_CPP.py,sha256=4skj2I73VOo93HMXcBuWmdyuoE9zjqr2H_DtsYrcvNo,16375
|
|
@@ -76,8 +76,8 @@ ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=yyjWPMHQjPLkML
|
|
|
76
76
|
ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
77
77
|
ScriptCollection/TFCPS/TypeScript/TFCPS_CodeUnitSpecific_TypeScript.py,sha256=5z990qyO5durX07xRWRwju1hl6wpjQAy2f-yRwJ-7s0,11856
|
|
78
78
|
ScriptCollection/TFCPS/TypeScript/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
79
|
-
scriptcollection-4.4.
|
|
80
|
-
scriptcollection-4.4.
|
|
81
|
-
scriptcollection-4.4.
|
|
82
|
-
scriptcollection-4.4.
|
|
83
|
-
scriptcollection-4.4.
|
|
79
|
+
scriptcollection-4.4.22.dist-info/METADATA,sha256=OuQdjS2Vp-rR1ljx7aw92t49LnCzQN8AxFvPEzQFXMo,7690
|
|
80
|
+
scriptcollection-4.4.22.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
81
|
+
scriptcollection-4.4.22.dist-info/entry_points.txt,sha256=GNma7tN0J59EvK71su-G1w22RnZ05bXcPrELyLx3AL0,6151
|
|
82
|
+
scriptcollection-4.4.22.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
|
83
|
+
scriptcollection-4.4.22.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|