ScriptCollection 4.3.12__py3-none-any.whl → 4.3.14__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.
@@ -5,6 +5,7 @@ from .SCLog import LogLevel
5
5
  from .GeneralUtilities import GeneralUtilities
6
6
  from .ScriptCollectionCore import ScriptCollectionCore
7
7
 
8
+ @GeneralUtilities.deprecated()
8
9
  class AnionBuildPlatformConfiguration:
9
10
  build_repositories_folder:str = None
10
11
  additional_arguments_file:str = None
@@ -30,6 +31,7 @@ class AnionBuildPlatformConfiguration:
30
31
  self.update_dependencies=update_dependencies
31
32
  self.lazy_mode=lazy_mode
32
33
 
34
+ @GeneralUtilities.deprecated()
33
35
  class AnionBuildPlatform:
34
36
 
35
37
  __configuration: AnionBuildPlatformConfiguration = None
@@ -144,6 +146,7 @@ class AnionBuildPlatform:
144
146
 
145
147
 
146
148
 
149
+ @GeneralUtilities.deprecated()
147
150
  class TFCPS_AnionBuildPlatform_CLI:
148
151
 
149
152
  @staticmethod
@@ -96,10 +96,28 @@ class GeneralUtilities:
96
96
 
97
97
  @staticmethod
98
98
  def deprecated(reason: str=None):
99
- def decorator(func):
100
- @functools.wraps(func)
99
+ def decorator(target):
100
+ if isinstance(target, type):
101
+ # target is a class: wrap its __init__ so the warning is emitted on instantiation while target stays a class.
102
+ original_init = target.__init__
103
+
104
+ @functools.wraps(original_init)
105
+ def init_wrapper(self, *args, **kwargs):
106
+ msg = f"Class {target.__name__} is deprecated."
107
+ if GeneralUtilities.string_has_content(reason):
108
+ msg += f" {reason}"
109
+ warnings.warn(
110
+ msg,
111
+ category=DeprecationWarning,
112
+ stacklevel=2
113
+ )
114
+ return original_init(self, *args, **kwargs)
115
+ target.__init__ = init_wrapper
116
+ return target
117
+
118
+ @functools.wraps(target)
101
119
  def wrapper(*args, **kwargs):
102
- msg = f"Function {func.__name__}() is deprecated."
120
+ msg = f"Function {target.__name__}() is deprecated."
103
121
  if GeneralUtilities.string_has_content(reason):
104
122
  msg += f" {reason}"
105
123
  warnings.warn(
@@ -107,7 +125,7 @@ class GeneralUtilities:
107
125
  category=DeprecationWarning,
108
126
  stacklevel=2
109
127
  )
110
- return func(*args, **kwargs)
128
+ return target(*args, **kwargs)
111
129
  return wrapper
112
130
  return decorator
113
131
 
ScriptCollection/SCLog.py CHANGED
@@ -23,6 +23,7 @@ class SCLog:
23
23
  add_overhead_to_logfile: bool = None
24
24
  print_as_color: bool = None
25
25
  add_milliseconds_to_logfile_entry: bool = None
26
+ subnamespace:str=None
26
27
 
27
28
  def __init__(self, log_file: str = None, loglevel: LogLevel = None, print_as_color: bool = True):
28
29
  self.log_file = log_file
@@ -59,6 +60,8 @@ class SCLog:
59
60
  part1: str = GeneralUtilities.empty_string
60
61
  part2: str = GeneralUtilities.empty_string
61
62
  part3: str = "] "
63
+ if GeneralUtilities.string_has_content(self.subnamespace):
64
+ part3 = part3 + f"[{self.subnamespace}] "
62
65
  part4: str = message
63
66
 
64
67
  if loglevel == LogLevel.Warning and not message.startswith("Warning: "):
@@ -37,7 +37,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
37
37
  from .ProgramRunnerPopen import ProgramRunnerPopen
38
38
  from .SCLog import SCLog, LogLevel
39
39
 
40
- version = "4.3.12"
40
+ version = "4.3.14"
41
41
  __version__ = version
42
42
 
43
43
  class VSCodeWorkspaceShellTask:
@@ -291,8 +291,18 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
291
291
  sln_file = os.path.join(codeunit_folder, codeunit_name + ".sln")
292
292
  temp_output_folder = os.path.join(GeneralUtilities.get_temp_folder(), str(uuid.uuid4()))
293
293
  GeneralUtilities.ensure_directory_exists(temp_output_folder)
294
+ # Run the build from an absolute temporary working-directory (instead of the codeunit-folder) and with node-reuse
295
+ # disabled. Building a solution with "-o" (which is required here to keep the diagnostics-build isolated from the
296
+ # real build-output) is not officially supported by the .NET-SDK (warning NETSDK1194) and makes MSBuild create an
297
+ # additional "tmp/<guid>"-output-folder relative to the build-process' working-directory. With node-reuse enabled
298
+ # that folder is even created by a reused MSBuild-worker-node that still has a codeunit-subfolder as its working-
299
+ # directory, so it ends up inside the codeunit-folder. Such a folder is usually cleaned up by the SDK, but on a
300
+ # bind-mounted filesystem (for example when the build runs in a Linux-container with the repository mounted from a
301
+ # Windows-host) the cleanup can fail and the folder is left behind. By using an absolute working-directory and
302
+ # forcing fresh worker-nodes (which inherit that working-directory) any such relative "tmp/<guid>"-folder is created
303
+ # below temp_output_folder and removed together with it in the finally-block.
294
304
  try:
295
- run_result = self._protected_sc.run_program("dotnet", f"build \"{sln_file}\" -nologo -v minimal -o \"{temp_output_folder}\"", codeunit_folder, throw_exception_if_exitcode_is_not_zero=False, env_vars={"DOTNET_CLI_UI_LANGUAGE": "en-US"})
305
+ run_result = self._protected_sc.run_program("dotnet", f"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"})
296
306
  finally:
297
307
  GeneralUtilities.ensure_directory_does_not_exist(temp_output_folder)
298
308
  diagnostics: list[tuple[LogLevel, str, str | None, int | None]] = []
@@ -329,7 +339,7 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
329
339
  for (level, message, file, line) in diagnostics:
330
340
  location = f" ({file}:{line})" if file else ""
331
341
  self._protected_sc.log.log(f"{message}{location}", level)
332
- if level == LogLevel.Error:#should not occurr on scbuildcodeunits because then the build would have failed already.
342
+ if level == LogLevel.Error:#should not occurr on scbuildcodeunits because then the build would have failed already but you can also run this script manually.
333
343
  has_errors = True
334
344
  if has_errors:
335
345
  raise ValueError("Linting-issues occurred.")
@@ -552,7 +562,7 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
552
562
  self._protected_sc.log.log("Run testcases...")
553
563
  dotnet_build_configuration: str = self.get_target_environment_type()
554
564
  codeunit_name: str = self.get_codeunit_name()
555
-
565
+
556
566
  repository_folder: str = self.get_repository_folder().replace("\\", "/")
557
567
  coverage_file_folder = os.path.join(repository_folder, codeunit_name, "Other/Artifacts/TestCoverage")
558
568
  temp_folder = os.path.join(GeneralUtilities.get_temp_folder(), str(uuid.uuid4()))
@@ -563,16 +573,25 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
563
573
  target_file = os.path.join(coverage_file_folder, "TestCoverage.xml")
564
574
  GeneralUtilities.ensure_file_does_not_exist(target_file)
565
575
 
566
- args: list[str] = ["test", f"{codeunit_name}.sln", "-c", dotnet_build_configuration, "-o", temp_folder]
567
- if os.path.isfile(os.path.join(codeunit_folder, runsettings_file)):
568
- args += ["--settings", runsettings_file]
576
+ sln_file = os.path.join(codeunit_folder, f"{codeunit_name}.sln")
577
+ args: list[str] = ["test", sln_file, "-c", dotnet_build_configuration, "-o", temp_folder]
578
+ runsettings_path = os.path.join(codeunit_folder, runsettings_file)
579
+ if os.path.isfile(runsettings_path):
580
+ args += ["--settings", runsettings_path]
569
581
  # Write the test-results (test-binaries-deployment and coverage) into the system-temp-folder (a subfolder of
570
582
  # temp_folder) instead of a relative "./TestResults" inside the codeunit-folder. The relative path would otherwise
571
583
  # leave a folder behind in the codeunit-folder (visible e.g. when building inside the mounted Debian-build-container).
572
584
  # The whole temp_folder - including these results - is removed in the finally-block below.
573
585
  args += ["--results-directory", os.path.join(temp_folder, "TestResults")]
586
+ # Run dotnet-test from an absolute working-directory (a subfolder of temp_folder) with node-reuse disabled, for the
587
+ # same reason as in get_dotnet_build_diagnostics: building the solution with "-o" makes MSBuild create an additional
588
+ # relative "tmp/<guid>"-output-folder, which a reused worker-node would otherwise create inside the codeunit-folder
589
+ # where it can be left behind on a bind-mounted filesystem. All paths passed to dotnet-test are absolute, so the
590
+ # changed working-directory does not affect the test-result or the coverage-output.
591
+ test_working_directory = os.path.join(temp_folder, "WorkingDirectory")
592
+ GeneralUtilities.ensure_directory_exists(test_working_directory)
574
593
  try:
575
- program_output=self._protected_sc.run_program_argsasarray("dotnet", args, codeunit_folder, print_live_output=self.get_verbosity()==LogLevel.Debug, timeoutInSeconds=60*20)
594
+ program_output=self._protected_sc.run_program_argsasarray("dotnet", args, test_working_directory, print_live_output=self.get_verbosity()==LogLevel.Debug, timeoutInSeconds=60*20, env_vars={"MSBUILDDISABLENODEREUSE": "1"})
576
595
  output_lines=program_output[1].split("\n")
577
596
  output_lines=[line for line in output_lines if GeneralUtilities.string_has_content(line)]
578
597
  generated_coverage_file: str = output_lines[-1].strip()#the cobertura file is printed in the end of the output by the xplat collector
@@ -7,6 +7,7 @@ from .TFCPS_Tools_General import TFCPS_Tools_General
7
7
  from .TFCPS_CodeUnit_BuildCodeUnits import TFCPS_CodeUnit_BuildCodeUnits
8
8
  from .TFCPS_Generic import TFCPS_Generic_Functions
9
9
 
10
+ @GeneralUtilities.deprecated()
10
11
  class MergeToMainConfiguration:
11
12
  product_name: str = None
12
13
  merge_source_branch:str = None
@@ -30,6 +31,7 @@ class MergeToMainConfiguration:
30
31
  self.common_remote_name=common_remote_name
31
32
  self.build_repo=build_repo
32
33
 
34
+ @GeneralUtilities.deprecated()
33
35
  class TFCPS_MergeToMain:
34
36
 
35
37
  sc:ScriptCollectionCore = None
@@ -82,6 +84,7 @@ class TFCPS_MergeToMain:
82
84
  self.sc.git_push_with_retry(self.generic_prepare_new_release_arguments.repository_folder,self.generic_prepare_new_release_arguments.common_remote_name,target_branch,target_branch)
83
85
  self.sc.git_commit(self.generic_prepare_new_release_arguments.build_repo,"Updated submodule")
84
86
 
87
+ @GeneralUtilities.deprecated()
85
88
  class TFCPS_MergeToMain_CLI:
86
89
 
87
90
  @staticmethod
@@ -10,6 +10,7 @@ from .TFCPS_MergeToMain import TFCPS_MergeToMain
10
10
  from .TFCPS_CodeUnit_BuildCodeUnits import TFCPS_CodeUnit_BuildCodeUnits
11
11
 
12
12
 
13
+ @GeneralUtilities.deprecated()
13
14
  class MergeToStableConfiguration:
14
15
  log_level:LogLevel = None
15
16
  source_branch:str = None #main
@@ -40,6 +41,7 @@ class MergeToStableConfiguration:
40
41
  self.common_remote_url=common_remote_url
41
42
  self.additional_arguments_file=additional_arguments_file
42
43
 
44
+ @GeneralUtilities.deprecated()
43
45
  class TFCPS_MergeToStable:
44
46
 
45
47
  sc:ScriptCollectionCore = None
@@ -279,6 +281,7 @@ class TFCPS_MergeToStable:
279
281
  target_testcoveragereport = os.path.join(target_folder, "TestCoverageReport")
280
282
  shutil.copytree(source_testcoveragereport, target_testcoveragereport)
281
283
 
284
+ @GeneralUtilities.deprecated()
282
285
  class TFCPS_MergeToStable_CLI:
283
286
 
284
287
  @staticmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.3.12
3
+ Version: 4.3.14
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,15 +1,15 @@
1
- ScriptCollection/AnionBuildPlatform.py,sha256=T1tkh4pzQyUb8r5acWiv95TvmkNnDhiNaQAP2dJJvoA,12057
1
+ ScriptCollection/AnionBuildPlatform.py,sha256=GP-jnb1GbvT8jzlH-cqnxgOzBzeUdiaWnDXtKNjsxiA,12153
2
2
  ScriptCollection/CertificateUpdater.py,sha256=dR5JpJDlZdjD4_pgMz7zCrt1IM7VfatmK6pULSczxQw,9693
3
3
  ScriptCollection/Executables.py,sha256=DHutD8oaI2g71LV-rZ75gg1h4JywoRCKQDLobWPYS5A,66665
4
- ScriptCollection/GeneralUtilities.py,sha256=Qox4wQ2oWTahwXexC4qSUzXua5qr9PzRRrmOcJoM_IA,70500
4
+ ScriptCollection/GeneralUtilities.py,sha256=bz_DRyivll4Fdkao72nDVXb1x6aIz7c1AYdpNL1Lh1U,71345
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
8
8
  ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrRjAPIwT5Y,37
9
9
  ScriptCollection/ProgramRunnerPopen.py,sha256=zVD-gZY85o8wiGFcpYAGNDl-tXaKzipl1Bkhqy2ois4,4681
10
10
  ScriptCollection/ProgramRunnerSudo.py,sha256=RXsiceQ8W6a8YDk_2BPscVbIAmDIpIxqe9WHBy2r4CM,5233
11
- ScriptCollection/SCLog.py,sha256=Z-HhC_CRtU3HdQflNsabFh9IJOucHcXmxMDcf58fli0,4671
12
- ScriptCollection/ScriptCollectionCore.py,sha256=2e23eilk84kOK0aub3VqSjJGFE7oFBS8cIslvtJW5GM,230165
11
+ ScriptCollection/SCLog.py,sha256=LdzSJy3NnnwYCCefz2h4tiTy4BjT8lOz3IBG_bMOg9E,4821
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=yy2modKVSMxLQjgWJ4W3dsVul6_HuL2LoLTXQWEaLK0,230165
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
@@ -38,8 +38,8 @@ ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=s4E20EkvFZpsg2c2Gu
38
38
  ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=4wOl_GSzlNwTo0OtMzLut4joglz3Sr0FkBrc5TlaAy0,28532
39
39
  ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=X2NgZgbOkJsdZ6wMHB_RuS_rQCuz5oQCqzYrxyXBN9Q,6680
40
40
  ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=5vCFfDiU8bvfcnoKNs2ATS8nsl6mYXcIuX7XfYE0tvg,2116
41
- ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=BsSV4a-NZY86MZ20d-_rYxNVAI4UzAfmEwXlRZ8qWQc,7685
42
- ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=QRm8n1qH8H_XbJhGCbzwdNr9KSEy0WkbG7ulpc4Md3U,22696
41
+ ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=zp7n0Li7GTi4tERDMgDcJ-o3m6131m31zvkat0lALEc,7781
42
+ ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=jQ0B3yq45we-8a0KuNFMfXCk9MfzPpTv2QgDWMN34x4,22792
43
43
  ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=JYiDqDsfVJQWS9xWMi_UzfXnXsJRnPRxAzFr82bUEvI,2370
44
44
  ScriptCollection/TFCPS/TFCPS_RemoteBuild.py,sha256=Z8Gw-j5I7VPafHEsVeQJ2gTTKVLAnnhwZhY8IVTi2Qk,11867
45
45
  ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=HtIpLK9AaIzvLB_nOC8vPKosuwgi_7XV0xoZxut9AFs,126278
@@ -49,7 +49,7 @@ ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
49
49
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationBase.py,sha256=bT6Gd5pQpZCw4OQz6HWkPCSn5z__eUUEisABLDSxd0o,200
50
50
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py,sha256=QyjOfMY22JWCvKjMelHiDWbJiWqotOfebpJpgDUaoO4,237
51
51
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py,sha256=i0zEGehj0sttxjjZtoq2KFSKp_ulxVyWp_ZgAhIY_So,241
52
- ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=7grKSK9qtYbpyvk3y7RsygBjmKQw1JlANSwk6GGmbBU,41731
52
+ ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=UInAjTB5W9nXBccHBaPGTkjWBy8saMfQ7bfiYlgBtYc,43893
53
53
  ScriptCollection/TFCPS/DotNet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=d8U-sIhsneMplYkG73BJRQQZh4uLoX7QiOhbnZNuOM8,8540
55
55
  ScriptCollection/TFCPS/Flutter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -63,8 +63,8 @@ ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py,sha256=Bd1gxCk9Fb
63
63
  ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
64
  ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=WhOsMpJxNGqnQGA3nJ99ruyqymxBeJxCcpK98zJduTo,1680
65
65
  ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
- scriptcollection-4.3.12.dist-info/METADATA,sha256=8MlKafLMkghWUJxyj8-Z5b1NSOdPcqJvFuPjA3zDu68,7816
67
- scriptcollection-4.3.12.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
68
- scriptcollection-4.3.12.dist-info/entry_points.txt,sha256=MwiP9P29EeSfjS19JOZmqbx8OzpZrUWpgMza3EffBs8,5812
69
- scriptcollection-4.3.12.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
70
- scriptcollection-4.3.12.dist-info/RECORD,,
66
+ scriptcollection-4.3.14.dist-info/METADATA,sha256=E2dsUenqfEnS20Uqq_-yTZ_4BLl-ASMQ82QHhGMW9ts,7816
67
+ scriptcollection-4.3.14.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
68
+ scriptcollection-4.3.14.dist-info/entry_points.txt,sha256=MwiP9P29EeSfjS19JOZmqbx8OzpZrUWpgMza3EffBs8,5812
69
+ scriptcollection-4.3.14.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
70
+ scriptcollection-4.3.14.dist-info/RECORD,,