ScriptCollection 4.3.62__py3-none-any.whl → 4.3.63__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 +30 -15
- ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py +9 -4
- {scriptcollection-4.3.62.dist-info → scriptcollection-4.3.63.dist-info}/METADATA +1 -1
- {scriptcollection-4.3.62.dist-info → scriptcollection-4.3.63.dist-info}/RECORD +7 -7
- {scriptcollection-4.3.62.dist-info → scriptcollection-4.3.63.dist-info}/WHEEL +0 -0
- {scriptcollection-4.3.62.dist-info → scriptcollection-4.3.63.dist-info}/entry_points.txt +0 -0
- {scriptcollection-4.3.62.dist-info → scriptcollection-4.3.63.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.3.
|
|
42
|
+
version = "4.3.63"
|
|
43
43
|
__version__ = version
|
|
44
44
|
|
|
45
45
|
class VSCodeWorkspaceShellTask:
|
|
@@ -458,7 +458,9 @@ class ScriptCollectionCore:
|
|
|
458
458
|
versiononlyregex = f"^{versionregex}$"
|
|
459
459
|
pattern = re.compile(versiononlyregex)
|
|
460
460
|
if pattern.match(new_version):
|
|
461
|
-
|
|
461
|
+
#the tag can be prefixed (for example "<ns0:version>") because the nuspec-namespace can be declared with a prefix instead of being declared as default-namespace.
|
|
462
|
+
version_tag_regex = f"(<(?:[\\w.-]+:)?version>){versionregex}(<\\/(?:[\\w.-]+:)?version>)"
|
|
463
|
+
GeneralUtilities.write_text_to_file(nuspec_file, re.sub(version_tag_regex, lambda match: match.group(1)+new_version+match.group(2), GeneralUtilities.read_text_from_file(nuspec_file)))
|
|
462
464
|
else:
|
|
463
465
|
raise ValueError(f"Version '{new_version}' does not match version-regex '{versiononlyregex}'")
|
|
464
466
|
|
|
@@ -2835,7 +2837,8 @@ chmod {permission} {link_file}
|
|
|
2835
2837
|
lines = GeneralUtilities.read_lines_from_file(file)
|
|
2836
2838
|
lines_result = []
|
|
2837
2839
|
for line in lines:
|
|
2838
|
-
|
|
2840
|
+
#the tag can be prefixed (for example "<ns0:copyright>") because in xml-files like nuspec-files the namespace can be declared with a prefix instead of being declared as default-namespace.
|
|
2841
|
+
if match := re.search("(.*<(?:[\\w.-]+:)?[Cc]opyright>.*)\\d\\d\\d\\d(.*<\\/(?:[\\w.-]+:)?[Cc]opyright>.*)", line):
|
|
2839
2842
|
part1 = match.group(1)
|
|
2840
2843
|
part2 = match.group(2)
|
|
2841
2844
|
adapted = part1+current_year+part2
|
|
@@ -3080,21 +3083,33 @@ TXDX
|
|
|
3080
3083
|
trim_texts(child)
|
|
3081
3084
|
trim_texts(element)
|
|
3082
3085
|
ET.indent(element)
|
|
3083
|
-
|
|
3084
|
-
if element.tag.startswith("{"):
|
|
3085
|
-
#keep the namespace of the root-element as default-namespace. without this the whole document would be rewritten with a
|
|
3086
|
-
#generated prefix (for example "<ns0:package xmlns:ns0=...>" instead of "<package xmlns=...>"), which is semantically
|
|
3087
|
-
#equivalent but unusual and therefore an unnecessary risk for tools which process the formatted file.
|
|
3088
|
-
default_namespace = element.tag[1:element.tag.index("}")]
|
|
3089
|
-
try:
|
|
3090
|
-
content = ET.tostring(element, xml_declaration=add_xml_declaration, encoding="unicode", default_namespace=default_namespace)
|
|
3091
|
-
except ValueError:
|
|
3092
|
-
#documents which contain elements without a namespace besides the namespace of the root-element can not be serialized
|
|
3093
|
-
#with a default-namespace at all. in that case the generated prefixes are the only possible representation.
|
|
3094
|
-
content = ET.tostring(element, xml_declaration=add_xml_declaration, encoding="unicode")
|
|
3086
|
+
content = self.__serialize_xml_element(element, add_xml_declaration)
|
|
3095
3087
|
GeneralUtilities.write_text_to_file(file, content.rstrip("\n") + "\n", encoding)
|
|
3096
3088
|
self.normalize_line_endings(file)
|
|
3097
3089
|
|
|
3090
|
+
@GeneralUtilities.check_arguments
|
|
3091
|
+
def __serialize_xml_element(self, element: ET.Element, add_xml_declaration: bool) -> str:
|
|
3092
|
+
if not element.tag.startswith("{"):
|
|
3093
|
+
return ET.tostring(element, xml_declaration=add_xml_declaration, encoding="unicode")
|
|
3094
|
+
#keep the namespace of the root-element as default-namespace. without this the whole document would be rewritten with a
|
|
3095
|
+
#generated prefix (for example "<ns0:package xmlns:ns0=...>" instead of "<package xmlns=...>"), which is semantically
|
|
3096
|
+
#equivalent but unusual and therefore an unnecessary risk for tools which process the formatted file.
|
|
3097
|
+
#the "default_namespace"-argument of "tostring" can not be used for this because it rejects documents which contain
|
|
3098
|
+
#attributes without a namespace (which is the usual case, for example in nuspec-files), so the namespace is registered
|
|
3099
|
+
#as default-namespace instead. that registration is global, therefore the previous state gets restored afterwards.
|
|
3100
|
+
namespace = element.tag[1:element.tag.index("}")]
|
|
3101
|
+
namespace_map: dict = getattr(ET, "_namespace_map", None)
|
|
3102
|
+
previous_prefix = namespace_map.get(namespace) if namespace_map is not None else None
|
|
3103
|
+
ET.register_namespace(GeneralUtilities.empty_string, namespace)
|
|
3104
|
+
try:
|
|
3105
|
+
return ET.tostring(element, xml_declaration=add_xml_declaration, encoding="unicode")
|
|
3106
|
+
finally:
|
|
3107
|
+
if namespace_map is not None:
|
|
3108
|
+
if previous_prefix is None:
|
|
3109
|
+
namespace_map.pop(namespace, None)
|
|
3110
|
+
else:
|
|
3111
|
+
namespace_map[namespace] = previous_prefix
|
|
3112
|
+
|
|
3098
3113
|
@GeneralUtilities.check_arguments
|
|
3099
3114
|
def format_html_file(self, file: str, add_html_declaration: bool = False) -> None:
|
|
3100
3115
|
encoding = "utf-8"
|
|
@@ -257,13 +257,18 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
257
257
|
repository_folder: str =self.get_repository_folder()
|
|
258
258
|
build_folder = os.path.join(repository_folder, codeunitname, "Other", "Build")
|
|
259
259
|
outputfolder = GeneralUtilities.resolve_relative_path("./Other/Artifacts/BuildResult_NuGet",self.get_codeunit_folder())
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
nuspec_file = os.path.join(build_folder, f"{codeunitname}.nuspec")
|
|
261
|
+
root: etree._ElementTree = etree.parse(nuspec_file)
|
|
262
|
+
# the elements are matched by their local name because the nuspec-namespace can be declared as default-namespace
|
|
263
|
+
# (<package xmlns="...">) as well as with a prefix (<ns0:package xmlns:ns0="...">) and both variants are valid.
|
|
264
|
+
versions = root.xpath("//*[local-name() = 'package']/*[local-name() = 'metadata']/*[local-name() = 'version']/text()")
|
|
265
|
+
if len(versions) == 0:
|
|
266
|
+
raise ValueError(f"Can not determine the version because there is no version-element in \"{nuspec_file}\".")
|
|
267
|
+
current_version = versions[0]
|
|
262
268
|
nupkg_filename = f"{codeunitname}.{current_version}.nupkg"
|
|
263
269
|
nupkg_file = f"{build_folder}/{nupkg_filename}"
|
|
264
270
|
GeneralUtilities.ensure_file_does_not_exist(nupkg_file)
|
|
265
271
|
commit_id = self._protected_sc.git_get_commit_id(repository_folder)
|
|
266
|
-
nuspec_file = os.path.join(build_folder, f"{codeunitname}.nuspec")
|
|
267
272
|
# Pack the hand-written nuspec using "dotnet pack" (the classic "nuget pack" is not available in the dotnet-only build-container).
|
|
268
273
|
# With NuspecFile the package-content is taken entirely from the nuspec's <files>-list, so no rebuild happens here (the library was already built before).
|
|
269
274
|
self._protected_sc.run_program_argsasarray("dotnet", [
|
|
@@ -620,7 +625,7 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
620
625
|
test_working_directory = os.path.join(temp_folder, "WorkingDirectory")
|
|
621
626
|
GeneralUtilities.ensure_directory_exists(test_working_directory)
|
|
622
627
|
try:
|
|
623
|
-
program_output=self._protected_sc.run_program_argsasarray("dotnet", args, test_working_directory, print_live_output=self.get_verbosity()==LogLevel.Debug, timeoutInSeconds=60*
|
|
628
|
+
program_output=self._protected_sc.run_program_argsasarray("dotnet", args, test_working_directory, print_live_output=self.get_verbosity()==LogLevel.Debug, timeoutInSeconds=60*45, env_vars={"MSBUILDDISABLENODEREUSE": "1"})
|
|
624
629
|
test_output:str=program_output[1]
|
|
625
630
|
output_lines=program_output[1].split("\n")
|
|
626
631
|
output_lines=[line for line in output_lines if GeneralUtilities.string_has_content(line)]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scriptcollection
|
|
3
|
-
Version: 4.3.
|
|
3
|
+
Version: 4.3.63
|
|
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
|
|
@@ -9,7 +9,7 @@ ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrR
|
|
|
9
9
|
ScriptCollection/ProgramRunnerPopen.py,sha256=zVD-gZY85o8wiGFcpYAGNDl-tXaKzipl1Bkhqy2ois4,4681
|
|
10
10
|
ScriptCollection/ProgramRunnerSudo.py,sha256=RXsiceQ8W6a8YDk_2BPscVbIAmDIpIxqe9WHBy2r4CM,5233
|
|
11
11
|
ScriptCollection/SCLog.py,sha256=LdzSJy3NnnwYCCefz2h4tiTy4BjT8lOz3IBG_bMOg9E,4821
|
|
12
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
|
12
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=sdpTesYpkC35Y57jDFVRb5hwgP7qdztVIgegwRuqjak,252141
|
|
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=WO2M28c2tUwsXFNa2L9zqMhdlyObWm3qpPE0LdIs7SE,2315
|
|
@@ -53,7 +53,7 @@ ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
|
|
|
53
53
|
ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationBase.py,sha256=bT6Gd5pQpZCw4OQz6HWkPCSn5z__eUUEisABLDSxd0o,200
|
|
54
54
|
ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py,sha256=QyjOfMY22JWCvKjMelHiDWbJiWqotOfebpJpgDUaoO4,237
|
|
55
55
|
ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py,sha256=i0zEGehj0sttxjjZtoq2KFSKp_ulxVyWp_ZgAhIY_So,241
|
|
56
|
-
ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=
|
|
56
|
+
ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=ypanFntsqBd5wfHQMCRkZAh-tLH9xmLnykKm7gdnPMw,49097
|
|
57
57
|
ScriptCollection/TFCPS/DotNet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
58
|
ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=CwDBogG7Lg3IyywpCGta9gcaqWpgjENNXaupS19ZwTM,8751
|
|
59
59
|
ScriptCollection/TFCPS/Flutter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -67,8 +67,8 @@ ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py,sha256=Bd1gxCk9Fb
|
|
|
67
67
|
ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
68
|
ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=WhOsMpJxNGqnQGA3nJ99ruyqymxBeJxCcpK98zJduTo,1680
|
|
69
69
|
ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
70
|
-
scriptcollection-4.3.
|
|
71
|
-
scriptcollection-4.3.
|
|
72
|
-
scriptcollection-4.3.
|
|
73
|
-
scriptcollection-4.3.
|
|
74
|
-
scriptcollection-4.3.
|
|
70
|
+
scriptcollection-4.3.63.dist-info/METADATA,sha256=YAUlnQVtR2cF7t1yzjkSAkHdzNaI9P-FOf1M7QwB4Ts,7648
|
|
71
|
+
scriptcollection-4.3.63.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
72
|
+
scriptcollection-4.3.63.dist-info/entry_points.txt,sha256=52v0Kt6uaeQeDFjvc0Xcsd4YqQw2qKcs6GNgPO71pkU,5996
|
|
73
|
+
scriptcollection-4.3.63.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
|
74
|
+
scriptcollection-4.3.63.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|