ScriptCollection 4.2.143__py3-none-any.whl → 4.2.145__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 +21 -6
- ScriptCollection/Resources/Dependencies/JRE/Version.txt +1 -0
- ScriptCollection/Resources/Fonts/DejaVuSans-Bold.ttf +0 -0
- ScriptCollection/Resources/Fonts/DejaVuSans-BoldOblique.ttf +0 -0
- ScriptCollection/Resources/Fonts/DejaVuSans-Oblique.ttf +0 -0
- ScriptCollection/Resources/Fonts/DejaVuSans.ttf +0 -0
- ScriptCollection/Resources/Fonts/LICENSE.txt +187 -0
- ScriptCollection/ScriptCollectionCore.py +76 -31
- ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py +6 -0
- ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py +12 -2
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py +5 -1
- ScriptCollection/TFCPS/TFCPS_Tools_General.py +146 -5
- {scriptcollection-4.2.143.dist-info → scriptcollection-4.2.145.dist-info}/METADATA +1 -1
- {scriptcollection-4.2.143.dist-info → scriptcollection-4.2.145.dist-info}/RECORD +17 -11
- {scriptcollection-4.2.143.dist-info → scriptcollection-4.2.145.dist-info}/entry_points.txt +1 -0
- {scriptcollection-4.2.143.dist-info → scriptcollection-4.2.145.dist-info}/WHEEL +0 -0
- {scriptcollection-4.2.143.dist-info → scriptcollection-4.2.145.dist-info}/top_level.txt +0 -0
ScriptCollection/Executables.py
CHANGED
|
@@ -437,17 +437,16 @@ def PrintFileContent() -> int:
|
|
|
437
437
|
parser.add_argument('-e', '--encoding', required=False, default="utf-8")
|
|
438
438
|
parser.add_argument('-b', '--basefolder', required=False, default=".", help="Base-folder the excludedfolder-entries are relative to. Defaults to the current working-directory.")
|
|
439
439
|
parser.add_argument('-x', '--excludedfolder', action='append', default=[], help="A folder (relative to basefolder) whose files must not be read. Can be specified multiple times. Example: --excludedfolder .git --excludedfolder .claude --excludedfolder Other/Secrets")
|
|
440
|
+
parser.add_argument('-f', '--fromline', required=False, default=None, type=int, help="1-based line-number to start printing from (inclusive). Defaults to the first line.")
|
|
441
|
+
parser.add_argument('-t', '--toline', required=False, default=None, type=int, help="1-based line-number to stop printing at (inclusive). Defaults to the last line.")
|
|
440
442
|
args = parser.parse_args()
|
|
441
443
|
file = args.path
|
|
442
444
|
encoding = args.encoding
|
|
443
|
-
if not os.path.isfile(file):
|
|
444
|
-
GeneralUtilities.write_exception_to_stderr(f"File '{file}' does not exist.")
|
|
445
|
-
return 1
|
|
446
445
|
sc = ScriptCollectionCore()
|
|
447
|
-
if sc.
|
|
448
|
-
GeneralUtilities.write_message_to_stderr(f"Reading '{file}' is not allowed because it is located inside an excluded folder.")
|
|
446
|
+
if not sc.path_is_allowed_within_base_folder(file, args.basefolder, args.excludedfolder):
|
|
447
|
+
GeneralUtilities.write_message_to_stderr(f"Reading '{file}' is not allowed because it is not located inside the base-folder or it is located inside an excluded folder.")
|
|
449
448
|
return 1
|
|
450
|
-
GeneralUtilities.write_message_to_stdout(
|
|
449
|
+
GeneralUtilities.write_message_to_stdout(sc.get_file_content(file, encoding, args.fromline, args.toline))
|
|
451
450
|
return 0
|
|
452
451
|
|
|
453
452
|
|
|
@@ -473,6 +472,22 @@ def CreateFolder() -> int:
|
|
|
473
472
|
return 0
|
|
474
473
|
|
|
475
474
|
|
|
475
|
+
def CreateSkill() -> int:
|
|
476
|
+
parser = argparse.ArgumentParser(description="Creates a skill ('skills/<name>/' with a lightweight 'skill.json' and a lazy-loaded 'detail.md'). The skill is created in the given repository-folder, or - if none is given - in the current working-directory when that is a git-repository, otherwise in the user's ScriptCollection-configuration-folder.")
|
|
477
|
+
parser.add_argument('-n', '--name', required=True, help='Name of the skill.')
|
|
478
|
+
parser.add_argument('-d', '--description', required=True, help='Description of the skill.')
|
|
479
|
+
parser.add_argument('-r', '--repositoryfolder', required=False, default=None, help='Repository-folder to create the skill in. Defaults to the current git-repository or the user-folder.')
|
|
480
|
+
parser.add_argument('-t', '--tags', required=False, default=None, help='Comma-separated list of tags.')
|
|
481
|
+
parser.add_argument('-p', '--priority', required=False, default=None, help='Priority of the skill (e.g. "high", "medium", "low").')
|
|
482
|
+
parser.add_argument('-g', '--triggers', required=False, default=None, help='Comma-separated list of triggers.')
|
|
483
|
+
args = parser.parse_args()
|
|
484
|
+
tags = [tag.strip() for tag in args.tags.split(",") if tag.strip() != GeneralUtilities.empty_string] if args.tags is not None else []
|
|
485
|
+
triggers = [trigger.strip() for trigger in args.triggers.split(",") if trigger.strip() != GeneralUtilities.empty_string] if args.triggers is not None else []
|
|
486
|
+
skill_folder = ScriptCollectionCore().create_skill(args.name, args.description, args.repositoryfolder, tags, args.priority, triggers)
|
|
487
|
+
GeneralUtilities.write_message_to_stdout(skill_folder)
|
|
488
|
+
return 0
|
|
489
|
+
|
|
490
|
+
|
|
476
491
|
def AppendLineToFile() -> int:
|
|
477
492
|
parser = argparse.ArgumentParser(description="Appends a line to a file. By default a leading newline is inserted before the line and a trailing newline after it (POSIX-line-ended files).")
|
|
478
493
|
parser.add_argument('-p', '--path', required=True)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
21.0.6+7
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
|
|
2
|
+
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
Bitstream Vera Fonts Copyright
|
|
6
|
+
------------------------------
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
|
|
9
|
+
a trademark of Bitstream, Inc.
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of the fonts accompanying this license ("Fonts") and associated
|
|
13
|
+
documentation files (the "Font Software"), to reproduce and distribute the
|
|
14
|
+
Font Software, including without limitation the rights to use, copy, merge,
|
|
15
|
+
publish, distribute, and/or sell copies of the Font Software, and to permit
|
|
16
|
+
persons to whom the Font Software is furnished to do so, subject to the
|
|
17
|
+
following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright and trademark notices and this permission notice shall
|
|
20
|
+
be included in all copies of one or more of the Font Software typefaces.
|
|
21
|
+
|
|
22
|
+
The Font Software may be modified, altered, or added to, and in particular
|
|
23
|
+
the designs of glyphs or characters in the Fonts may be modified and
|
|
24
|
+
additional glyphs or characters may be added to the Fonts, only if the fonts
|
|
25
|
+
are renamed to names not containing either the words "Bitstream" or the word
|
|
26
|
+
"Vera".
|
|
27
|
+
|
|
28
|
+
This License becomes null and void to the extent applicable to Fonts or Font
|
|
29
|
+
Software that has been modified and is distributed under the "Bitstream
|
|
30
|
+
Vera" names.
|
|
31
|
+
|
|
32
|
+
The Font Software may be sold as part of a larger software package but no
|
|
33
|
+
copy of one or more of the Font Software typefaces may be sold by itself.
|
|
34
|
+
|
|
35
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
36
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
|
|
37
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
|
|
38
|
+
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
|
|
39
|
+
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
|
|
40
|
+
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
|
|
41
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
42
|
+
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
|
|
43
|
+
FONT SOFTWARE.
|
|
44
|
+
|
|
45
|
+
Except as contained in this notice, the names of Gnome, the Gnome
|
|
46
|
+
Foundation, and Bitstream Inc., shall not be used in advertising or
|
|
47
|
+
otherwise to promote the sale, use or other dealings in this Font Software
|
|
48
|
+
without prior written authorization from the Gnome Foundation or Bitstream
|
|
49
|
+
Inc., respectively. For further information, contact: fonts at gnome dot
|
|
50
|
+
org.
|
|
51
|
+
|
|
52
|
+
Arev Fonts Copyright
|
|
53
|
+
------------------------------
|
|
54
|
+
|
|
55
|
+
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
|
|
56
|
+
|
|
57
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
58
|
+
a copy of the fonts accompanying this license ("Fonts") and
|
|
59
|
+
associated documentation files (the "Font Software"), to reproduce
|
|
60
|
+
and distribute the modifications to the Bitstream Vera Font Software,
|
|
61
|
+
including without limitation the rights to use, copy, merge, publish,
|
|
62
|
+
distribute, and/or sell copies of the Font Software, and to permit
|
|
63
|
+
persons to whom the Font Software is furnished to do so, subject to
|
|
64
|
+
the following conditions:
|
|
65
|
+
|
|
66
|
+
The above copyright and trademark notices and this permission notice
|
|
67
|
+
shall be included in all copies of one or more of the Font Software
|
|
68
|
+
typefaces.
|
|
69
|
+
|
|
70
|
+
The Font Software may be modified, altered, or added to, and in
|
|
71
|
+
particular the designs of glyphs or characters in the Fonts may be
|
|
72
|
+
modified and additional glyphs or characters may be added to the
|
|
73
|
+
Fonts, only if the fonts are renamed to names not containing either
|
|
74
|
+
the words "Tavmjong Bah" or the word "Arev".
|
|
75
|
+
|
|
76
|
+
This License becomes null and void to the extent applicable to Fonts
|
|
77
|
+
or Font Software that has been modified and is distributed under the
|
|
78
|
+
"Tavmjong Bah Arev" names.
|
|
79
|
+
|
|
80
|
+
The Font Software may be sold as part of a larger software package but
|
|
81
|
+
no copy of one or more of the Font Software typefaces may be sold by
|
|
82
|
+
itself.
|
|
83
|
+
|
|
84
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
87
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
|
|
88
|
+
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
89
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
90
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
91
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
92
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
93
|
+
|
|
94
|
+
Except as contained in this notice, the name of Tavmjong Bah shall not
|
|
95
|
+
be used in advertising or otherwise to promote the sale, use or other
|
|
96
|
+
dealings in this Font Software without prior written authorization
|
|
97
|
+
from Tavmjong Bah. For further information, contact: tavmjong @ free
|
|
98
|
+
. fr.
|
|
99
|
+
|
|
100
|
+
TeX Gyre DJV Math
|
|
101
|
+
-----------------
|
|
102
|
+
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
|
|
103
|
+
|
|
104
|
+
Math extensions done by B. Jackowski, P. Strzelczyk and P. Pianowski
|
|
105
|
+
(on behalf of TeX users groups) are in public domain.
|
|
106
|
+
|
|
107
|
+
Letters imported from Euler Fraktur from AMSfonts are (c) American
|
|
108
|
+
Mathematical Society (see below).
|
|
109
|
+
Bitstream Vera Fonts Copyright
|
|
110
|
+
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera
|
|
111
|
+
is a trademark of Bitstream, Inc.
|
|
112
|
+
|
|
113
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
114
|
+
of the fonts accompanying this license (“Fonts”) and associated
|
|
115
|
+
documentation
|
|
116
|
+
files (the “Font Software”), to reproduce and distribute the Font Software,
|
|
117
|
+
including without limitation the rights to use, copy, merge, publish,
|
|
118
|
+
distribute,
|
|
119
|
+
and/or sell copies of the Font Software, and to permit persons to whom
|
|
120
|
+
the Font Software is furnished to do so, subject to the following
|
|
121
|
+
conditions:
|
|
122
|
+
|
|
123
|
+
The above copyright and trademark notices and this permission notice
|
|
124
|
+
shall be
|
|
125
|
+
included in all copies of one or more of the Font Software typefaces.
|
|
126
|
+
|
|
127
|
+
The Font Software may be modified, altered, or added to, and in particular
|
|
128
|
+
the designs of glyphs or characters in the Fonts may be modified and
|
|
129
|
+
additional
|
|
130
|
+
glyphs or characters may be added to the Fonts, only if the fonts are
|
|
131
|
+
renamed
|
|
132
|
+
to names not containing either the words “Bitstream” or the word “Vera”.
|
|
133
|
+
|
|
134
|
+
This License becomes null and void to the extent applicable to Fonts or
|
|
135
|
+
Font Software
|
|
136
|
+
that has been modified and is distributed under the “Bitstream Vera”
|
|
137
|
+
names.
|
|
138
|
+
|
|
139
|
+
The Font Software may be sold as part of a larger software package but
|
|
140
|
+
no copy
|
|
141
|
+
of one or more of the Font Software typefaces may be sold by itself.
|
|
142
|
+
|
|
143
|
+
THE FONT SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
144
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
|
|
145
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
|
|
146
|
+
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
|
|
147
|
+
FOUNDATION
|
|
148
|
+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,
|
|
149
|
+
SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN
|
|
150
|
+
ACTION
|
|
151
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
|
|
152
|
+
INABILITY TO USE
|
|
153
|
+
THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
154
|
+
Except as contained in this notice, the names of GNOME, the GNOME
|
|
155
|
+
Foundation,
|
|
156
|
+
and Bitstream Inc., shall not be used in advertising or otherwise to promote
|
|
157
|
+
the sale, use or other dealings in this Font Software without prior written
|
|
158
|
+
authorization from the GNOME Foundation or Bitstream Inc., respectively.
|
|
159
|
+
For further information, contact: fonts at gnome dot org.
|
|
160
|
+
|
|
161
|
+
AMSFonts (v. 2.2) copyright
|
|
162
|
+
|
|
163
|
+
The PostScript Type 1 implementation of the AMSFonts produced by and
|
|
164
|
+
previously distributed by Blue Sky Research and Y&Y, Inc. are now freely
|
|
165
|
+
available for general use. This has been accomplished through the
|
|
166
|
+
cooperation
|
|
167
|
+
of a consortium of scientific publishers with Blue Sky Research and Y&Y.
|
|
168
|
+
Members of this consortium include:
|
|
169
|
+
|
|
170
|
+
Elsevier Science IBM Corporation Society for Industrial and Applied
|
|
171
|
+
Mathematics (SIAM) Springer-Verlag American Mathematical Society (AMS)
|
|
172
|
+
|
|
173
|
+
In order to assure the authenticity of these fonts, copyright will be
|
|
174
|
+
held by
|
|
175
|
+
the American Mathematical Society. This is not meant to restrict in any way
|
|
176
|
+
the legitimate use of the fonts, such as (but not limited to) electronic
|
|
177
|
+
distribution of documents containing these fonts, inclusion of these fonts
|
|
178
|
+
into other public domain or commercial font collections or computer
|
|
179
|
+
applications, use of the outline data to create derivative fonts and/or
|
|
180
|
+
faces, etc. However, the AMS does require that the AMS copyright notice be
|
|
181
|
+
removed from any derivative versions of the fonts which have been altered in
|
|
182
|
+
any way. In addition, to ensure the fidelity of TeX documents using Computer
|
|
183
|
+
Modern fonts, Professor Donald Knuth, creator of the Computer Modern faces,
|
|
184
|
+
has requested that any alterations which yield different font metrics be
|
|
185
|
+
given a different name.
|
|
186
|
+
|
|
187
|
+
$Id$
|
|
@@ -38,7 +38,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
|
|
|
38
38
|
from .ProgramRunnerPopen import ProgramRunnerPopen
|
|
39
39
|
from .SCLog import SCLog, LogLevel
|
|
40
40
|
|
|
41
|
-
version = "4.2.
|
|
41
|
+
version = "4.2.145"
|
|
42
42
|
__version__ = version
|
|
43
43
|
|
|
44
44
|
class VSCodeWorkspaceShellTask:
|
|
@@ -1102,14 +1102,7 @@ class ScriptCollectionCore:
|
|
|
1102
1102
|
return False
|
|
1103
1103
|
raise ValueError(f"Fatal error occurrs while checking whether folder '{path}' exists. StdErr: '{stderr}'")
|
|
1104
1104
|
|
|
1105
|
-
|
|
1106
|
-
def get_file_content(self, path: str, encoding: str = "utf-8") -> str:
|
|
1107
|
-
"""This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
|
|
1108
|
-
if self.program_runner.will_be_executed_locally():
|
|
1109
|
-
return GeneralUtilities.read_text_from_file(path, encoding)
|
|
1110
|
-
else:
|
|
1111
|
-
result = self.run_program_argsasarray("scprintfilecontent", ["--path", path, "--encofing", encoding]) # works platform-indepent
|
|
1112
|
-
return result[1].replace("\\n", "\n")
|
|
1105
|
+
|
|
1113
1106
|
|
|
1114
1107
|
@GeneralUtilities.check_arguments
|
|
1115
1108
|
def set_file_content(self, path: str, content: str, encoding: str = "utf-8") -> None:
|
|
@@ -1181,6 +1174,50 @@ class ScriptCollectionCore:
|
|
|
1181
1174
|
if exit_code != 0:
|
|
1182
1175
|
raise ValueError(f"Fatal error occurrs while copying '{source}' to '{target}'; Exitcode: '{exit_code}'; StdOut: '{stdout}'. StdErr: '{stderr}'")
|
|
1183
1176
|
|
|
1177
|
+
@GeneralUtilities.check_arguments
|
|
1178
|
+
def get_file_content(self, file: str, encoding: str = "utf-8", from_line: int = None, to_line: int = None) -> str:
|
|
1179
|
+
"""Returns the content of the file. With from_line and/or to_line (both 1-based and inclusive) the returned
|
|
1180
|
+
content can be restricted to a range of lines."""
|
|
1181
|
+
content = GeneralUtilities.read_text_from_file(file, encoding)
|
|
1182
|
+
if from_line is None and to_line is None:
|
|
1183
|
+
return content
|
|
1184
|
+
lines = content.splitlines()
|
|
1185
|
+
start_index = 0 if from_line is None else max(from_line - 1, 0)
|
|
1186
|
+
end_index = len(lines) if to_line is None else min(to_line, len(lines))
|
|
1187
|
+
return "\n".join(lines[start_index:end_index])
|
|
1188
|
+
|
|
1189
|
+
@GeneralUtilities.check_arguments
|
|
1190
|
+
def create_skill(self, skill_name: str, description: str, repository_folder: str = None, tags: list[str] = None, priority: str = None, triggers: list[str] = None) -> str:
|
|
1191
|
+
"""Generates a skill-folder ('skills/<skill_name>/' with a lightweight 'skill.json' and a lazy-loaded 'detail.md').
|
|
1192
|
+
The skill is created in the given repository-folder, or - if none is given - in the current working-directory when
|
|
1193
|
+
that is a git-repository, otherwise in the user's ScriptCollection-configuration-folder. Returns the skill-folder."""
|
|
1194
|
+
if tags is None:
|
|
1195
|
+
tags = []
|
|
1196
|
+
if triggers is None:
|
|
1197
|
+
triggers = []
|
|
1198
|
+
if priority is None:
|
|
1199
|
+
priority = "medium"
|
|
1200
|
+
if repository_folder is not None:
|
|
1201
|
+
base_folder = repository_folder
|
|
1202
|
+
elif self.is_git_repository(os.getcwd()):
|
|
1203
|
+
base_folder = os.getcwd()
|
|
1204
|
+
else:
|
|
1205
|
+
base_folder = GeneralUtilities.get_scriptcollection_configuration_folder()
|
|
1206
|
+
skill_folder = os.path.join(base_folder, "skills", skill_name)
|
|
1207
|
+
GeneralUtilities.ensure_directory_exists(skill_folder)
|
|
1208
|
+
skill_definition = {
|
|
1209
|
+
"name": skill_name,
|
|
1210
|
+
"description": description,
|
|
1211
|
+
"triggers": triggers,
|
|
1212
|
+
"tags": tags,
|
|
1213
|
+
"priority": priority,
|
|
1214
|
+
}
|
|
1215
|
+
GeneralUtilities.write_text_to_file(os.path.join(skill_folder, "skill.json"), json.dumps(skill_definition, indent=2))
|
|
1216
|
+
detail_file = os.path.join(skill_folder, "detail.md")
|
|
1217
|
+
detail_content = f"# {skill_name}\n\n{description}\n\n## Details\n\n<!-- Add the detailed (lazy-loaded) instructions for this skill here. -->\n"
|
|
1218
|
+
GeneralUtilities.write_text_to_file(detail_file, detail_content)
|
|
1219
|
+
return skill_folder
|
|
1220
|
+
|
|
1184
1221
|
@GeneralUtilities.check_arguments
|
|
1185
1222
|
def create_file(self, path: str, error_if_already_exists: bool, create_necessary_folder: bool) -> None:
|
|
1186
1223
|
"""This function works platform-independent also for non-local-executions if the ScriptCollection commandline-commands are available as global command on the target-system."""
|
|
@@ -2064,36 +2101,44 @@ class ScriptCollectionCore:
|
|
|
2064
2101
|
return self.run_program_argsasarray(program, GeneralUtilities.arguments_to_array(arguments), working_directory, print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, GeneralUtilities.arguments_to_array(arguments_for_log), throw_exception_if_exitcode_is_not_zero, custom_argument, interactive, print_live_output, env_vars)
|
|
2065
2102
|
|
|
2066
2103
|
@GeneralUtilities.check_arguments
|
|
2067
|
-
def
|
|
2068
|
-
"""Returns
|
|
2069
|
-
|
|
2104
|
+
def path_is_allowed_within_base_folder(self, path: str, base_folder: str, excluded_folders: list[str]) -> bool:
|
|
2105
|
+
"""Returns True if and only if 'path' is located within 'base_folder' (equal to 'base_folder' or a subpath of it)
|
|
2106
|
+
AND 'path' is NOT located within any of the 'excluded_folders' (neither equal to nor a subpath of any of them).
|
|
2107
|
+
Returns False if 'path' is outside 'base_folder', or if 'path' is equal to or located inside one of the
|
|
2108
|
+
'excluded_folders'.
|
|
2109
|
+
Path-resolution: a relative 'base_folder' is resolved against the current working-directory; a relative 'path' and
|
|
2110
|
+
relative entries of 'excluded_folders' are resolved against 'base_folder'."""
|
|
2070
2111
|
resolved_base_folder = GeneralUtilities.resolve_relative_path(base_folder, os.getcwd())
|
|
2071
|
-
|
|
2112
|
+
resolved_path = GeneralUtilities.resolve_relative_path(path, resolved_base_folder)
|
|
2072
2113
|
normalized_base_folder = os.path.normcase(os.path.normpath(resolved_base_folder))
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2114
|
+
normalized_path = os.path.normcase(os.path.normpath(resolved_path))
|
|
2115
|
+
# 1. path must be equal to or located inside base_folder
|
|
2116
|
+
if not (normalized_path == normalized_base_folder or normalized_path.startswith(normalized_base_folder + os.sep)):
|
|
2117
|
+
return False
|
|
2118
|
+
# 2. path must not be equal to or located inside any excluded folder
|
|
2119
|
+
for excluded_folder in excluded_folders:
|
|
2120
|
+
resolved_excluded_folder = GeneralUtilities.resolve_relative_path(excluded_folder, resolved_base_folder)
|
|
2121
|
+
normalized_excluded_folder = os.path.normcase(os.path.normpath(resolved_excluded_folder))
|
|
2122
|
+
if normalized_path == normalized_excluded_folder or normalized_path.startswith(normalized_excluded_folder + os.sep):
|
|
2123
|
+
return False
|
|
2124
|
+
# 3. path is inside base_folder and not inside any excluded folder
|
|
2125
|
+
return True
|
|
2080
2126
|
|
|
2081
2127
|
@GeneralUtilities.check_arguments
|
|
2082
2128
|
def run_command_in_folder(self, base_folder: str, command: str, arguments: str, actual_folder: str, excluded_folders: list[str] = None) -> int:
|
|
2083
|
-
"""Runs the given command with the given arguments in base_folder, but only if actual_folder is
|
|
2129
|
+
"""Runs the given command with the given arguments in base_folder, but only if actual_folder is allowed according to
|
|
2130
|
+
path_is_allowed_within_base_folder, i.e. actual_folder is equal to base_folder or a subfolder of it and is not located
|
|
2131
|
+
inside one of the excluded_folders. A relative base_folder is resolved against the current working-directory; a
|
|
2132
|
+
relative actual_folder and relative entries of excluded_folders are resolved against base_folder. actual_folder can be
|
|
2133
|
+
used in arguments by using the placeholder "{actual_folder}"."""
|
|
2084
2134
|
if excluded_folders is None:
|
|
2085
2135
|
excluded_folders = []
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
actual_folder_is_allowed = normalized_actual_folder == normalized_base_folder or normalized_actual_folder.startswith(normalized_base_folder + os.sep)
|
|
2091
|
-
if not actual_folder_is_allowed:
|
|
2092
|
-
raise ValueError(f"The folder '{resolved_actual_folder}' is not allowed because it is neither equal to nor a subfolder of the allowed folder '{base_folder}'.")
|
|
2093
|
-
if self.path_is_inside_one_of_the_folders(actual_folder, base_folder, excluded_folders):
|
|
2094
|
-
raise ValueError(f"The folder '{resolved_actual_folder}' is not allowed because it is located inside one of the excluded folders (relative to the base-folder '{base_folder}').")
|
|
2136
|
+
resolved_base_folder = GeneralUtilities.resolve_relative_path(base_folder, os.getcwd())
|
|
2137
|
+
resolved_actual_folder = GeneralUtilities.resolve_relative_path(actual_folder, resolved_base_folder)
|
|
2138
|
+
if not self.path_is_allowed_within_base_folder(actual_folder, base_folder, excluded_folders):
|
|
2139
|
+
raise ValueError(f"The folder '{resolved_actual_folder}' is not allowed: it must be equal to or a subfolder of the base-folder '{resolved_base_folder}' and must not be located inside one of the excluded folders.")
|
|
2095
2140
|
effective_arguments = arguments.replace(ScriptCollectionCore.run_command_in_folder_actual_folder_placeholder, resolved_actual_folder)
|
|
2096
|
-
result = self.run_program(command, effective_arguments,
|
|
2141
|
+
result = self.run_program(command, effective_arguments, resolved_base_folder)
|
|
2097
2142
|
return result[0]
|
|
2098
2143
|
|
|
2099
2144
|
# Return-values program_runner: Exitcode, StdOut, StdErr, Pid
|
|
@@ -35,6 +35,12 @@ class TFCPS_CodeUnitSpecific_NodeJS_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
35
35
|
self._protected_sc.normalize_line_endings(scss_file)
|
|
36
36
|
for sass_file in self._protected_sc.get_not_git_ignored_files_of_folder(codeunit_folder, ".sass"):
|
|
37
37
|
self._protected_sc.normalize_line_endings(sass_file)
|
|
38
|
+
# The OpenAPI-generator writes its '.openapi-generator/FILES' metadata-file with the host's native
|
|
39
|
+
# line-endings (CRLF on Windows, LF on Linux). Normalize it to LF like the other generated text-files
|
|
40
|
+
# so the committed file does not drift between build-hosts.
|
|
41
|
+
for openapi_generator_files_file in self._protected_sc.get_not_git_ignored_files_of_folder(codeunit_folder):
|
|
42
|
+
if os.path.basename(openapi_generator_files_file) == "FILES" and os.path.basename(os.path.dirname(openapi_generator_files_file)) == ".openapi-generator":
|
|
43
|
+
self._protected_sc.normalize_line_endings(openapi_generator_files_file)
|
|
38
44
|
for html_file in self._protected_sc.get_not_git_ignored_files_of_folder(codeunit_folder, ".html"):
|
|
39
45
|
self._protected_sc.format_html_file(html_file, os.path.basename(html_file) == "index.html")
|
|
40
46
|
self._protected_sc.run_with_epew("npm", "run lint", codeunit_folder,print_live_output=self.get_verbosity()==LogLevel.Debug,encode_argument_in_base64=True)
|
|
@@ -224,8 +224,18 @@ class TFCPS_CodeUnitSpecific_Base(ABC):
|
|
|
224
224
|
# Copy license-file
|
|
225
225
|
self.tfcps_Tools_General.copy_licence_file(self.get_codeunit_folder())
|
|
226
226
|
|
|
227
|
-
#
|
|
228
|
-
|
|
227
|
+
# Propagate the repository-level dependency-version-pins (e.g. PlantUML, OpenAPIGenerator, JRE) into the codeunit
|
|
228
|
+
# so each codeunit carries its own copy of the versions that are defined once at repository-level.
|
|
229
|
+
repository_dependencies_folder = os.path.join(repository_folder, "Other", "Resources", "Dependencies")
|
|
230
|
+
if os.path.isdir(repository_dependencies_folder):
|
|
231
|
+
for dependency_folder in GeneralUtilities.get_direct_folders_of_folder(repository_dependencies_folder):
|
|
232
|
+
dependency_name = os.path.basename(dependency_folder)
|
|
233
|
+
source_version_file = os.path.join(dependency_folder, "Version.txt")
|
|
234
|
+
if os.path.isfile(source_version_file):
|
|
235
|
+
target_version_file = os.path.join(codeunit_folder, "Other", "Resources", "Dependencies", dependency_name, "Version.txt")
|
|
236
|
+
GeneralUtilities.ensure_directory_exists(os.path.dirname(target_version_file))
|
|
237
|
+
shutil.copyfile(source_version_file, target_version_file)
|
|
238
|
+
|
|
229
239
|
|
|
230
240
|
@GeneralUtilities.check_arguments
|
|
231
241
|
def generate_reference_using_docfx(self):
|
|
@@ -85,9 +85,13 @@ class TFCPS_CodeUnit_BuildCodeUnit:
|
|
|
85
85
|
self.sc.log.log('Finalize building codeunits...')
|
|
86
86
|
self.sc.run_program(GeneralUtilities.get_python_executable(), f"OnBuildingFinished.py {arguments}", os.path.join(self.codeunit_folder, "Other"), print_live_output=self.sc.log.loglevel==LogLevel.Debug)
|
|
87
87
|
|
|
88
|
+
codeunit_version = self.tFCPS_Tools.get_version_of_codeunit(codeunit_file)
|
|
89
|
+
|
|
90
|
+
# Generate diff-report
|
|
91
|
+
self.tFCPS_Tools.generate_diff_report(self.repository_folder, self.codeunit_name, codeunit_version)
|
|
92
|
+
|
|
88
93
|
artifacts_folder = os.path.join(self.codeunit_folder, "Other", "Artifacts")
|
|
89
94
|
artifactsinformation_file = os.path.join(artifacts_folder, f"{self.codeunit_name}.artifactsinformation.xml")
|
|
90
|
-
codeunit_version = self.tFCPS_Tools.get_version_of_codeunit(codeunit_file)
|
|
91
95
|
GeneralUtilities.ensure_file_exists(artifactsinformation_file)
|
|
92
96
|
artifacts_list = []
|
|
93
97
|
for artifact_folder in GeneralUtilities.get_direct_folders_of_folder(artifacts_folder):
|
|
@@ -34,6 +34,19 @@ class TFCPS_Tools_General:
|
|
|
34
34
|
# the computed text-lengths and coordinates and thus produces spurious diffs). The font is available in the
|
|
35
35
|
# build-image via the apt-package 'fonts-dejavu'.
|
|
36
36
|
__default_diagram_font_name:str="DejaVu Sans"
|
|
37
|
+
# Font-files (all faces of the diagram-font) bundled with the package and forced via the JVM-font-path when rendering.
|
|
38
|
+
__bundled_diagram_font_filenames:list[str]=["DejaVuSans.ttf","DejaVuSans-Bold.ttf","DejaVuSans-Oblique.ttf","DejaVuSans-BoldOblique.ttf"]
|
|
39
|
+
# Relative path (in the source-repository and in the ScriptCollection.Resources-package) of the file that pins the
|
|
40
|
+
# default Eclipse-Temurin-JRE-version used to render the PlantUML-diagrams when a repository does not pin its own
|
|
41
|
+
# version in '<repo>/Other/Resources/Dependencies/JRE/Version.txt'. The file contains a build like "21.0.6+7" (the
|
|
42
|
+
# feature-version is derived from it). Pinning the exact JDK-build (not just the major-version) makes the AWT-font-
|
|
43
|
+
# metrics - and thus the computed SVG-geometry - byte-identical across machines: PlantUML computes the SVG purely as
|
|
44
|
+
# vector-math from the font-metrics, and different JDK-builds (e.g. a Windows-client vs. the Debian-build-container)
|
|
45
|
+
# round these metrics slightly differently. Together with the bundled DejaVu-font (see __default_diagram_font_name)
|
|
46
|
+
# this makes the rendered SVG fully deterministic. The PlantUML-rendering uses this pinned JRE instead of the host's
|
|
47
|
+
# 'java' on the PATH. When the pinned version is bumped, the committed diagram-SVGs must be regenerated and re-committed
|
|
48
|
+
# once so they match the new build's metrics.
|
|
49
|
+
__jre_version_resource_relative_path:str="Dependencies/JRE/Version.txt"
|
|
37
50
|
|
|
38
51
|
def __init__(self,sc:ScriptCollectionCore):
|
|
39
52
|
self.__sc=sc
|
|
@@ -86,6 +99,7 @@ class TFCPS_Tools_General:
|
|
|
86
99
|
self.__sc.log.loglevel = LogLevel.Debug
|
|
87
100
|
self.download_cyclonedx(enforce_update)
|
|
88
101
|
self.download_plantuml(enforce_update)
|
|
102
|
+
self.download_jre(enforce_update)
|
|
89
103
|
self.download_mediamtx(enforce_update)
|
|
90
104
|
self.download_trufflehog(enforce_update)
|
|
91
105
|
self.download_openapigenerator(enforce_update)
|
|
@@ -101,6 +115,13 @@ class TFCPS_Tools_General:
|
|
|
101
115
|
self.__sc.log.log("Download cachable tool \"PlantUML\" into global cache...", LogLevel.Debug)
|
|
102
116
|
self.ensure_plantuml_is_available(enforce_update)
|
|
103
117
|
|
|
118
|
+
@GeneralUtilities.check_arguments
|
|
119
|
+
def download_jre(self, enforce_update: bool = False) -> None:
|
|
120
|
+
self.__sc.log.log("Download cachable tool \"JRE\" into global cache...", LogLevel.Debug)
|
|
121
|
+
# Only the executing platform is warmed (unlike e.g. MediaMTX): a JDK-archive is large (~200MB), and the
|
|
122
|
+
# build-image is built per-platform, so warming foreign platforms would only bloat the image without benefit.
|
|
123
|
+
self.ensure_jre_is_available(enforce_update)
|
|
124
|
+
|
|
104
125
|
@GeneralUtilities.check_arguments
|
|
105
126
|
def download_mediamtx(self, enforce_update: bool = False) -> None:
|
|
106
127
|
self.__sc.log.log("Download cachable tool \"MediaMTX\" into global cache...", LogLevel.Debug)
|
|
@@ -624,15 +645,17 @@ class TFCPS_Tools_General:
|
|
|
624
645
|
self.__sc.log.log("Generate svg-files from plantuml-files...")
|
|
625
646
|
self.__sc.assert_is_git_repository(repository_folder)
|
|
626
647
|
plantuml_jar_file=self.ensure_plantuml_is_available(not use_cache, repository_folder)
|
|
648
|
+
java_executable=self.ensure_jre_is_available(not use_cache, repository_folder)
|
|
627
649
|
target_folder = os.path.join(repository_folder, "Other", "Reference")
|
|
628
|
-
self.__generate_svg_files_from_plantuml(target_folder, plantuml_jar_file)
|
|
650
|
+
self.__generate_svg_files_from_plantuml(target_folder, plantuml_jar_file, java_executable)
|
|
629
651
|
|
|
630
652
|
@GeneralUtilities.check_arguments
|
|
631
653
|
def generate_svg_files_from_plantuml_files_for_codeunit(self, codeunit_folder: str,use_cache:bool) -> None:
|
|
632
654
|
self.assert_is_codeunit_folder(codeunit_folder)
|
|
633
655
|
plantuml_jar_file=self.ensure_plantuml_is_available(not use_cache, os.path.dirname(codeunit_folder))
|
|
656
|
+
java_executable=self.ensure_jre_is_available(not use_cache, os.path.dirname(codeunit_folder))
|
|
634
657
|
target_folder = os.path.join(codeunit_folder, "Other", "Reference")
|
|
635
|
-
self.__generate_svg_files_from_plantuml(target_folder, plantuml_jar_file)
|
|
658
|
+
self.__generate_svg_files_from_plantuml(target_folder, plantuml_jar_file, java_executable)
|
|
636
659
|
|
|
637
660
|
@GeneralUtilities.check_arguments
|
|
638
661
|
def ensure_plantuml_is_available(self, enforce_update: bool, repository_folder: str = None) -> str:
|
|
@@ -644,24 +667,136 @@ class TFCPS_Tools_General:
|
|
|
644
667
|
return self.ensure_file_from_github_assets_is_available_with_retry("plantuml", "plantuml", "PlantUML", "plantuml.jar", lambda latest_version: "plantuml.jar", enforce_update=enforce_update, pinned_version=pinned_version)
|
|
645
668
|
|
|
646
669
|
@GeneralUtilities.check_arguments
|
|
647
|
-
def
|
|
670
|
+
def get_default_jre_version(self) -> str:
|
|
671
|
+
"""Returns the JRE-version used when a repository does not pin its own version (see
|
|
672
|
+
__jre_version_resource_relative_path). The value is read from the version-file bundled with the
|
|
673
|
+
ScriptCollection-package, with a fallback to the source-file for an unbuilt source-checkout."""
|
|
674
|
+
try:
|
|
675
|
+
content = GeneralUtilities._internal_load_resource(TFCPS_Tools_General.__jre_version_resource_relative_path)
|
|
676
|
+
return content.decode("utf-8").strip()
|
|
677
|
+
except (FileNotFoundError, ModuleNotFoundError):
|
|
678
|
+
source_version_file = GeneralUtilities.resolve_relative_path(f"../../../Other/Resources/{TFCPS_Tools_General.__jre_version_resource_relative_path}", os.path.dirname(__file__))
|
|
679
|
+
GeneralUtilities.assert_file_exists(source_version_file)
|
|
680
|
+
return GeneralUtilities.read_text_from_file(source_version_file).strip()
|
|
681
|
+
|
|
682
|
+
@GeneralUtilities.check_arguments
|
|
683
|
+
def get_jre_version(self, repository_folder: str = None) -> str:
|
|
684
|
+
"""Resolves the JRE-version to use: the repository-specific pin in '<repo>/Other/Resources/Dependencies/JRE/Version.txt'
|
|
685
|
+
if present, otherwise the default bundled with ScriptCollection (see get_default_jre_version)."""
|
|
686
|
+
if repository_folder is not None:
|
|
687
|
+
version_file = os.path.join(repository_folder, "Other", "Resources", "Dependencies", "JRE", "Version.txt")
|
|
688
|
+
if os.path.isfile(version_file):
|
|
689
|
+
return GeneralUtilities.read_text_from_file(version_file).strip()
|
|
690
|
+
return self.get_default_jre_version()
|
|
691
|
+
|
|
692
|
+
@GeneralUtilities.check_arguments
|
|
693
|
+
def ensure_jre_is_available(self, enforce_update: bool, repository_folder: str = None) -> str:
|
|
694
|
+
"""Ensures the pinned JDK is available in the global cache for the executing platform and returns the absolute path
|
|
695
|
+
to its 'java'-executable. The version is the repository-specific pin if present, otherwise the bundled default (see
|
|
696
|
+
get_jre_version). Pinning the exact build makes the PlantUML-rendering deterministic across machines."""
|
|
697
|
+
local_resource_name = "JRE"
|
|
698
|
+
jre_version = self.get_jre_version(repository_folder)
|
|
699
|
+
feature_version = jre_version.split(".")[0] # e.g. "21" from "21.0.6+7"
|
|
700
|
+
pinned_tag = "jdk-" + jre_version
|
|
701
|
+
if GeneralUtilities.current_system_is_x64():
|
|
702
|
+
architecture_token = "x64"
|
|
703
|
+
elif GeneralUtilities.current_system_is_arm64():
|
|
704
|
+
architecture_token = "aarch64"
|
|
705
|
+
else:
|
|
706
|
+
raise ValueError("Unsupported architecture for the pinned JRE.")
|
|
707
|
+
if GeneralUtilities.current_system_is_windows():
|
|
708
|
+
operatingsystem_token = "windows"
|
|
709
|
+
archive_extension = "zip"
|
|
710
|
+
java_executable_name = "java.exe"
|
|
711
|
+
elif GeneralUtilities.current_system_is_linux():
|
|
712
|
+
operatingsystem_token = "linux"
|
|
713
|
+
archive_extension = "tar.gz"
|
|
714
|
+
java_executable_name = "java"
|
|
715
|
+
else: # treat everything else as macOS (Darwin); Temurin uses the "mac"-token there.
|
|
716
|
+
operatingsystem_token = "mac"
|
|
717
|
+
archive_extension = "tar.gz"
|
|
718
|
+
java_executable_name = "java"
|
|
719
|
+
|
|
720
|
+
def get_asset_filename(release_tag: str) -> str:
|
|
721
|
+
# release_tag looks like "jdk-21.0.6+7"; the Adoptium-asset-name uses the version with the build-separator '+' replaced by '_'.
|
|
722
|
+
version_in_asset = release_tag[len("jdk-"):].replace("+", "_")
|
|
723
|
+
return f"OpenJDK{feature_version}U-jdk_{architecture_token}_{operatingsystem_token}_hotspot_{version_in_asset}.{archive_extension}"
|
|
724
|
+
|
|
725
|
+
extracted_folder = os.path.join(self.__sc.get_global_cache_folder(), "Tools", local_resource_name)
|
|
726
|
+
unextracted_resource_name = local_resource_name + "_Unextracted"
|
|
727
|
+
marker_file = os.path.join(extracted_folder, "PinnedVersion.txt")
|
|
728
|
+
cached_pinned_tag: str = None
|
|
729
|
+
if os.path.isfile(marker_file):
|
|
730
|
+
cached_pinned_tag = GeneralUtilities.read_text_from_file(marker_file).strip()
|
|
731
|
+
update: bool = enforce_update or not os.path.isdir(extracted_folder) or GeneralUtilities.folder_is_empty(extracted_folder) or cached_pinned_tag != pinned_tag
|
|
732
|
+
if update:
|
|
733
|
+
downloaded_archive = self.ensure_file_from_github_assets_is_available_with_retry("adoptium", f"temurin{feature_version}-binaries", unextracted_resource_name, get_asset_filename(pinned_tag), get_asset_filename, enforce_update=enforce_update, pinned_version=pinned_tag)
|
|
734
|
+
GeneralUtilities.ensure_folder_exists_and_is_empty(extracted_folder)
|
|
735
|
+
if archive_extension == "zip":
|
|
736
|
+
with zipfile.ZipFile(downloaded_archive, "r") as zip_ref:
|
|
737
|
+
zip_ref.extractall(extracted_folder)
|
|
738
|
+
else:
|
|
739
|
+
with tarfile.open(downloaded_archive, "r:gz") as tar:
|
|
740
|
+
tar.extractall(path=extracted_folder)
|
|
741
|
+
GeneralUtilities.ensure_directory_does_not_exist(os.path.join(self.__sc.get_global_cache_folder(), "Tools", unextracted_resource_name))
|
|
742
|
+
GeneralUtilities.write_text_to_file(marker_file, pinned_tag)
|
|
743
|
+
GeneralUtilities.assert_folder_exists(extracted_folder)
|
|
744
|
+
# The archive extracts into a top-level folder (e.g. "jdk-21.0.6+7"); locate the 'java'-executable inside its 'bin'-folder.
|
|
745
|
+
java_executable_candidates = [f for f in GeneralUtilities.get_all_files_of_folder(extracted_folder) if os.path.basename(f) == java_executable_name and os.path.basename(os.path.dirname(f)) == "bin"]
|
|
746
|
+
if len(java_executable_candidates) == 0:
|
|
747
|
+
raise ValueError(f"Could not locate the '{java_executable_name}'-executable inside the extracted JRE at '{extracted_folder}'.")
|
|
748
|
+
java_executable = java_executable_candidates[0]
|
|
749
|
+
if not GeneralUtilities.current_system_is_windows():
|
|
750
|
+
os.chmod(java_executable, 0o755)
|
|
751
|
+
return java_executable
|
|
752
|
+
|
|
753
|
+
@GeneralUtilities.check_arguments
|
|
754
|
+
def __generate_svg_files_from_plantuml(self, diagrams_files_folder: str, plantuml_jar_file: str, java_executable: str) -> None:
|
|
648
755
|
# Pin the font for all rendered diagrams via a PlantUML-config-file so the resulting SVG is identical across
|
|
649
756
|
# machines, without having to add a skinparam to every (also hand-written) .plantuml-file. See the comment at
|
|
650
757
|
# __default_diagram_font_name for the reason.
|
|
651
758
|
font_config_file = os.path.join(tempfile.gettempdir(), f"plantuml-font-config-{uuid.uuid4()}.cfg")
|
|
652
759
|
GeneralUtilities.write_text_to_file(font_config_file, f'skinparam defaultFontName "{TFCPS_Tools_General.__default_diagram_font_name}"')
|
|
760
|
+
# Force the JVM to use the DejaVu-fonts bundled with ScriptCollection (via the font-path) instead of whatever
|
|
761
|
+
# font-version happens to be installed on the host. This makes the text-measurement - and thus the resulting
|
|
762
|
+
# SVG-geometry - identical across machines (e.g. a Windows-client and the Debian-build-container), because the
|
|
763
|
+
# exact same font-files are used everywhere.
|
|
764
|
+
java_font_arguments: list[str] = []
|
|
765
|
+
bundled_fonts_folder = self.__extract_bundled_fonts_to_temp_folder()
|
|
766
|
+
if bundled_fonts_folder is not None:
|
|
767
|
+
java_font_arguments.append(f"-Dsun.java2d.fontpath=prepend:{bundled_fonts_folder}")
|
|
653
768
|
try:
|
|
654
769
|
for file in GeneralUtilities.get_all_files_of_folder(diagrams_files_folder):
|
|
655
770
|
if file.endswith(".plantuml"):
|
|
656
771
|
output_filename = self.get_output_filename_for_plantuml_filename(file)
|
|
657
|
-
argument = ['-jar',plantuml_jar_file, '-tsvg', '-config', font_config_file, os.path.basename(file)]
|
|
772
|
+
argument = java_font_arguments + ['-jar',plantuml_jar_file, '-tsvg', '-config', font_config_file, os.path.basename(file)]
|
|
658
773
|
folder = os.path.dirname(file)
|
|
659
|
-
self.__sc.run_program_argsasarray(
|
|
774
|
+
self.__sc.run_program_argsasarray(java_executable, argument, folder)
|
|
660
775
|
result_file = folder+"/" + output_filename
|
|
661
776
|
GeneralUtilities.assert_file_exists(result_file)
|
|
662
777
|
self.__sc.format_xml_file(result_file)
|
|
663
778
|
finally:
|
|
664
779
|
GeneralUtilities.ensure_file_does_not_exist(font_config_file)
|
|
780
|
+
if bundled_fonts_folder is not None:
|
|
781
|
+
GeneralUtilities.ensure_directory_does_not_exist(bundled_fonts_folder)
|
|
782
|
+
|
|
783
|
+
@GeneralUtilities.check_arguments
|
|
784
|
+
def __extract_bundled_fonts_to_temp_folder(self) -> str:
|
|
785
|
+
# Extracts the DejaVu-fonts bundled with the ScriptCollection-package into a temporary folder and returns its path
|
|
786
|
+
# (the JVM needs a real folder for its font-path; see __default_diagram_font_name). The bytes are read via
|
|
787
|
+
# GeneralUtilities._internal_load_resource so this also works when the package is stored as a zip-archive. Returns
|
|
788
|
+
# None if the fonts are not available (e.g. an older installation without the bundled fonts). The caller is
|
|
789
|
+
# responsible for removing the returned folder afterwards.
|
|
790
|
+
temp_folder = os.path.join(tempfile.gettempdir(), f"scriptcollection-diagram-fonts-{uuid.uuid4()}")
|
|
791
|
+
try:
|
|
792
|
+
GeneralUtilities.ensure_directory_exists(temp_folder)
|
|
793
|
+
for font_filename in TFCPS_Tools_General.__bundled_diagram_font_filenames:
|
|
794
|
+
font_bytes = GeneralUtilities._internal_load_resource(f"Fonts/{font_filename}")
|
|
795
|
+
GeneralUtilities.write_binary_to_file(os.path.join(temp_folder, font_filename), font_bytes)
|
|
796
|
+
except (FileNotFoundError, ModuleNotFoundError):
|
|
797
|
+
GeneralUtilities.ensure_directory_does_not_exist(temp_folder)
|
|
798
|
+
return None
|
|
799
|
+
return temp_folder
|
|
665
800
|
|
|
666
801
|
@GeneralUtilities.check_arguments
|
|
667
802
|
def get_output_filename_for_plantuml_filename(self, plantuml_file: str) -> str:
|
|
@@ -1174,6 +1309,12 @@ class TFCPS_Tools_General:
|
|
|
1174
1309
|
GeneralUtilities.ensure_directory_does_not_exist(openapigenerator_folder)
|
|
1175
1310
|
jar_file_exists = False
|
|
1176
1311
|
cached_version = None
|
|
1312
|
+
# Untrusted cache: a jar exists but has no version-marker (e.g. downloaded by an older ScriptCollection-version).
|
|
1313
|
+
# Its actual version is unknown, so it cannot be matched against the pinned version — drop it and re-download.
|
|
1314
|
+
if pinned_version is not None and cached_version is None and jar_file_exists:
|
|
1315
|
+
self.__sc.log.log(f"Cached OpenAPIGenerator-jar has no version-marker and can not be trusted. Removing cache and re-downloading pinned version '{pinned_version}'.", LogLevel.Information)
|
|
1316
|
+
GeneralUtilities.ensure_directory_does_not_exist(openapigenerator_folder)
|
|
1317
|
+
jar_file_exists = False
|
|
1177
1318
|
# Caller explicitly asked to bypass the cache.
|
|
1178
1319
|
if not use_cache:
|
|
1179
1320
|
GeneralUtilities.ensure_directory_does_not_exist(openapigenerator_folder)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scriptcollection
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.145
|
|
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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
ScriptCollection/AnionBuildPlatform.py,sha256=vg1lZ6D1nqq_mO7iYTDSktSImXd34scfPaXiIrbvrg0,11848
|
|
2
2
|
ScriptCollection/CertificateUpdater.py,sha256=dR5JpJDlZdjD4_pgMz7zCrt1IM7VfatmK6pULSczxQw,9693
|
|
3
|
-
ScriptCollection/Executables.py,sha256=
|
|
3
|
+
ScriptCollection/Executables.py,sha256=O6REf3ricZVtAg-Z0isUxEpItqqH-pfIxK3BMfWMzaA,63861
|
|
4
4
|
ScriptCollection/GeneralUtilities.py,sha256=cJK18rWzmVT3KyvjIAbPK4o4-jVPwYeuVpizbTHjBDc,68136
|
|
5
5
|
ScriptCollection/HTTPMaintenanceOverheadHelper.py,sha256=TToNtyO1XzsMbBsTBf3o0xgOK0v4Jf03qw2Z0xb2nCk,2007
|
|
6
6
|
ScriptCollection/ProcessesRunner.py,sha256=yYaC95h40uszuZPggn2kK3qXIN2ZjGMCavo-NQ53ElQ,1537
|
|
@@ -9,7 +9,7 @@ ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrR
|
|
|
9
9
|
ScriptCollection/ProgramRunnerPopen.py,sha256=8tP0xWKeRYoGlaNB3iUh4o61O-tKtcxrS7IUqtU85C4,4091
|
|
10
10
|
ScriptCollection/ProgramRunnerSudo.py,sha256=RXsiceQ8W6a8YDk_2BPscVbIAmDIpIxqe9WHBy2r4CM,5233
|
|
11
11
|
ScriptCollection/SCLog.py,sha256=Z-HhC_CRtU3HdQflNsabFh9IJOucHcXmxMDcf58fli0,4671
|
|
12
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
|
12
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=4PXLjavMAOg2MZdug1yeYfBrz8ProHNLn8FgYUE5ENE,219953
|
|
13
13
|
ScriptCollection/UnassignedVariablesCheck.py,sha256=v59qLQ5RRvx31ouuCW7NWZj3McWENvGBPkV5ZGBmqJE,4344
|
|
14
14
|
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
ScriptCollection/OCIImages/AbstractImageHandler.py,sha256=o129UYDtLymCRjMZBP9Puaj19ueMHoNt6UTLspfnaRc,1758
|
|
@@ -24,17 +24,23 @@ ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerGitlabEE.py,sha256=
|
|
|
24
24
|
ScriptCollection/OCIImages/ConcreteImageHandlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
25
|
ScriptCollection/Resources/CultureChooser/CultureChooser.js,sha256=5-4pwGDq5j1UnpTZy850ZMoxlM9tYPeu781QpZBtCWM,951
|
|
26
26
|
ScriptCollection/Resources/CultureChooser/index.html,sha256=gxQzbrSp4WU52TqN-gcBEtz2gJXmmM14OwTSFtFVRvw,276
|
|
27
|
+
ScriptCollection/Resources/Dependencies/JRE/Version.txt,sha256=WlFzNJMH4lfVzW5QGHnuE52jLujSGpQ48zVB-Cln-7g,9
|
|
27
28
|
ScriptCollection/Resources/Dependencies/OpenAPIGenerator/Version.txt,sha256=hdAgOhOHx4s13fJ-j0A06oYoM9rdEfDe0RzHoeAKXxo,7
|
|
29
|
+
ScriptCollection/Resources/Fonts/DejaVuSans-Bold.ttf,sha256=5kdsG4BQKSQpTu1AiUxbGOBsGBREypU-UzQmLfnCdyQ,705684
|
|
30
|
+
ScriptCollection/Resources/Fonts/DejaVuSans-BoldOblique.ttf,sha256=60NtygwllLc9i2A7iS43T9_Y2IXSX_tPGN9MTAtJ5Q8,643292
|
|
31
|
+
ScriptCollection/Resources/Fonts/DejaVuSans-Oblique.ttf,sha256=SvdfoW7m061D4ezsQYYsJJVK8mpVxrseuye9SGpQ9fQ,635416
|
|
32
|
+
ScriptCollection/Resources/Fonts/DejaVuSans.ttf,sha256=faGVp0xVvvmI0NSPlQi9XYSUJcF3Dbpde_xs6e2EiVQ,757076
|
|
33
|
+
ScriptCollection/Resources/Fonts/LICENSE.txt,sha256=egg7E25k0GR5TDQZdR5cfdENL2TBCP5boWHq5eWVipM,8816
|
|
28
34
|
ScriptCollection/Resources/MaintenanceSite/MaintenanceSite.html,sha256=CX9S1bdOz6xU2aGfr03tJRGczQrlpn-IeODc15d5kc0,232
|
|
29
|
-
ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=
|
|
30
|
-
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=
|
|
35
|
+
ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=ph66XVh1rsiIyTabkHVGQWoz38j5hUp9v7u7-naTyeo,29756
|
|
36
|
+
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=4PH3PGdc9Jf3B71Ws0z6E3cobifhgaXwhe750ag2RJs,9565
|
|
31
37
|
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=cScWO7n89Gbs3au8U_EczJO53jZx6NFzpm7c46IqO_Q,23733
|
|
32
38
|
ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=X2NgZgbOkJsdZ6wMHB_RuS_rQCuz5oQCqzYrxyXBN9Q,6680
|
|
33
39
|
ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=5vCFfDiU8bvfcnoKNs2ATS8nsl6mYXcIuX7XfYE0tvg,2116
|
|
34
40
|
ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=BsSV4a-NZY86MZ20d-_rYxNVAI4UzAfmEwXlRZ8qWQc,7685
|
|
35
41
|
ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=QRm8n1qH8H_XbJhGCbzwdNr9KSEy0WkbG7ulpc4Md3U,22696
|
|
36
42
|
ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=JYiDqDsfVJQWS9xWMi_UzfXnXsJRnPRxAzFr82bUEvI,2370
|
|
37
|
-
ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=
|
|
43
|
+
ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=_L84d4krR2dlZBj1E1j3wsHu7fc01BDw_LfwKDmRjS4,126256
|
|
38
44
|
ScriptCollection/TFCPS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
45
|
ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py,sha256=wS2yzYUmJ4m0cf6cBYVTHsiXSXfYhHoLFFy8x6yEQvY,19573
|
|
40
46
|
ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -49,14 +55,14 @@ ScriptCollection/TFCPS/Go/TFCPS_CodeUnitSpecific_Go.py,sha256=kyx26AnT1-LySFA46w
|
|
|
49
55
|
ScriptCollection/TFCPS/Go/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
56
|
ScriptCollection/TFCPS/Maven/TFCPS_CodeUnitSpecific_Maven.py,sha256=WcWWtCV3GkAk53RIN_6rjXNvkKZ5i5hBEMCmPQo6j30,1685
|
|
51
57
|
ScriptCollection/TFCPS/Maven/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
52
|
-
ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py,sha256=
|
|
58
|
+
ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py,sha256=i2msd3tmXaB8EWF3tIR5jwveIFlZcmeYXMde4UP32P4,14310
|
|
53
59
|
ScriptCollection/TFCPS/NodeJS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
54
60
|
ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py,sha256=fqGhXNx8tK8sWPcn4D3eIE6gV9Oh7J37NBKjU089e-A,15852
|
|
55
61
|
ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
62
|
ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=WhOsMpJxNGqnQGA3nJ99ruyqymxBeJxCcpK98zJduTo,1680
|
|
57
63
|
ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
|
-
scriptcollection-4.2.
|
|
59
|
-
scriptcollection-4.2.
|
|
60
|
-
scriptcollection-4.2.
|
|
61
|
-
scriptcollection-4.2.
|
|
62
|
-
scriptcollection-4.2.
|
|
64
|
+
scriptcollection-4.2.145.dist-info/METADATA,sha256=xwb2L1trz3kTrIoSrI4vDvTihrZULAsXNWWLRjYrUIQ,7817
|
|
65
|
+
scriptcollection-4.2.145.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
66
|
+
scriptcollection-4.2.145.dist-info/entry_points.txt,sha256=tXpgu2GUhY3yUmoK3gVPypYMnxorz3183wl82aFt7KI,5430
|
|
67
|
+
scriptcollection-4.2.145.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
|
68
|
+
scriptcollection-4.2.145.dist-info/RECORD,,
|
|
@@ -17,6 +17,7 @@ sccreatehashofallfiles = ScriptCollection.Executables:CreateHashOfAllFiles
|
|
|
17
17
|
sccreateisofilewithobfuscatedfiles = ScriptCollection.Executables:CreateISOFileWithObfuscatedFiles
|
|
18
18
|
sccreaterelease = ScriptCollection.Executables:CreateRelease
|
|
19
19
|
sccreatesimplemergewithoutrelease = ScriptCollection.Executables:CreateSimpleMergeWithoutRelease
|
|
20
|
+
sccreateskill = ScriptCollection.Executables:CreateSkill
|
|
20
21
|
sccurrentuserhaselevatedprivileges = ScriptCollection.Executables:CurrentUserHasElevatedPrivileges
|
|
21
22
|
scdownloadcachabletools = ScriptCollection.Executables:DownloadCachableTools
|
|
22
23
|
scensuredockernetworkisavailable = ScriptCollection.Executables:EnsureDockerNetworkIsAvailable
|
|
File without changes
|
|
File without changes
|