ScriptCollection 4.2.94__py3-none-any.whl → 4.2.96__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.
@@ -908,6 +908,21 @@ def AddImageToCustomRegistry()->int:
908
908
  sc.add_image_to_custom_docker_image_registry(args.remotehub,args.imagenameonremotehub,args.ownregistryaddress,args.imagenameonownregistry,args.tag,args.username,args.password)
909
909
  return 0
910
910
 
911
+ def ShowVersion() -> int:
912
+ GeneralUtilities.write_message_to_stdout(ScriptCollectionCore.get_scriptcollection_version())
913
+ return 0
914
+
915
+
916
+ def ShowProjectVersion() -> int:
917
+ parser = argparse.ArgumentParser(description="Prints the semver-version of a project as calculated by gitversion.")
918
+ parser.add_argument('-r', '--repository', required=False, default=None, help="Path to the repository. Defaults to the current working directory.")
919
+ args = parser.parse_args()
920
+ repository = GeneralUtilities.resolve_relative_path(args.repository, os.getcwd()) if args.repository is not None else os.getcwd()
921
+ sc: ScriptCollectionCore = ScriptCollectionCore()
922
+ GeneralUtilities.write_message_to_stdout(sc.get_semver_version_from_gitversion(repository))
923
+ return 0
924
+
925
+
911
926
  def SyncXlfFiles()->int:
912
927
  parser = argparse.ArgumentParser(description="This function syncs the content of xlf-files in a folder. This is useful to keep the content of xlf-files in sync which are used for translations in software projects.")
913
928
  parser.add_argument('-p', '--prefix', required=True, help="File prefix. Example: 'message' when the files are named 'message.xlf', 'message.fr.xlf', etc.")
@@ -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.2.94"
42
+ version = "4.2.96"
43
43
  __version__ = version
44
44
 
45
45
  class VSCodeWorkspaceShellTask:
@@ -3481,3 +3481,8 @@ OCR-content:
3481
3481
  def is_runnning_in_container(self) ->bool:
3482
3482
  """this function is based on a convention and does not do a real check."""
3483
3483
  return os.environ.get("ISRUNNINGINCONTAINER") == "true"
3484
+
3485
+ @GeneralUtilities.check_arguments
3486
+ def is_running_in_build_container(self) ->bool:
3487
+ """this function is based on a convention and does not do a real check."""
3488
+ return os.environ.get("ISRUNNINGINBUILDCONTAINER") == "true"
@@ -24,7 +24,7 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
24
24
 
25
25
  @GeneralUtilities.check_arguments
26
26
  def build(self,runtimes:list[str],generate_open_api_spec:bool) -> None:
27
- self.__add_custom_nuget_sources()
27
+ self.__reset_nuget_sources()
28
28
  if self.is_library:
29
29
  self.standardized_tasks_build_for_dotnet_library_project(runtimes)
30
30
  GeneralUtilities.assert_condition(not generate_open_api_spec,"OpenAPI-Specification can not be generated for a library.")
@@ -34,58 +34,71 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
34
34
  self.generate_openapi_file(runtimes[0])
35
35
 
36
36
  @GeneralUtilities.check_arguments
37
- def __add_custom_nuget_sources(self) -> None:
38
- sources:list[tuple[str,str,str,str]] = []
39
-
40
- csv_file = os.path.join(self._protected_sc.get_scriptcollection_configuration_folder(), "TFCPS", "CustomC#Dependencies.csv")
41
- if os.path.isfile(csv_file):
42
- self._protected_sc.log.log(f"Add custom NuGet-sources from '{csv_file}'...",LogLevel.Debug)
43
- with open(csv_file, encoding="utf-8-sig", newline="") as f:
44
- reader = csv.DictReader(f)
45
- for row in reader:
46
- name = (row.get("Name") or "").strip()
47
- url = (row.get("Url") or "").strip()
48
- username = (row.get("Username") or "").strip()
49
- password = (row.get("Password") or "").strip()
50
- if not name or not url:
51
- continue
52
- sources.append((name, url, username, password))
53
-
54
- if len(os.environ.items()) > 0:
55
- self._protected_sc.log.log(f"Add custom NuGet-sources from environment variables...",LogLevel.Debug)
56
- env_name_pattern = re.compile(r"^Dependency_CSharp_(.+?)_Name$")
57
- for env_var_name, env_var_value in os.environ.items():
58
- m = env_name_pattern.match(env_var_name)
59
- if not m:
60
- continue
61
- dependency_name = m.group(1)
62
- name = (env_var_value or "").strip()
63
- url = (os.environ.get(f"Dependency_CSharp_{dependency_name}_URL") or "").strip()
64
- username = (os.environ.get(f"Dependency_CSharp_{dependency_name}_Username") or "").strip()
65
- password = (os.environ.get(f"Dependency_CSharp_{dependency_name}_Passwort") or "").strip()
66
- if not name or not url:
67
- continue
68
- sources.append((name, url, username, password))
69
-
70
- for name, url, username, password in sources:
71
- #TODO add only the sources which are needed by the project
72
- self._protected_sc.log.log(f"Add NuGet-source '{name}' with url '{url}'",LogLevel.Debug)
73
- args = ["nuget", "add", "source", url, "--name", name]
74
- if username:
75
- args += ["--username", username]
76
- if password:
77
- args += ["--password", password, "--store-password-in-clear-text"]
78
- args_for_log = list(args)
79
- if password:
80
- args_for_log[args_for_log.index(password)] = "***"
81
- self._protected_sc.run_program_argsasarray("dotnet", args, arguments_for_log=args_for_log, throw_exception_if_exitcode_is_not_zero=False, print_live_output=self.get_verbosity()==LogLevel.Debug)
82
-
83
- #self._protected_sc.run_program_argsasarray("dotnet", ["nuget", "add", "source", "https://api.nuget.org/v3/index.json", "--name", "nuget.org"], print_live_output=True)
84
-
85
- if self._protected_sc.log.loglevel==LogLevel.Debug:
86
- self._protected_sc.run_program_argsasarray("dotnet", ["nuget","list","source","--format","detailed"], print_live_output=True)
87
- else:
88
- self._protected_sc.run_program_argsasarray("dotnet", ["nuget","list","source"], print_live_output=True)
37
+ def __reset_nuget_sources(self) -> None:
38
+ if self._protected_sc.is_running_in_build_container():
39
+
40
+ self._protected_sc.log.log("Remove all existing NuGet-sources...", LogLevel.Debug)
41
+ list_result = self._protected_sc.run_program_argsasarray("dotnet", ["nuget", "list", "source"], throw_exception_if_exitcode_is_not_zero=False)
42
+ existing_source_name_pattern = re.compile(r"^\s*\d+\.\s+(.+?)\s+\[(?:Enabled|Disabled)\]\s*$")
43
+ for line in list_result[1].splitlines():
44
+ m = existing_source_name_pattern.match(line)
45
+ if not m:
46
+ continue
47
+ existing_source_name = m.group(1).strip()
48
+ self._protected_sc.log.log(f"Remove existing NuGet-source '{existing_source_name}'", LogLevel.Debug)
49
+ self._protected_sc.run_program_argsasarray("dotnet", ["nuget", "remove", "source", existing_source_name], throw_exception_if_exitcode_is_not_zero=False)
50
+
51
+ sources:list[tuple[str,str,str,str]] = []
52
+
53
+ csv_file = os.path.join(self._protected_sc.get_scriptcollection_configuration_folder(), "TFCPS", "CustomC#Dependencies.csv")
54
+ if os.path.isfile(csv_file):
55
+ self._protected_sc.log.log(f"Add custom NuGet-sources from '{csv_file}'...",LogLevel.Debug)
56
+ with open(csv_file, encoding="utf-8-sig", newline="") as f:
57
+ reader = csv.DictReader(f)
58
+ for row in reader:
59
+ name = (row.get("Name") or "").strip()
60
+ url = (row.get("Url") or "").strip()
61
+ username = (row.get("Username") or "").strip()
62
+ password = (row.get("Password") or "").strip()
63
+ if not name or not url:
64
+ continue
65
+ sources.append((name, url, username, password))
66
+
67
+ if len(os.environ.items()) > 0:
68
+ self._protected_sc.log.log(f"Add custom NuGet-sources from environment variables...",LogLevel.Debug)
69
+ env_name_pattern = re.compile(r"^Dependency_CSharp_(.+?)_Name$")
70
+ for env_var_name, env_var_value in os.environ.items():
71
+ m = env_name_pattern.match(env_var_name)
72
+ if not m:
73
+ continue
74
+ dependency_name = m.group(1)
75
+ name = (env_var_value or "").strip()
76
+ url = (os.environ.get(f"Dependency_CSharp_{dependency_name}_URL") or "").strip()
77
+ username = (os.environ.get(f"Dependency_CSharp_{dependency_name}_Username") or "").strip()
78
+ password = (os.environ.get(f"Dependency_CSharp_{dependency_name}_Passwort") or "").strip()
79
+ if not name or not url:
80
+ continue
81
+ sources.append((name, url, username, password))
82
+
83
+ self._protected_sc.run_program_argsasarray("dotnet", ["nuget", "add", "source", "https://api.nuget.org/v3/index.json", "--name", "nuget.org"], print_live_output=True)
84
+ for name, url, username, password in sources:
85
+ #TODO add only the sources which are needed by the project
86
+ self._protected_sc.log.log(f"Add NuGet-source '{name}' with url '{url}'",LogLevel.Debug)
87
+ args = ["nuget", "add", "source", url, "--name", name]
88
+ if username:
89
+ args += ["--username", username]
90
+ if password:
91
+ args += ["--password", password, "--store-password-in-clear-text"]
92
+ args_for_log = list(args)
93
+ if password:
94
+ args_for_log[args_for_log.index(password)] = "***"
95
+ self._protected_sc.run_program_argsasarray("dotnet", args, arguments_for_log=args_for_log, throw_exception_if_exitcode_is_not_zero=False, print_live_output=self.get_verbosity()==LogLevel.Debug)
96
+
97
+
98
+ if self._protected_sc.log.loglevel==LogLevel.Debug:
99
+ self._protected_sc.run_program_argsasarray("dotnet", ["nuget","list","source","--format","detailed"], print_live_output=True)
100
+ else:
101
+ self._protected_sc.run_program_argsasarray("dotnet", ["nuget","list","source"], print_live_output=True)
89
102
 
90
103
  @GeneralUtilities.check_arguments
91
104
  def generate_openapi_file(self, runtime: str) -> None:
@@ -148,7 +161,10 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
148
161
  GeneralUtilities.ensure_directory_does_not_exist(outputfolder)
149
162
  self._protected_sc.run_program("dotnet", "clean", csproj_file_folder)
150
163
  GeneralUtilities.ensure_directory_exists(outputfolder)
151
- self._protected_sc.run_program("dotnet", "restore", codeunit_folder,print_live_output=self.get_verbosity()==LogLevel.Debug)
164
+ restore_args = ["restore"]
165
+ if os.path.isfile(os.path.join(codeunit_folder, "NuGet.config")):
166
+ restore_args += ["--configfile", "NuGet.config"]
167
+ self._protected_sc.run_program_argsasarray("dotnet", restore_args, codeunit_folder,print_live_output=self.get_verbosity()==LogLevel.Debug)
152
168
  self._protected_sc.run_program_argsasarray("dotnet", ["build", csproj_file_name, "-c", dotnet_build_configuration, "-o", outputfolder, "--runtime", runtime], csproj_file_folder,print_live_output=self.get_verbosity()==LogLevel.Debug)
153
169
  if copy_license_file_to_target_folder:
154
170
  license_file = os.path.join(repository_folder, "License.txt")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.2.94
3
+ Version: 4.2.96
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
@@ -6,7 +6,7 @@ Other/QualityCheck/RunTestcases.py,sha256=3vJBquOr9q1DhF4648FhY_sXS-DV_l193mE_O9
6
6
  Other/Reference/GenerateReference.py,sha256=MFzu7U1OHxgecYDi7WSulO8XRGBsgkdqV_r_jkyVF7c,369
7
7
  ScriptCollection/AnionBuildPlatform.py,sha256=UcE3uy_Vm9__QVTlP6V4Y7BrhQPQG6hGYrmQ-6rXSPA,11775
8
8
  ScriptCollection/CertificateUpdater.py,sha256=dR5JpJDlZdjD4_pgMz7zCrt1IM7VfatmK6pULSczxQw,9693
9
- ScriptCollection/Executables.py,sha256=5xa9IJ_jsUCQ2qhoSuEghAQwp3F2PTJ7QW5zJwZbEZ8,44815
9
+ ScriptCollection/Executables.py,sha256=A4Nsp6ODs1YIBnx4w-1K8C2YHH9Im4i4yCgDXoXp1OE,45588
10
10
  ScriptCollection/GeneralUtilities.py,sha256=4BmzJhTPAZmKQd5YlMuX0E5Dl6fhuVkmVaCpST0WzRk,67654
11
11
  ScriptCollection/HTTPMaintenanceOverheadHelper.py,sha256=TToNtyO1XzsMbBsTBf3o0xgOK0v4Jf03qw2Z0xb2nCk,2007
12
12
  ScriptCollection/ProcessesRunner.py,sha256=o5raxIt3lknNPoPrjNzJ2bprRPJ3SnL0rrR7crraD7E,1523
@@ -15,7 +15,7 @@ ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrR
15
15
  ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
16
16
  ScriptCollection/ProgramRunnerSudo.py,sha256=_khC3xuTdrPoLluBJZWfldltmmuKltABJPcbjZSFW-4,4835
17
17
  ScriptCollection/SCLog.py,sha256=8TRy1LeYMsPOIuWUcnUNNbO5pd-cNBS-3cn-kdzP8FU,4768
18
- ScriptCollection/ScriptCollectionCore.py,sha256=fMsUW7y2seVg1mZ1n5CcwYupx7ICbZcIFXgiFL4JOFM,188349
18
+ ScriptCollection/ScriptCollectionCore.py,sha256=WnoVb4sTIvmmROrJBPVY6HLO01PORdJTTyUcqetl688,188596
19
19
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  ScriptCollection/OCIImages/AbstractImageHandler.py,sha256=o129UYDtLymCRjMZBP9Puaj19ueMHoNt6UTLspfnaRc,1758
21
21
  ScriptCollection/OCIImages/OCIImageManager.py,sha256=2muW4hJ_a7EfavY3WVnafqZ0HC87RcZsoTuNvA3c0To,11175
@@ -45,7 +45,7 @@ ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
45
45
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationBase.py,sha256=bT6Gd5pQpZCw4OQz6HWkPCSn5z__eUUEisABLDSxd0o,200
46
46
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py,sha256=QyjOfMY22JWCvKjMelHiDWbJiWqotOfebpJpgDUaoO4,237
47
47
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py,sha256=i0zEGehj0sttxjjZtoq2KFSKp_ulxVyWp_ZgAhIY_So,241
48
- ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=RoeZgdoRMgCgefc6bUSoqxQ4DAzA55U9kxMMoiOu4Vg,39118
48
+ ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=5uweMGiXLyr8hGzA4SUZD7OybZfhP8f8jAT1hh9x81Q,40459
49
49
  ScriptCollection/TFCPS/DotNet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
50
  ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=KAjyFyEjpkghsVPskfsHD68k4Z92gRCT_q6BXfikRwE,7660
51
51
  ScriptCollection/TFCPS/Flutter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -291,8 +291,8 @@ build/lib/build/lib/build/lib/build/lib/ScriptCollection/TFCPS/Python/TFCPS_Code
291
291
  build/lib/build/lib/build/lib/build/lib/ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
292
292
  build/lib/build/lib/build/lib/build/lib/ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=WhOsMpJxNGqnQGA3nJ99ruyqymxBeJxCcpK98zJduTo,1680
293
293
  build/lib/build/lib/build/lib/build/lib/ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
294
- scriptcollection-4.2.94.dist-info/METADATA,sha256=uNWUFbgcWcHE61Pr409pkIeGqAWw5iXhdsBXp004rgc,7696
295
- scriptcollection-4.2.94.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
296
- scriptcollection-4.2.94.dist-info/entry_points.txt,sha256=27XwAJEcaMEc1be0Ec1vKHCbiU4Ziu8jKL-SqsrYOIQ,4680
297
- scriptcollection-4.2.94.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
298
- scriptcollection-4.2.94.dist-info/RECORD,,
294
+ scriptcollection-4.2.96.dist-info/METADATA,sha256=fS3AxQIpWOR0INSTFz-FH_-oB7puYX-KNJTJcVL_R_Q,7696
295
+ scriptcollection-4.2.96.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
296
+ scriptcollection-4.2.96.dist-info/entry_points.txt,sha256=ORHAH5j1XQaNqsrloSe9PNEf-vFfLiOjFZBf5Q-02Cs,4808
297
+ scriptcollection-4.2.96.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
298
+ scriptcollection-4.2.96.dist-info/RECORD,,
@@ -58,6 +58,8 @@ scsearchinfiles = ScriptCollection.Executables:SearchInFiles
58
58
  scsetcontentoffile = ScriptCollection.Executables:SetContentOfFile
59
59
  scshow2faasqrcode = ScriptCollection.Executables:Show2FAAsQRCode
60
60
  scshowmissingfiles = ScriptCollection.Executables:ShowMissingFiles
61
+ scshowprojectversion = ScriptCollection.Executables:ShowProjectVersion
62
+ scshowversion = ScriptCollection.Executables:ShowVersion
61
63
  scsigncertificate = ScriptCollection.Executables:SignCertificate
62
64
  scsyncxlffiles = ScriptCollection.Executables:SyncXlfFiles
63
65
  scupdatedependencies = ScriptCollection.Executables:UpdateDependencies