ScriptCollection 4.3.50__py3-none-any.whl → 4.3.51__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.
@@ -337,7 +337,7 @@ class GeneralUtilities:
337
337
  @staticmethod
338
338
  @check_arguments
339
339
  def replace_xmltag_in_file(file: str, tag: str, new_value: str, encoding="utf-8") -> None:
340
- GeneralUtilities.assert_condition(tag.isalnum(tag), f"Invalid tag: \"{tag}\"")
340
+ GeneralUtilities.assert_condition(tag.isalnum(), f"Invalid tag: \"{tag}\"")
341
341
  GeneralUtilities.replace_regex_in_file(file, f"<{tag}>.*</{tag}>", f"<{tag}>{new_value}</{tag}>", encoding)
342
342
 
343
343
  @staticmethod
@@ -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.50"
42
+ version = "4.3.51"
43
43
  __version__ = version
44
44
 
45
45
  class VSCodeWorkspaceShellTask:
@@ -548,12 +548,11 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
548
548
  result: list[str] = []
549
549
  regex_lines = GeneralUtilities.string_to_lines(regex)
550
550
  file_content_lines = GeneralUtilities.string_to_lines(file_content)
551
- #amount_of_regexes = len(regex_lines)
552
551
  amount_of_lines = len(file_content_lines)
553
552
  if amount_of_lines< len(regex_lines):
554
553
  result.append("csproj-file has less lines than the regex requires.")
555
554
  return result
556
- for i in range(35):
555
+ for i in range(35):#you can do this check only for the first 35 lines
557
556
  s = file_content_lines[i]
558
557
  r = regex_lines[i]
559
558
  if not re.match(r, s):
@@ -433,6 +433,15 @@ class TFCPS_CodeUnit_BuildCodeUnits:
433
433
  scan_args = scan_args + ["-c", f"{repository_in_scan_container}/.betterleaks.toml"]
434
434
  else:
435
435
  self.sc.log.log(f"No betterleaks-config found at '{config_file}'; scanning with default ruleset only.", LogLevel.Warning)
436
+ # Verify that the docker-daemon is reachable before running the scan. The scan runs betterleaks via "docker run",
437
+ # and "docker run" returns exit-code 1 both when the daemon is unreachable and when betterleaks actually finds
438
+ # secrets. Without this pre-check an unreachable daemon (e.g. the socket is not forwarded into a build-container)
439
+ # would be misreported below as "found secrets", which is a misleading infrastructure-error. "docker version
440
+ # --format {{.Server.Version}}" queries the daemon (the server-part) and exits non-zero exactly when it can not
441
+ # be reached, so it distinguishes "docker not available" from a real scan-result.
442
+ daemon_check = self.sc.run_program_argsasarray("docker", ["version", "--format", "{{.Server.Version}}"], throw_exception_if_exitcode_is_not_zero=False, print_live_output=False)
443
+ if daemon_check[0] != 0:
444
+ raise ValueError(f"The secret-scan can not be performed because the docker-daemon is not reachable (exit-code {daemon_check[0]}: {daemon_check[2].strip()}). The scan runs betterleaks via 'docker run', which requires a running docker-daemon (inside a build-container its socket must be forwarded to the host-daemon). This is an infrastructure-problem, not a secret-finding in the repository.")
436
445
  args = ["run", "--rm"] + mount_arguments + [image] + scan_args
437
446
  result = self.sc.run_program_argsasarray("docker", args, throw_exception_if_exitcode_is_not_zero=False, print_live_output=self.sc.log.loglevel==LogLevel.Debug)
438
447
  if result[0] != 0:
@@ -29,6 +29,9 @@ class TFCPS_Tools_General:
29
29
  # Relative path (inside the source-repository and inside the ScriptCollection.Resources-package) of the
30
30
  # file that pins the OpenAPIGenerator-version used as default when no repository-specific version is given.
31
31
  __openapigenerator_version_resource_relative_path:str="Dependencies/OpenAPIGenerator/Version.txt"
32
+ # Relative path (inside the source-repository and inside the ScriptCollection.Resources-package) of the
33
+ # file that pins the PlantUML-version used as default when no repository-specific version is given.
34
+ __plantuml_version_resource_relative_path:str="Dependencies/PlantUML/Version.txt"
32
35
  # Font used for rendering all PlantUML-diagrams. Pinning it makes the resulting SVG identical across machines
33
36
  # (PlantUML's default 'sans-serif' otherwise resolves to different host-fonts on Windows vs Linux, which changes
34
37
  # the computed text-lengths and coordinates and thus produces spurious diffs). The font is available in the
@@ -113,7 +116,10 @@ class TFCPS_Tools_General:
113
116
  @GeneralUtilities.check_arguments
114
117
  def download_plantuml(self, enforce_update: bool = False) -> None:
115
118
  self.__sc.log.log("Download cachable tool \"PlantUML\" into global cache...", LogLevel.Debug)
116
- self.ensure_plantuml_is_available(enforce_update)
119
+ # No repository-context is available when warming the global cache (e.g. scdownloadcachabletools in a
120
+ # build-image), so download the default version pinned by the ScriptCollection-package. Actual builds
121
+ # pass the version pinned in their own '<repo>/Other/Resources/Dependencies/PlantUML/Version.txt'.
122
+ self.ensure_plantuml_is_available(enforce_update, self.get_default_plantuml_version())
117
123
 
118
124
  @GeneralUtilities.check_arguments
119
125
  def download_jre(self, enforce_update: bool = False) -> None:
@@ -679,7 +685,7 @@ class TFCPS_Tools_General:
679
685
  def generate_svg_files_from_plantuml_files_for_repository(self, repository_folder: str,use_cache:bool) -> None:
680
686
  self.__sc.log.log("Generate svg-files from plantuml-files...")
681
687
  self.__sc.assert_is_git_repository(repository_folder)
682
- plantuml_jar_file=self.ensure_plantuml_is_available(not use_cache, repository_folder)
688
+ plantuml_jar_file=self.ensure_plantuml_is_available(not use_cache, self.get_plantuml_version(repository_folder))
683
689
  java_executable=self.ensure_jre_is_available(not use_cache, repository_folder)
684
690
  target_folder = os.path.join(repository_folder, "Other", "Reference")
685
691
  self.__generate_svg_files_from_plantuml(target_folder, plantuml_jar_file, java_executable)
@@ -687,19 +693,43 @@ class TFCPS_Tools_General:
687
693
  @GeneralUtilities.check_arguments
688
694
  def generate_svg_files_from_plantuml_files_for_codeunit(self, codeunit_folder: str,use_cache:bool) -> None:
689
695
  self.assert_is_codeunit_folder(codeunit_folder)
690
- plantuml_jar_file=self.ensure_plantuml_is_available(not use_cache, os.path.dirname(codeunit_folder))
696
+ plantuml_jar_file=self.ensure_plantuml_is_available(not use_cache, self.get_plantuml_version(os.path.dirname(codeunit_folder)))
691
697
  java_executable=self.ensure_jre_is_available(not use_cache, os.path.dirname(codeunit_folder))
692
698
  target_folder = os.path.join(codeunit_folder, "Other", "Reference")
693
699
  self.__generate_svg_files_from_plantuml(target_folder, plantuml_jar_file, java_executable)
694
700
 
695
701
  @GeneralUtilities.check_arguments
696
- def ensure_plantuml_is_available(self, enforce_update: bool, repository_folder: str = None) -> str:
697
- pinned_version: str = None
702
+ def ensure_plantuml_is_available(self, enforce_update: bool, version: str) -> str:
703
+ """Ensures the plantuml.jar for the given version is available in the global cache and returns its absolute path.
704
+ The jar is stored under a version-specific subfolder ('<cache>/Tools/PlantUML/<version>/plantuml.jar') so that
705
+ different versions coexist without evicting each other. The version must be given explicitly (there is no default);
706
+ callers resolve it via get_plantuml_version (the repository-pin or the bundled default)."""
707
+ local_resource_name = os.path.join("PlantUML", version)
708
+ return self.ensure_file_from_github_assets_is_available_with_retry("plantuml", "plantuml", local_resource_name, "plantuml.jar", lambda latest_version: "plantuml.jar", enforce_update=enforce_update, pinned_version=version)
709
+
710
+ @GeneralUtilities.check_arguments
711
+ def get_plantuml_version(self, repository_folder: str = None) -> str:
712
+ """Resolves the PlantUML-version to use: the repository-specific pin in
713
+ '<repo>/Other/Resources/Dependencies/PlantUML/Version.txt' if present, otherwise the default
714
+ bundled with ScriptCollection (see get_default_plantuml_version)."""
698
715
  if repository_folder is not None:
699
716
  version_file = os.path.join(repository_folder, "Other", "Resources", "Dependencies", "PlantUML", "Version.txt")
700
717
  if os.path.isfile(version_file):
701
- pinned_version = GeneralUtilities.read_text_from_file(version_file).strip()
702
- 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)
718
+ return GeneralUtilities.read_text_from_file(version_file).strip()
719
+ return self.get_default_plantuml_version()
720
+
721
+ @GeneralUtilities.check_arguments
722
+ def get_default_plantuml_version(self) -> str:
723
+ """Returns the PlantUML-version used when no repository-specific version is pinned (for example when warming
724
+ the global cache via scdownloadcachabletools). The value is read from the version-file bundled with the
725
+ ScriptCollection-package, with a fallback to the source-file for an unbuilt source-checkout."""
726
+ try:
727
+ content = GeneralUtilities._internal_load_resource(TFCPS_Tools_General.__plantuml_version_resource_relative_path)
728
+ return content.decode("utf-8").strip()
729
+ except (FileNotFoundError, ModuleNotFoundError):
730
+ source_version_file = GeneralUtilities.resolve_relative_path(f"../../../Other/Resources/{TFCPS_Tools_General.__plantuml_version_resource_relative_path}", os.path.dirname(__file__))
731
+ GeneralUtilities.assert_file_exists(source_version_file)
732
+ return GeneralUtilities.read_text_from_file(source_version_file).strip()
703
733
 
704
734
  @GeneralUtilities.check_arguments
705
735
  def get_default_jre_version(self) -> str:
@@ -1531,7 +1561,9 @@ class TFCPS_Tools_General:
1531
1561
  version_file = os.path.join(dependency_folder, "Version.txt")
1532
1562
  if not os.path.isfile(version_file):
1533
1563
  raise ValueError(f"Version-file for dependency {dependency_name} does not exist. Expected location: {version_file}")
1534
- return GeneralUtilities.read_text_from_file(version_file)
1564
+ # strip() so a trailing line-break in the Version.txt-file does not become part of the version (consistent with
1565
+ # get_jre_version); the raw value is often used verbatim, e.g. as a docker-build-arg or inside a download-url.
1566
+ return GeneralUtilities.read_text_from_file(version_file).strip()
1535
1567
 
1536
1568
  @GeneralUtilities.check_arguments
1537
1569
  def update_dependency_in_resources_folder(self, update_dependencies_file, dependency_name: str, latest_version_function: str) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.3.50
3
+ Version: 4.3.51
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,7 +1,7 @@
1
1
  ScriptCollection/AnionBuildPlatform.py,sha256=GP-jnb1GbvT8jzlH-cqnxgOzBzeUdiaWnDXtKNjsxiA,12153
2
2
  ScriptCollection/CertificateUpdater.py,sha256=dR5JpJDlZdjD4_pgMz7zCrt1IM7VfatmK6pULSczxQw,9693
3
3
  ScriptCollection/Executables.py,sha256=cSnyAwQq3c79hKrARAh0MO3SH61iTtxwjfr0cchECro,67063
4
- ScriptCollection/GeneralUtilities.py,sha256=qYhrKkwbEewGIppuxYRmGhLP50C443tw7sBlwH7Mkbc,71606
4
+ ScriptCollection/GeneralUtilities.py,sha256=5b6GB8Ixsa_qbmc3_RdZviO05Ak1B7hlnzU0SyE37bw,71603
5
5
  ScriptCollection/HTTPMaintenanceOverheadHelper.py,sha256=TToNtyO1XzsMbBsTBf3o0xgOK0v4Jf03qw2Z0xb2nCk,2007
6
6
  ScriptCollection/ProcessesRunner.py,sha256=yYaC95h40uszuZPggn2kK3qXIN2ZjGMCavo-NQ53ElQ,1537
7
7
  ScriptCollection/ProgramRunnerBase.py,sha256=eZenpiIFW1dhvSVCG7cfBs5hO4_KLlOxR7oXoSxUDmk,2286
@@ -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=iU0PgOfcp47219rCrM9fTPelBqf18wyblrxMHmrj9wI,248737
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=g-VlCRX_x0JPVuvrgByWevy4-wxGPZxJEBy1AQo7OWc,248737
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
@@ -26,6 +26,7 @@ ScriptCollection/Resources/CultureChooser/CultureChooser.js,sha256=5-4pwGDq5j1Un
26
26
  ScriptCollection/Resources/CultureChooser/index.html,sha256=gxQzbrSp4WU52TqN-gcBEtz2gJXmmM14OwTSFtFVRvw,276
27
27
  ScriptCollection/Resources/Dependencies/JRE/Version.txt,sha256=WlFzNJMH4lfVzW5QGHnuE52jLujSGpQ48zVB-Cln-7g,9
28
28
  ScriptCollection/Resources/Dependencies/OpenAPIGenerator/Version.txt,sha256=hdAgOhOHx4s13fJ-j0A06oYoM9rdEfDe0RzHoeAKXxo,7
29
+ ScriptCollection/Resources/Dependencies/PlantUML/Version.txt,sha256=j8zklHUnAikNxeYhvQJsadO-Aa6AqQnIoEAwW_uu-a0,10
29
30
  ScriptCollection/Resources/Fonts/DejaVuSans-Bold.ttf,sha256=5kdsG4BQKSQpTu1AiUxbGOBsGBREypU-UzQmLfnCdyQ,705684
30
31
  ScriptCollection/Resources/Fonts/DejaVuSans-BoldOblique.ttf,sha256=60NtygwllLc9i2A7iS43T9_Y2IXSX_tPGN9MTAtJ5Q8,643292
31
32
  ScriptCollection/Resources/Fonts/DejaVuSans-Oblique.ttf,sha256=SvdfoW7m061D4ezsQYYsJJVK8mpVxrseuye9SGpQ9fQ,635416
@@ -35,21 +36,21 @@ ScriptCollection/Resources/MaintenanceSite/MaintenanceSite.html,sha256=CX9S1bdOz
35
36
  ScriptCollection/TFCPS/SCTaskRunnerServer.py,sha256=rpuwSsQ6YQfZS2LGnvOH5ql8zs_-cHU4LQttS7XNT60,11272
36
37
  ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=H9FWlS6BPK-UWJXdWN686ePky4Hq-Q13T0Kx8HSJu7s,34990
37
38
  ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=Ll5EOkpVpPiFrM2mLeQXolaF7075IwgtnHXvfdpkH4k,9904
38
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=-Ggfc8z8TdfWwkmW9s9Rb3KcfJ-cF1hTa7g6SGx8ILQ,33719
39
+ ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=7dfPmrr2LkChVTayTv1MBFqHJuV5xdE5nn5yX1-4kLY,35041
39
40
  ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=X2NgZgbOkJsdZ6wMHB_RuS_rQCuz5oQCqzYrxyXBN9Q,6680
40
41
  ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=5vCFfDiU8bvfcnoKNs2ATS8nsl6mYXcIuX7XfYE0tvg,2116
41
42
  ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=zp7n0Li7GTi4tERDMgDcJ-o3m6131m31zvkat0lALEc,7781
42
43
  ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=jQ0B3yq45we-8a0KuNFMfXCk9MfzPpTv2QgDWMN34x4,22792
43
44
  ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=JYiDqDsfVJQWS9xWMi_UzfXnXsJRnPRxAzFr82bUEvI,2370
44
45
  ScriptCollection/TFCPS/TFCPS_RemoteBuild.py,sha256=Z8Gw-j5I7VPafHEsVeQJ2gTTKVLAnnhwZhY8IVTi2Qk,11867
45
- ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=QnMIJ0Bsk6Zkjz_kRFhP4guRAT_TlrQwPV6T-o0tD2A,130301
46
+ ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=JbOd40pj3XeIIFTL-B_k5zHlRm9R8QXW-nJgkl4dvhE,133172
46
47
  ScriptCollection/TFCPS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
48
  ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py,sha256=wS2yzYUmJ4m0cf6cBYVTHsiXSXfYhHoLFFy8x6yEQvY,19573
48
49
  ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
50
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationBase.py,sha256=bT6Gd5pQpZCw4OQz6HWkPCSn5z__eUUEisABLDSxd0o,200
50
51
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py,sha256=QyjOfMY22JWCvKjMelHiDWbJiWqotOfebpJpgDUaoO4,237
51
52
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py,sha256=i0zEGehj0sttxjjZtoq2KFSKp_ulxVyWp_ZgAhIY_So,241
52
- ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=ovi0WKgNykkGVQBLI6F5IS3xUD53MxqOgZWF1W2RnCw,46368
53
+ ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=jPLgGKd0VzB6zsN8XhPnNhxMyxpHmAbGoe2a76GcTQY,46371
53
54
  ScriptCollection/TFCPS/DotNet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
55
  ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=CwDBogG7Lg3IyywpCGta9gcaqWpgjENNXaupS19ZwTM,8751
55
56
  ScriptCollection/TFCPS/Flutter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -63,8 +64,8 @@ ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py,sha256=Bd1gxCk9Fb
63
64
  ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
65
  ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=WhOsMpJxNGqnQGA3nJ99ruyqymxBeJxCcpK98zJduTo,1680
65
66
  ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
- scriptcollection-4.3.50.dist-info/METADATA,sha256=fJ_EvoQhxfx_Zw7sE-OQWr0m_nl6N8pYaBLdTKUcAm0,7648
67
- scriptcollection-4.3.50.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
68
- scriptcollection-4.3.50.dist-info/entry_points.txt,sha256=xWOFHGufgef8jsKQ3c2pFBfM_hjweFXuxfKmghQs-VI,5814
69
- scriptcollection-4.3.50.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
70
- scriptcollection-4.3.50.dist-info/RECORD,,
67
+ scriptcollection-4.3.51.dist-info/METADATA,sha256=PAsXAgWMHNGEJmyjovANZSnUGP_6sXtPxkKiaKRZJm8,7648
68
+ scriptcollection-4.3.51.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
69
+ scriptcollection-4.3.51.dist-info/entry_points.txt,sha256=xWOFHGufgef8jsKQ3c2pFBfM_hjweFXuxfKmghQs-VI,5814
70
+ scriptcollection-4.3.51.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
71
+ scriptcollection-4.3.51.dist-info/RECORD,,