ScriptCollection 4.4.6__py3-none-any.whl → 4.4.8__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.
@@ -39,7 +39,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
39
39
  from .ProgramRunnerPopen import ProgramRunnerPopen
40
40
  from .SCLog import SCLog, LogLevel
41
41
 
42
- version = "4.4.6"
42
+ version = "4.4.8"
43
43
  __version__ = version
44
44
 
45
45
  class VSCodeWorkspaceShellTask:
@@ -190,6 +190,20 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
190
190
  self._protected_sc.log.log(f"The dependencies of codeunit \"{codeunit_name}\" are not restored in locked mode for the runtime \"{runtime}\", because the following lock-file(s) do not exist yet: {', '.join(missing_lock_files)}. The restore creates them now; commit them so that the dependencies of this codeunit are pinned.", LogLevel.Warning)
191
191
  return result
192
192
 
193
+ @GeneralUtilities.check_arguments
194
+ def __get_arguments_which_prevent_writing_a_lock_file(self) -> list[str]:
195
+ """Returns the arguments which keep a dotnet-operation from writing a lock-file.
196
+
197
+ The lock-files belong to the restore of the build alone, because only there the runtime - and with it the name of the
198
+ lock-file which belongs to that runtime - is known. Every other dotnet-operation of a codeunit (linting, test, ...)
199
+ works on the solution instead of on one runtime and restores implicitly, and the csproj-property
200
+ "RestorePackagesWithLockFile" would make each of those restores write a lock-file under the default-name. Such a file
201
+ is never validated against anything, because locked mode is only requested for the runtime-specific one, so it would
202
+ only be an additional file which looks like the relevant pinning without being it. The value has to be passed on the
203
+ command-line because a property which the project-file sets explicitly wins over one which comes from the
204
+ environment."""
205
+ return ["-p:RestorePackagesWithLockFile=false"]
206
+
193
207
  @GeneralUtilities.check_arguments
194
208
  def __standardized_tasks_build_for_dotnet_build(self, csproj_file: str, originaloutputfolder: str, files_to_sign: dict[str, str], commitid: str, runtimes: list[str], target_environmenttype_mapping: dict[str, str], copy_license_file_to_target_folder: bool, repository_folder: str, codeunit_name: str) -> None:
195
209
  self._protected_sc.assert_is_git_repository(repository_folder)
@@ -319,7 +333,11 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
319
333
  self._protected_sc.log.log("Generate SBOM...")
320
334
  codeunit_name = os.path.basename(codeunit_folder)
321
335
  bomfile_folder = "Other/Artifacts/BOM"
322
- self._protected_sc.run_program_argsasarray("dotnet", ["CycloneDX", f"{codeunit_name}/{codeunit_name}.csproj", "-o", bomfile_folder], codeunit_folder)
336
+ # "-dpr" keeps CycloneDX from restoring the project itself. The SBOM is generated directly after the project and its
337
+ # test-project were built, so the dependencies are restored and the assets-file CycloneDX reads is up-to-date already.
338
+ # Its restore would also not be able to name the lock-file of the runtime the build used, so it would write one under
339
+ # the default-name (see __get_arguments_which_prevent_writing_a_lock_file).
340
+ self._protected_sc.run_program_argsasarray("dotnet", ["CycloneDX", f"{codeunit_name}/{codeunit_name}.csproj", "-o", bomfile_folder, "-dpr"], codeunit_folder)
323
341
  codeunitversion = self.tfcps_Tools_General.get_version_of_codeunit(os.path.join(codeunit_folder, f"{codeunit_name}.codeunit.xml"))
324
342
  target = f"{codeunit_folder}/{bomfile_folder}/{codeunit_name}.{codeunitversion}.sbom.xml"
325
343
  GeneralUtilities.ensure_file_does_not_exist(target)
@@ -351,7 +369,7 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
351
369
  # begin with a drive-letter anymore) and resolves against the working-directory, so it writes to a path
352
370
  # which contains a quote in the middle. On Linux that only creates a strangely named folder, on Windows a
353
371
  # quote is not allowed in a path and the msbuild-task GenerateDepsFile fails with an IOException.
354
- run_result = self._protected_sc.run_program_argsasarray("dotnet", ["build", sln_file, "-nologo", "-v", "minimal", "-o", temp_output_folder], temp_output_folder, throw_exception_if_exitcode_is_not_zero=False, env_vars={"DOTNET_CLI_UI_LANGUAGE": "en-US", "MSBUILDDISABLENODEREUSE": "1"})
372
+ run_result = self._protected_sc.run_program_argsasarray("dotnet", ["build", sln_file, "-nologo", "-v", "minimal", "-o", temp_output_folder]+self.__get_arguments_which_prevent_writing_a_lock_file(), temp_output_folder, throw_exception_if_exitcode_is_not_zero=False, env_vars={"DOTNET_CLI_UI_LANGUAGE": "en-US", "MSBUILDDISABLENODEREUSE": "1"})
355
373
  finally:
356
374
  GeneralUtilities.ensure_directory_does_not_exist(temp_output_folder)
357
375
  diagnostics: list[tuple[LogLevel, str, str | None, int | None]] = []
@@ -676,7 +694,7 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
676
694
  GeneralUtilities.ensure_file_does_not_exist(target_file)
677
695
 
678
696
  sln_file = os.path.join(codeunit_folder, f"{codeunit_name}.sln")
679
- args: list[str] = ["test", sln_file, "-c", dotnet_build_configuration, "-o", temp_folder]
697
+ args: list[str] = ["test", sln_file, "-c", dotnet_build_configuration, "-o", temp_folder]+self.__get_arguments_which_prevent_writing_a_lock_file()
680
698
  runsettings_path = os.path.join(codeunit_folder, runsettings_file)
681
699
  if os.path.isfile(runsettings_path):
682
700
  args += ["--settings", runsettings_path]
@@ -80,7 +80,6 @@ class TFCPS_CodeUnitSpecific_Go_Functions(TFCPS_CodeUnitSpecific_Base):
80
80
  @GeneralUtilities.check_arguments
81
81
  def run_testcases(self) -> None:
82
82
  codeunit_name = self.get_codeunit_name()
83
- go_module_folder = self.get_go_module_folder()
84
83
  coverprofile_file = os.path.join(GeneralUtilities.get_temp_folder(), f"{codeunit_name}.coverprofile")
85
84
  GeneralUtilities.ensure_file_does_not_exist(coverprofile_file)
86
85
  coverage_file = os.path.join(self.get_artifacts_folder(), "TestCoverage", "TestCoverage.xml")
@@ -43,6 +43,13 @@ class TFCPS_VisualRegressionTests:
43
43
  # beginning of every run.
44
44
  __test_results_folder_relative_path: str = "Other/Artifacts/VisualRegressionTestResults"
45
45
 
46
+ # The file which maps a domain to an address inside a container. It belongs to the container which owns the
47
+ # network-namespace, so the playwright-container uses the one of this container when it joins it.
48
+ __hosts_file: str = "/etc/hosts"
49
+
50
+ # The address the application under test listens on when it was started by this process.
51
+ __loopback_address: str = "127.0.0.1"
52
+
46
53
  # The folder the screenshots of failed testcases are preserved in. Both folders are located in
47
54
  # "Other/Artifacts", which is ignored by git.
48
55
  __failed_testcases_folder_relative_path: str = "Other/Artifacts/VisualRegressionTestFailures"
@@ -325,14 +332,38 @@ class TFCPS_VisualRegressionTests:
325
332
  # loopback-interface of that container. Sharing its network-namespace is the only way to reach it:
326
333
  # its ports are not published to the host, and publishing them would additionally make two parallel
327
334
  # builds on the same host collide with each other.
328
- address_of_application: str = "127.0.0.1"
335
+ # The domain can not be passed as "--add-host" in this case: a container which joins the
336
+ # network-namespace of another one uses the hosts-file of that other container and therefore can not
337
+ # have entries of its own, which docker refuses with "conflicting options: custom host-to-IP mapping
338
+ # and the network mode". The mapping is therefore written into the hosts-file of this container, which
339
+ # the playwright-container sees through exactly that sharing.
340
+ self.__ensure_domain_is_mapped_in_the_own_hosts_file(domain_of_application)
329
341
  result: list[str] = ["--network", f"container:{self.__get_own_container_id()}"]
330
342
  else:
331
343
  # The application runs directly on the host of the container, which docker makes reachable under the
332
- # address "host-gateway".
333
- address_of_application: str = "host-gateway"
334
- result: list[str] = []
335
- return result+["--add-host", f"{domain_of_application}:{address_of_application}", "-e", f"{self.__environment_variable_name_of_application_host}={domain_of_application}"]
344
+ # address "host-gateway". The playwright-container has a hosts-file of its own in this case, so the
345
+ # mapping can be passed as an argument.
346
+ result: list[str] = ["--add-host", f"{domain_of_application}:host-gateway"]
347
+ return result+["-e", f"{self.__environment_variable_name_of_application_host}={domain_of_application}"]
348
+
349
+ @GeneralUtilities.check_arguments
350
+ def __ensure_domain_is_mapped_in_the_own_hosts_file(self, domain_of_application: str) -> None:
351
+ """Maps the given domain to the loopback-interface in the hosts-file of the container this process runs in.
352
+
353
+ The playwright-container joins the network-namespace of this container and therefore uses its hosts-file, so
354
+ this is the only place where the mapping can be put for the browser to resolve the domain.
355
+ The mapping is appended instead of the file being rewritten, because the file is a bind-mount of the
356
+ docker-daemon (which is also how __get_own_container_id recognizes the own container): replacing it would
357
+ break that mount and the mapping would not reach the playwright-container.
358
+ A mapping which is already there is not appended a second time, so that the runs for the further browsers of
359
+ the codeunit do not add it again."""
360
+ for line in GeneralUtilities.read_text_from_file(self.__hosts_file).splitlines():
361
+ # Everything behind a "#" is a comment, and a line maps its first field (the address) to all further
362
+ # fields (the names it is reachable under).
363
+ fields: list[str] = line.split("#", 1)[0].split()
364
+ if 1 < len(fields) and fields[0] == self.__loopback_address and domain_of_application in fields[1:]:
365
+ return
366
+ GeneralUtilities.append_line_to_file(self.__hosts_file, f"{self.__loopback_address}\t{domain_of_application}")
336
367
 
337
368
  @GeneralUtilities.check_arguments
338
369
  def __get_mount_arguments(self, codeunit_folder: str, codeunit_folder_in_container: str, playwright_project_folder_relative_path: str) -> list[str]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.4.6
3
+ Version: 4.4.8
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=ot9Ib-plQ8wejR9M2XXfnx6GR-va9k8SH1gAC5kjaJ0,5123
11
11
  ScriptCollection/SCLog.py,sha256=Fjf8Pdi63cXHGMxL_aI6A0dwGm7QIfrv3czjvpSUlaM,4705
12
- ScriptCollection/ScriptCollectionCore.py,sha256=IsdSBIUYEyvXpvdHEOrC0dCFuXK9Aot9UTy5DI7B_a0,261810
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=o5CYHDYwXRt25TEgmN994-f_H1HSeSZv-YSfK_x994o,261810
13
13
  ScriptCollection/TestKind.py,sha256=EBTLR8yBz5VmWA2NZIpDTbQNg6tkfv_kAsIzEJ--mCI,1756
14
14
  ScriptCollection/UnassignedVariablesCheck.py,sha256=v59qLQ5RRvx31ouuCW7NWZj3McWENvGBPkV5ZGBmqJE,4344
15
15
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -48,18 +48,18 @@ ScriptCollection/TFCPS/TFCPS_OCIImageSecretScan.py,sha256=rhw0glr4gZ5enG9faOD51x
48
48
  ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=XLVsFTA1jvfDbZ7wYJgIdEByZhF_bYVbA5jkisuvK4k,2322
49
49
  ScriptCollection/TFCPS/TFCPS_RemoteBuild.py,sha256=Z8Gw-j5I7VPafHEsVeQJ2gTTKVLAnnhwZhY8IVTi2Qk,11867
50
50
  ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=6oi5vdng6wMx2inbj8KTwIFOPvZAO4ekIVLQcq4pZ9Y,162988
51
- ScriptCollection/TFCPS/TFCPS_VisualRegressionTests.py,sha256=iTsgZgUGeJMpFgYC8NDMep7xb0Ad53VXlrA2Q1gD6rs,34565
51
+ ScriptCollection/TFCPS/TFCPS_VisualRegressionTests.py,sha256=6_63udxHnPlu_TMk_ftLZTnzriJO8MCxVCVAsweZqHs,37073
52
52
  ScriptCollection/TFCPS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
53
  ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py,sha256=919mNfzVRurTJhWi8WV0oEAFoH-yd4a6m2Rbxcf2oZ4,19927
54
54
  ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
55
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationBase.py,sha256=bT6Gd5pQpZCw4OQz6HWkPCSn5z__eUUEisABLDSxd0o,200
56
56
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py,sha256=QyjOfMY22JWCvKjMelHiDWbJiWqotOfebpJpgDUaoO4,237
57
57
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py,sha256=i0zEGehj0sttxjjZtoq2KFSKp_ulxVyWp_ZgAhIY_So,241
58
- ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=omrV59RJhbwljRPzZch7Ldd8CvN4VvGPPmOZJ4sK8VM,54550
58
+ ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=9KUJLrYqEXV-h-AR4gde2u-KX-JXwtb0BNJ9OyuUEnM,56266
59
59
  ScriptCollection/TFCPS/DotNet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
60
  ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=cAE_OFJBU0M3L2Ov5PUUMH7aOVVzKtnKlFoXSw43fng,8759
61
61
  ScriptCollection/TFCPS/Flutter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
- ScriptCollection/TFCPS/Go/TFCPS_CodeUnitSpecific_Go.py,sha256=zhFvSA60sZq2s1cI9zDa-vhnQqtiICr2-pX1nUtJz8c,9067
62
+ ScriptCollection/TFCPS/Go/TFCPS_CodeUnitSpecific_Go.py,sha256=m4Pax-U6o5XuspLnLfnWjyQMtoC7zBDDNJW9EhLWjeE,9012
63
63
  ScriptCollection/TFCPS/Go/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
64
  ScriptCollection/TFCPS/Maven/TFCPS_CodeUnitSpecific_Maven.py,sha256=HDZlU70lF4nxUgsi7-TaFrFpbw_imw6dBagfgL6tDW8,10593
65
65
  ScriptCollection/TFCPS/Maven/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -71,8 +71,8 @@ ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=yyjWPMHQjPLkML
71
71
  ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
72
72
  ScriptCollection/TFCPS/TypeScript/TFCPS_CodeUnitSpecific_TypeScript.py,sha256=5z990qyO5durX07xRWRwju1hl6wpjQAy2f-yRwJ-7s0,11856
73
73
  ScriptCollection/TFCPS/TypeScript/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
- scriptcollection-4.4.6.dist-info/METADATA,sha256=Yatq_B7nMbb-6DQ2a99Qd_rLXMDnlZ__yKyzGfjdbf8,7647
75
- scriptcollection-4.4.6.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
76
- scriptcollection-4.4.6.dist-info/entry_points.txt,sha256=Aj6CHuJxASMe52fK_O6-bNJ_uhxcDb-AgRxFOeTojyE,6069
77
- scriptcollection-4.4.6.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
78
- scriptcollection-4.4.6.dist-info/RECORD,,
74
+ scriptcollection-4.4.8.dist-info/METADATA,sha256=5Mrm_a1r6igFqkt0dpgC4Vq8xKLORnMRgqYCSDEL2QA,7647
75
+ scriptcollection-4.4.8.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
76
+ scriptcollection-4.4.8.dist-info/entry_points.txt,sha256=Aj6CHuJxASMe52fK_O6-bNJ_uhxcDb-AgRxFOeTojyE,6069
77
+ scriptcollection-4.4.8.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
78
+ scriptcollection-4.4.8.dist-info/RECORD,,