ScriptCollection 4.4.70__py3-none-any.whl → 4.4.72__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 +3 -3
- ScriptCollection/GeneralUtilities.py +42 -0
- ScriptCollection/OCIImages/AbstractImageHandler.py +14 -26
- ScriptCollection/OCIImages/AbstractTagPatternImageHandler.py +46 -0
- ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerDebian.py +5 -14
- ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerDebianSlim.py +5 -14
- ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerGeneric.py +6 -15
- ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerGenericV.py +6 -15
- ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerGitlabCE.py +7 -8
- ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerGitlabEE.py +7 -8
- ScriptCollection/OCIImages/OCIImageManager.py +73 -68
- ScriptCollection/OCIImages/OCIRegistryClient.py +117 -0
- ScriptCollection/ScriptCollectionCore.py +19 -11
- ScriptCollection/TFCPS/Android/TFCPS_CodeUnitSpecific_Android.py +375 -0
- ScriptCollection/TFCPS/Android/__init__.py +0 -0
- ScriptCollection/TFCPS/CPP/TFCPS_CodeUnitSpecific_CPP.py +5 -4
- ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py +38 -4
- ScriptCollection/TFCPS/Maven/TFCPS_CodeUnitSpecific_Maven.py +1 -0
- ScriptCollection/TFCPS/Rust/CargoLockFile.py +151 -0
- ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py +5 -0
- ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py +1 -0
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py +14 -0
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py +20 -1
- ScriptCollection/TFCPS/TFCPS_Tools_General.py +15 -2
- {scriptcollection-4.4.70.dist-info → scriptcollection-4.4.72.dist-info}/METADATA +177 -177
- {scriptcollection-4.4.70.dist-info → scriptcollection-4.4.72.dist-info}/RECORD +29 -24
- {scriptcollection-4.4.70.dist-info → scriptcollection-4.4.72.dist-info}/WHEEL +0 -0
- {scriptcollection-4.4.70.dist-info → scriptcollection-4.4.72.dist-info}/entry_points.txt +0 -0
- {scriptcollection-4.4.70.dist-info → scriptcollection-4.4.72.dist-info}/top_level.txt +0 -0
|
@@ -4,6 +4,7 @@ from urllib import request
|
|
|
4
4
|
import time
|
|
5
5
|
import ssl
|
|
6
6
|
from datetime import timedelta,datetime
|
|
7
|
+
from typing import Callable
|
|
7
8
|
from ...GeneralUtilities import GeneralUtilities, Platform
|
|
8
9
|
from ...SCLog import LogLevel
|
|
9
10
|
from ..TFCPS_CodeUnitSpecific_Base import TFCPS_CodeUnitSpecific_Base,TFCPS_CodeUnitSpecific_Base_CLI
|
|
@@ -11,8 +12,13 @@ from ..TFCPS_CodeUnitSpecific_Base import TFCPS_CodeUnitSpecific_Base,TFCPS_Code
|
|
|
11
12
|
|
|
12
13
|
class TFCPS_CodeUnitSpecific_Docker_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
13
14
|
|
|
15
|
+
# Maps the name of a dependency (the name of its folder in "Other/Resources/Dependencies") to the function which returns its
|
|
16
|
+
# available versions. The function gets the currently used version as argument.
|
|
17
|
+
__available_versions_functions:dict[str,Callable[[str],list[str]]]=None
|
|
18
|
+
|
|
14
19
|
def __init__(self,current_file:str,verbosity:LogLevel,targetenvironmenttype:str,use_cache:bool,is_pre_merge:bool):
|
|
15
20
|
super().__init__(current_file, verbosity,targetenvironmenttype,use_cache,is_pre_merge)
|
|
21
|
+
self.__available_versions_functions=dict[str,Callable[[str],list[str]]]()
|
|
16
22
|
|
|
17
23
|
@GeneralUtilities.check_arguments
|
|
18
24
|
def build(self,platforms:list[Platform],custom_arguments:dict[str,str]) -> None:
|
|
@@ -135,17 +141,45 @@ class TFCPS_CodeUnitSpecific_Docker_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
135
141
|
def run_testcases(self) -> None:
|
|
136
142
|
pass#TODO
|
|
137
143
|
|
|
144
|
+
@GeneralUtilities.check_arguments
|
|
145
|
+
def register_available_versions_function(self,dependency_name:str,available_versions_function:Callable[[str],list[str]])->None:
|
|
146
|
+
"""Registers the function which returns the available versions of the given dependency.
|
|
147
|
+
The dependencies of a docker-codeunit are the folders in "Other/Resources/Dependencies", and there is no general way to find out
|
|
148
|
+
where the available versions of such a dependency come from (npm, nuget, pypi, the tags of a git-repository, ...). So the
|
|
149
|
+
"Other/UpdateDependencies.py"-script of the codeunit registers one function per dependency before it calls update_dependencies.
|
|
150
|
+
The function gets the currently used version as argument and must return only versions in the format "<major>.<minor>.<patch>"."""
|
|
151
|
+
GeneralUtilities.assert_condition(dependency_name not in self.__available_versions_functions,f"A function for the available versions of dependency {dependency_name} is already registered.")
|
|
152
|
+
self.__available_versions_functions[dependency_name]=available_versions_function
|
|
153
|
+
|
|
154
|
+
@GeneralUtilities.check_arguments
|
|
155
|
+
def __get_dependencies_folder(self)->str:
|
|
156
|
+
return os.path.join(self.get_codeunit_folder(),"Other","Resources","Dependencies")
|
|
157
|
+
|
|
138
158
|
@GeneralUtilities.check_arguments
|
|
139
159
|
def get_dependencies(self)->dict[str,set[str]]:
|
|
140
|
-
|
|
141
|
-
|
|
160
|
+
"""Returns the dependencies which are pinned in "Other/Resources/Dependencies/<dependency>/Version.txt"."""
|
|
161
|
+
result:dict[str,set[str]]=dict[str,set[str]]()
|
|
162
|
+
dependencies_folder:str=self.__get_dependencies_folder()
|
|
163
|
+
if not os.path.isdir(dependencies_folder):
|
|
164
|
+
return result
|
|
165
|
+
resources_folder:str=os.path.dirname(dependencies_folder)
|
|
166
|
+
for dependency_name in sorted(os.listdir(dependencies_folder)):
|
|
167
|
+
if os.path.isfile(os.path.join(dependencies_folder,dependency_name,"Version.txt")):
|
|
168
|
+
result[dependency_name]={self.tfcps_Tools_General.get_dependency_version_in_resources_folder(resources_folder,dependency_name)}
|
|
169
|
+
return result
|
|
170
|
+
|
|
142
171
|
@GeneralUtilities.check_arguments
|
|
143
172
|
def get_available_versions(self,dependencyname:str)->list[str]:
|
|
144
|
-
|
|
173
|
+
if dependencyname not in self.__available_versions_functions:
|
|
174
|
+
raise ValueError(f"No function for the available versions of dependency {dependencyname} is registered. Register one using register_available_versions_function or add the dependency to the ignored dependencies in the codeunit-file.")
|
|
175
|
+
current_version:str=next(iter(self.get_dependencies()[dependencyname]))
|
|
176
|
+
return self.__available_versions_functions[dependencyname](current_version)
|
|
145
177
|
|
|
146
178
|
@GeneralUtilities.check_arguments
|
|
147
179
|
def set_dependency_version(self,name:str,new_version:str)->None:
|
|
148
|
-
|
|
180
|
+
version_file:str=os.path.join(self.__get_dependencies_folder(),name,"Version.txt")
|
|
181
|
+
GeneralUtilities.assert_file_exists(version_file)
|
|
182
|
+
GeneralUtilities.write_text_to_file(version_file,new_version)
|
|
149
183
|
|
|
150
184
|
@GeneralUtilities.check_arguments
|
|
151
185
|
@GeneralUtilities.deprecated("Use image_is_working_via_network instead, which tests the image over a user-defined docker-network without publishing a host-port.")
|
|
@@ -58,6 +58,7 @@ class TFCPS_CodeUnitSpecific_Maven_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
58
58
|
|
|
59
59
|
@GeneralUtilities.check_arguments
|
|
60
60
|
def linting(self) -> None:
|
|
61
|
+
self._protected_sc.normalize_invisible_characters_of_files_in_folder(self.get_codeunit_folder(), ["java"])
|
|
61
62
|
# checkstyle is configured in the pom-file of the codeunit, so that the ruleset belongs to the codeunit
|
|
62
63
|
# and not to this implementation.
|
|
63
64
|
self.__run_maven("-B checkstyle:check")
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import re
|
|
3
|
+
import tomllib
|
|
4
|
+
from ...GeneralUtilities import GeneralUtilities
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class CargoLockFile:
|
|
8
|
+
"""Synchronizes the versions of the local packages in a "Cargo.lock"-file with the versions which their
|
|
9
|
+
"Cargo.toml"-files declare.
|
|
10
|
+
|
|
11
|
+
A local package is a package which is not resolved from a registry or a git-repository: the cargo-project itself
|
|
12
|
+
and every path-dependency (directly or transitively). Cargo writes such a package into the lock-file without a
|
|
13
|
+
"source"-entry, together with the version its cargo-file declared at the time the lock-file was written. When the
|
|
14
|
+
version in a cargo-file changes (which happens on every new version of a codeunit), the lock-file is outdated and
|
|
15
|
+
a build with "--locked" fails. Cargo can not update the lock-file without being allowed to resolve the dependencies
|
|
16
|
+
again, so the versions of the local packages are adjusted textually here: everything else in the lock-file stays
|
|
17
|
+
exactly as it is, no network-access is required and running it again does not change anything anymore."""
|
|
18
|
+
|
|
19
|
+
__dependency_sections: tuple = ("dependencies", "dev-dependencies", "build-dependencies")
|
|
20
|
+
# Cargo uses this version for a package whose cargo-file does not declare a version
|
|
21
|
+
# (see https://doc.rust-lang.org/cargo/reference/manifest.html#the-version-field).
|
|
22
|
+
__version_of_package_without_declared_version: str = "0.0.0"
|
|
23
|
+
|
|
24
|
+
@staticmethod
|
|
25
|
+
@GeneralUtilities.check_arguments
|
|
26
|
+
def synchronize_versions_of_local_packages(cargo_file: str) -> None:
|
|
27
|
+
"""Sets the version of every local package in the lock-file next to the given cargo-file to the version
|
|
28
|
+
which the cargo-file of that package declares. A cargo-project without lock-file (for example a library,
|
|
29
|
+
which usually does not commit its lock-file) is left as it is."""
|
|
30
|
+
lock_file = os.path.join(os.path.dirname(cargo_file), "Cargo.lock")
|
|
31
|
+
if os.path.isfile(lock_file):
|
|
32
|
+
CargoLockFile.set_versions_of_local_packages(lock_file, CargoLockFile.get_versions_of_local_packages(cargo_file))
|
|
33
|
+
|
|
34
|
+
@staticmethod
|
|
35
|
+
@GeneralUtilities.check_arguments
|
|
36
|
+
def get_versions_of_local_packages(cargo_file: str) -> dict[str, str]:
|
|
37
|
+
"""Returns the names and the versions of the package of the given cargo-file and of all of its (also
|
|
38
|
+
transitive) path-dependencies, read from their cargo-files."""
|
|
39
|
+
result: dict[str, str] = {}
|
|
40
|
+
CargoLockFile.__add_versions_of_local_packages(os.path.abspath(cargo_file), result, set())
|
|
41
|
+
return result
|
|
42
|
+
|
|
43
|
+
@staticmethod
|
|
44
|
+
@GeneralUtilities.check_arguments
|
|
45
|
+
def __add_versions_of_local_packages(cargo_file: str, result: dict[str, str], visited_cargo_files: set[str]) -> None:
|
|
46
|
+
if cargo_file in visited_cargo_files:
|
|
47
|
+
return
|
|
48
|
+
visited_cargo_files.add(cargo_file)
|
|
49
|
+
GeneralUtilities.assert_file_exists(cargo_file, f'The cargo-file "{cargo_file}" does not exist. If it belongs to a dependent codeunit, then this codeunit must be built before.')
|
|
50
|
+
content: dict = tomllib.loads(GeneralUtilities.read_text_from_file(cargo_file))
|
|
51
|
+
package: dict = content.get("package")
|
|
52
|
+
GeneralUtilities.assert_condition(package is not None, f'The cargo-file "{cargo_file}" does not contain a package-section.')
|
|
53
|
+
version = package.get("version", CargoLockFile.__version_of_package_without_declared_version)
|
|
54
|
+
GeneralUtilities.assert_condition(isinstance(version, str), f'The version of the package in "{cargo_file}" is not declared as plain version-string, which is not supported.')
|
|
55
|
+
result[package["name"]] = version
|
|
56
|
+
cargo_project_folder = os.path.dirname(cargo_file)
|
|
57
|
+
for relative_path in CargoLockFile.__get_paths_of_path_dependencies(content):
|
|
58
|
+
dependency_cargo_file = os.path.abspath(os.path.join(cargo_project_folder, relative_path, "Cargo.toml"))
|
|
59
|
+
CargoLockFile.__add_versions_of_local_packages(dependency_cargo_file, result, visited_cargo_files)
|
|
60
|
+
|
|
61
|
+
@staticmethod
|
|
62
|
+
@GeneralUtilities.check_arguments
|
|
63
|
+
def __get_paths_of_path_dependencies(cargo_file_content: dict) -> list[str]:
|
|
64
|
+
# Dependencies can be declared in the top-level-sections and in the target-specific sections
|
|
65
|
+
# (for example "[target.'cfg(windows)'.dependencies]").
|
|
66
|
+
dependency_tables: list[dict] = [cargo_file_content.get(section, {}) for section in CargoLockFile.__dependency_sections]
|
|
67
|
+
for target_content in cargo_file_content.get("target", {}).values():
|
|
68
|
+
dependency_tables.extend(target_content.get(section, {}) for section in CargoLockFile.__dependency_sections)
|
|
69
|
+
result: list[str] = []
|
|
70
|
+
for dependency_table in dependency_tables:
|
|
71
|
+
for declaration in dependency_table.values():
|
|
72
|
+
if isinstance(declaration, dict) and "path" in declaration:
|
|
73
|
+
result.append(declaration["path"])
|
|
74
|
+
return result
|
|
75
|
+
|
|
76
|
+
@staticmethod
|
|
77
|
+
@GeneralUtilities.check_arguments
|
|
78
|
+
def set_versions_of_local_packages(lock_file: str, versions_of_local_packages: dict[str, str]) -> None:
|
|
79
|
+
"""Sets the version of every package of the lock-file which has no source and whose name is contained in
|
|
80
|
+
the given dictionary to the version stated there. A package of the lock-file which is not contained in the
|
|
81
|
+
dictionary is not changed. The line-endings and all other lines of the lock-file are preserved."""
|
|
82
|
+
lines: list[str] = GeneralUtilities.read_text_from_file(lock_file).splitlines(keepends=True)
|
|
83
|
+
packages = CargoLockFile.__parse_packages(lines)
|
|
84
|
+
changed_references: dict[str, str] = {}
|
|
85
|
+
for package in packages:
|
|
86
|
+
name: str = package["name"]
|
|
87
|
+
if package["has_source"] or name not in versions_of_local_packages or package["version_line_index"] is None:
|
|
88
|
+
continue
|
|
89
|
+
old_version: str = package["version"]
|
|
90
|
+
new_version: str = versions_of_local_packages[name]
|
|
91
|
+
if old_version != new_version:
|
|
92
|
+
line_index: int = package["version_line_index"]
|
|
93
|
+
lines[line_index] = CargoLockFile.__replace_quoted_value(lines[line_index], old_version, new_version)
|
|
94
|
+
# A dependency is referenced as "<name> <version>" instead of "<name>" when the lock-file contains
|
|
95
|
+
# several packages with this name. Such a reference must be changed together with the version. When a
|
|
96
|
+
# package from a registry has the same name and the same old version, then the reference can not be
|
|
97
|
+
# assigned unambiguously to the local package, so it is not changed.
|
|
98
|
+
if not any(other["has_source"] and other["name"] == name and other["version"] == old_version for other in packages):
|
|
99
|
+
changed_references[f"{name} {old_version}"] = f"{name} {new_version}"
|
|
100
|
+
if len(changed_references) > 0:
|
|
101
|
+
for package in packages:
|
|
102
|
+
for line_index in range(package["start_line_index"], package["end_line_index"]):
|
|
103
|
+
lines[line_index] = CargoLockFile.__replace_dependency_reference(lines[line_index], changed_references)
|
|
104
|
+
GeneralUtilities.write_text_to_file(lock_file, "".join(lines))
|
|
105
|
+
|
|
106
|
+
@staticmethod
|
|
107
|
+
@GeneralUtilities.check_arguments
|
|
108
|
+
def __parse_packages(lines: list[str]) -> list[dict]:
|
|
109
|
+
"""Returns the "[[package]]"-entries of the lines of a lock-file with their name, their version, the index of
|
|
110
|
+
the line which contains the version, the information whether they have a source and the range of their
|
|
111
|
+
lines (the end-index is exclusive)."""
|
|
112
|
+
result: list[dict] = []
|
|
113
|
+
current_package: dict = None
|
|
114
|
+
for line_index, line in enumerate(lines):
|
|
115
|
+
stripped_line = line.strip()
|
|
116
|
+
if stripped_line.startswith("["):
|
|
117
|
+
if current_package is not None:
|
|
118
|
+
current_package["end_line_index"] = line_index
|
|
119
|
+
result.append(current_package)
|
|
120
|
+
current_package = None
|
|
121
|
+
if stripped_line == "[[package]]":
|
|
122
|
+
current_package = {"name": None, "version": None, "version_line_index": None, "has_source": False, "start_line_index": line_index}
|
|
123
|
+
continue
|
|
124
|
+
if current_package is None:
|
|
125
|
+
continue
|
|
126
|
+
match = re.match(r'^(name|version|source)\s*=\s*"([^"]*)"$', stripped_line)
|
|
127
|
+
if match is not None:
|
|
128
|
+
key = match.group(1)
|
|
129
|
+
if key == "source":
|
|
130
|
+
current_package["has_source"] = True
|
|
131
|
+
else:
|
|
132
|
+
current_package[key] = match.group(2)
|
|
133
|
+
if key == "version":
|
|
134
|
+
current_package["version_line_index"] = line_index
|
|
135
|
+
if current_package is not None:
|
|
136
|
+
current_package["end_line_index"] = len(lines)
|
|
137
|
+
result.append(current_package)
|
|
138
|
+
return result
|
|
139
|
+
|
|
140
|
+
@staticmethod
|
|
141
|
+
@GeneralUtilities.check_arguments
|
|
142
|
+
def __replace_quoted_value(line: str, old_value: str, new_value: str) -> str:
|
|
143
|
+
return line.replace(f'"{old_value}"', f'"{new_value}"', 1)
|
|
144
|
+
|
|
145
|
+
@staticmethod
|
|
146
|
+
@GeneralUtilities.check_arguments
|
|
147
|
+
def __replace_dependency_reference(line: str, changed_references: dict[str, str]) -> str:
|
|
148
|
+
match = re.match(r'^(\s*)"([^"]+)"(.*)$', line, re.DOTALL)
|
|
149
|
+
if match is not None and match.group(2) in changed_references:
|
|
150
|
+
return f'{match.group(1)}"{changed_references[match.group(2)]}"{match.group(3)}'
|
|
151
|
+
return line
|
|
@@ -6,6 +6,7 @@ from lxml import etree
|
|
|
6
6
|
from ...GeneralUtilities import GeneralUtilities, Dependency
|
|
7
7
|
from ...SCLog import LogLevel
|
|
8
8
|
from ..TFCPS_CodeUnitSpecific_Base import TFCPS_CodeUnitSpecific_Base, TFCPS_CodeUnitSpecific_Base_CLI
|
|
9
|
+
from .CargoLockFile import CargoLockFile
|
|
9
10
|
|
|
10
11
|
class TFCPS_CodeUnitSpecific_Rust_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
11
12
|
"""Implements the tasks of a codeunit which contains a cargo-project.
|
|
@@ -65,6 +66,7 @@ class TFCPS_CodeUnitSpecific_Rust_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
65
66
|
|
|
66
67
|
@GeneralUtilities.check_arguments
|
|
67
68
|
def linting(self) -> None:
|
|
69
|
+
self._protected_sc.normalize_invisible_characters_of_files_in_folder(self.get_codeunit_folder(), ["rs"])
|
|
68
70
|
# "--all-targets" includes the testcases in the check, and "-D warnings" makes clippy exit with a non-zero
|
|
69
71
|
# exit-code for a warning as well, because a warning is a linting-issue too.
|
|
70
72
|
self.__run_cargo("clippy --all-targets --all-features -- -D warnings")
|
|
@@ -73,6 +75,9 @@ class TFCPS_CodeUnitSpecific_Rust_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
73
75
|
def do_common_tasks(self, current_codeunit_version: str) -> None:
|
|
74
76
|
self.do_common_tasks_base(current_codeunit_version)
|
|
75
77
|
self.__set_version_in_cargo_file(self.get_version_of_project())
|
|
78
|
+
# The lock-file contains the versions of the local packages (this project and its path-dependencies, for
|
|
79
|
+
# example the copies of dependent codeunits), so it must be adjusted to the versions of their cargo-files.
|
|
80
|
+
CargoLockFile.synchronize_versions_of_local_packages(self.get_cargo_file())
|
|
76
81
|
|
|
77
82
|
@GeneralUtilities.check_arguments
|
|
78
83
|
def generate_reference(self) -> None:
|
|
@@ -102,6 +102,7 @@ class TFCPS_CodeUnitSpecific_Base(ABC):
|
|
|
102
102
|
if len(dependency_versions)==1:
|
|
103
103
|
GeneralUtilities.write_message_to_stdout("Update dependency "+dependencyname+" (which is currently used in version "+dependency_version+") to version "+desired_version+".")
|
|
104
104
|
self.set_dependency_version(dependencyname,desired_version)
|
|
105
|
+
self.tfcps_Tools_General.log_newer_major_versions_of_dependency(dependencyname,available_versions,desired_version)
|
|
105
106
|
except Exception:
|
|
106
107
|
GeneralUtilities.write_message_to_stderr(f"Error while updating {dependencyname}.")
|
|
107
108
|
raise
|
|
@@ -34,6 +34,19 @@ class TFCPS_CodeUnit_BuildCodeUnit:
|
|
|
34
34
|
self.is_pre_merge=is_pre_merge
|
|
35
35
|
self.fast_lane=fast_lane
|
|
36
36
|
|
|
37
|
+
def __check_article_links(self) -> None:
|
|
38
|
+
reference_content_folder: str = os.path.join(self.codeunit_folder, "Other", "Reference", "ReferenceContent")
|
|
39
|
+
articles_folder: str = os.path.join(reference_content_folder, "Articles")
|
|
40
|
+
if not os.path.isdir(articles_folder):
|
|
41
|
+
return
|
|
42
|
+
index_file: str = os.path.join(reference_content_folder, "index.md")
|
|
43
|
+
index_content: str = GeneralUtilities.read_text_from_file(index_file)
|
|
44
|
+
GeneralUtilities.assert_file_exists(index_file)
|
|
45
|
+
for article_file in sorted(os.listdir(articles_folder)):
|
|
46
|
+
if article_file.lower().endswith(".md") and os.path.isfile(os.path.join(articles_folder, article_file)):
|
|
47
|
+
if f"(./Articles/{article_file})" not in index_content:
|
|
48
|
+
self.sc.log.log(f"Article \"{article_file}\" is not linked in \"{index_file}\".", LogLevel.Warning)
|
|
49
|
+
|
|
37
50
|
@GeneralUtilities.check_arguments
|
|
38
51
|
def build_codeunit(self) -> None:
|
|
39
52
|
codeunit_file: str = str(os.path.join(self.codeunit_folder, f"{self.codeunit_name}.codeunit.xml"))
|
|
@@ -77,6 +90,7 @@ class TFCPS_CodeUnit_BuildCodeUnit:
|
|
|
77
90
|
self.sc.log.log(line, LogLevel.Warning)
|
|
78
91
|
for line in GeneralUtilities.string_to_lines(linting_result[2]):
|
|
79
92
|
self.sc.log.log(line, LogLevel.Warning)
|
|
93
|
+
self.__check_article_links()
|
|
80
94
|
|
|
81
95
|
self.sc.log.log("Generate reference...")
|
|
82
96
|
try:
|
|
@@ -383,7 +383,7 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
383
383
|
self.sc.format_json_file(workspace_file)
|
|
384
384
|
|
|
385
385
|
#TODO add option to define exceptions (means: files which should not be normalized).
|
|
386
|
-
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"])
|
|
386
|
+
self.sc.normalize_invisible_characters_of_files_in_folder(self.repository, ["txt", "md", "py", "json", "jsonl", "xml", "svg", "csv", "yml", "yaml", "toml","gitignore", "gitattributes", "code-workspace", "plantuml"])
|
|
387
387
|
|
|
388
388
|
@GeneralUtilities.check_arguments
|
|
389
389
|
def is_working_branch(self)->bool:
|
|
@@ -441,6 +441,25 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
441
441
|
if os.path.isfile(openspec_configuration_file):
|
|
442
442
|
self.sc.log.log("Update openspec-instruction-files...")
|
|
443
443
|
self.sc.run_with_epew("openspec", "update --force", self.repository)
|
|
444
|
+
self.__replace_openspec_skill_links_by_copies()
|
|
445
|
+
|
|
446
|
+
@GeneralUtilities.check_arguments
|
|
447
|
+
def __replace_openspec_skill_links_by_copies(self) -> None:
|
|
448
|
+
"""openspec (since v2.0.0) writes its skills to '.agents/skills' and links them into the skill-folders of the configured tools
|
|
449
|
+
(for example '.claude/skills') if the operating-system allows to create symbolic links, otherwise it writes copies. openspec has no
|
|
450
|
+
option to always write copies, so the links are replaced by copies here. This way the content of the repository does not depend on
|
|
451
|
+
the operating-system on which the build ran.
|
|
452
|
+
The skill-folders of all tools are located in folders in the root of the repository whose names start with a dot, so only these
|
|
453
|
+
folders are searched (and not for example the codeunit-folders, which may contain large folders like 'node_modules').
|
|
454
|
+
Submodules are not changed, because their content belongs to another repository."""
|
|
455
|
+
shared_skills_folder: str = os.path.join(self.repository, ".agents", "skills")
|
|
456
|
+
if os.path.isdir(shared_skills_folder):
|
|
457
|
+
submodule_folders: list[str] = [os.path.join(self.repository, submodule) for submodule in self.sc.get_git_submodules(self.repository)]
|
|
458
|
+
for name in os.listdir(self.repository):
|
|
459
|
+
tool_folder: str = os.path.join(self.repository, name)
|
|
460
|
+
if name.startswith(".") and name not in [".git", ".agents"] and os.path.isdir(tool_folder) and not os.path.islink(tool_folder):
|
|
461
|
+
for replaced_link in GeneralUtilities.replace_symlinks_by_copies(tool_folder, shared_skills_folder, submodule_folders):
|
|
462
|
+
self.sc.log.log(f"Replaced symbolic link \"{replaced_link}\" by a copy of its target.", LogLevel.Debug)
|
|
444
463
|
|
|
445
464
|
@GeneralUtilities.check_arguments
|
|
446
465
|
def __validate_openspec(self,repository:str) -> None:
|
|
@@ -2091,11 +2091,11 @@ class TFCPS_Tools_General:
|
|
|
2091
2091
|
changelog_file = os.path.join(repository_folder, "Other", "Resources", "Changelog", f"v{current_version}.md")
|
|
2092
2092
|
if (not os.path.isfile(changelog_file)):
|
|
2093
2093
|
GeneralUtilities.ensure_file_exists(changelog_file)
|
|
2094
|
-
GeneralUtilities.write_text_to_file(changelog_file, """# Release notes
|
|
2094
|
+
GeneralUtilities.write_text_to_file(changelog_file, f"""# Release notes
|
|
2095
2095
|
|
|
2096
2096
|
## Changes
|
|
2097
2097
|
|
|
2098
|
-
- Updated
|
|
2098
|
+
- Updated submodule {submodule_name}.
|
|
2099
2099
|
""")
|
|
2100
2100
|
|
|
2101
2101
|
@GeneralUtilities.check_arguments
|
|
@@ -2111,6 +2111,19 @@ class TFCPS_Tools_General:
|
|
|
2111
2111
|
if current_version != latest_version:
|
|
2112
2112
|
GeneralUtilities.write_text_to_file(resrepo_commit_id_file, latest_version)
|
|
2113
2113
|
|
|
2114
|
+
@GeneralUtilities.check_arguments
|
|
2115
|
+
def log_newer_major_versions_of_dependency(self, dependency_name: str, available_versions: list[str], used_version: str) -> None:
|
|
2116
|
+
"""Logs if a newer major-version of the given dependency is available than the used one.
|
|
2117
|
+
An update with an echolon like LatestPatchOrLatestMinor does not take over a new major-version, so without this message it would not be visible that the dependency falls behind.
|
|
2118
|
+
Being 1 major-version behind is logged as information, being 2 or more major-versions behind is logged as warning.
|
|
2119
|
+
used_version is the version which is used after the update (if an update was done)."""
|
|
2120
|
+
amount_of_major_versions_behind: int = GeneralUtilities.get_amount_of_major_versions_behind(available_versions, used_version)
|
|
2121
|
+
if amount_of_major_versions_behind == 0:
|
|
2122
|
+
return
|
|
2123
|
+
loglevel: LogLevel = LogLevel.Information if amount_of_major_versions_behind == 1 else LogLevel.Warning
|
|
2124
|
+
latest_version: str = GeneralUtilities.get_latest_version(available_versions)
|
|
2125
|
+
self.__sc.log.log(f"Dependency {dependency_name} is used in version {used_version}, which is {amount_of_major_versions_behind} major-version(s) behind the latest available version {latest_version}. A new major-version has to be taken over deliberately.", loglevel)
|
|
2126
|
+
|
|
2114
2127
|
@GeneralUtilities.check_arguments
|
|
2115
2128
|
def get_dependencies_which_are_ignored_from_updates(self, codeunit_folder: str) -> list[str]:
|
|
2116
2129
|
self.assert_is_codeunit_folder(codeunit_folder)
|