ScriptCollection 4.0.49__py3-none-any.whl → 4.0.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.
@@ -37,7 +37,7 @@ from .ProgramRunnerPopen import ProgramRunnerPopen
37
37
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
38
38
  from .SCLog import SCLog, LogLevel
39
39
 
40
- version = "4.0.49"
40
+ version = "4.0.51"
41
41
  __version__ = version
42
42
 
43
43
 
@@ -1833,10 +1833,10 @@ class ScriptCollectionCore:
1833
1833
  pid: int
1834
1834
 
1835
1835
  @GeneralUtilities.check_arguments
1836
- def run_with_epew(self, program: str, argument: str = "", working_directory: str = None, print_errors_as_information: bool = False, log_file: str = None, timeoutInSeconds: int = 600, addLogOverhead: bool = False, title: str = None, log_namespace: str = "", arguments_for_log: list[str] = None, throw_exception_if_exitcode_is_not_zero: bool = True, custom_argument: object = None, interactive: bool = False) -> tuple[int, str, str, int]:
1836
+ def run_with_epew(self, program: str, argument: str = "", working_directory: str = None, print_errors_as_information: bool = False, log_file: str = None, timeoutInSeconds: int = 600, addLogOverhead: bool = False, title: str = None, log_namespace: str = "", arguments_for_log: list[str] = None, throw_exception_if_exitcode_is_not_zero: bool = True, custom_argument: object = None, interactive: bool = False,print_live_output:bool=False) -> tuple[int, str, str, int]:
1837
1837
  sc: ScriptCollectionCore = ScriptCollectionCore()
1838
1838
  sc.program_runner = ProgramRunnerEpew()
1839
- return sc.run_program(program, argument, working_directory, print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, arguments_for_log, throw_exception_if_exitcode_is_not_zero, custom_argument, interactive)
1839
+ return sc.run_program(program, argument, working_directory, print_errors_as_information, log_file, timeoutInSeconds, addLogOverhead, title, log_namespace, arguments_for_log, throw_exception_if_exitcode_is_not_zero, custom_argument, interactive,print_live_output=print_live_output)
1840
1840
 
1841
1841
 
1842
1842
  # </run programs>
@@ -14,13 +14,13 @@ class TFCPS_CodeUnitSpecific_NodeJS_Functions(TFCPS_CodeUnitSpecific_Base):
14
14
 
15
15
  @GeneralUtilities.check_arguments
16
16
  def build(self) -> None:
17
- self._protected_sc.run_with_epew("npm", "run build", self.get_codeunit_folder())
17
+ self._protected_sc.run_with_epew("npm", "run build", self.get_codeunit_folder(),print_live_output=self._protected_sc.log.loglevel==LogLevel.Diagnostic)
18
18
  self.standardized_tasks_build_bom_for_node_project()
19
19
  self.copy_source_files_to_output_directory()
20
20
 
21
21
  @GeneralUtilities.check_arguments
22
22
  def linting(self) -> None:
23
- self._protected_sc.run_with_epew("npm", "run lint", self.get_codeunit_folder())
23
+ self._protected_sc.run_with_epew("npm", "run lint", self.get_codeunit_folder(),print_live_output=self._protected_sc.log.loglevel==LogLevel.Diagnostic)
24
24
 
25
25
  @GeneralUtilities.check_arguments
26
26
  def do_common_tasks(self,current_codeunit_version:str)-> None:
@@ -50,7 +50,7 @@ class TFCPS_CodeUnitSpecific_NodeJS_Functions(TFCPS_CodeUnitSpecific_Base):
50
50
  repository_folder = os.path.dirname(codeunit_folder)
51
51
 
52
52
  # run testcases
53
- self._protected_sc.run_with_epew("npm", f"run test-{self.get_target_environment_type()}", self.get_codeunit_folder())
53
+ self._protected_sc.run_with_epew("npm", f"run test-{self.get_target_environment_type()}", self.get_codeunit_folder(),print_live_output=self._protected_sc.log.loglevel==LogLevel.Diagnostic)
54
54
 
55
55
  # rename file
56
56
  coverage_folder = os.path.join(codeunit_folder, "Other", "Artifacts", "TestCoverage")
@@ -107,9 +107,9 @@ class TFCPS_CodeUnitSpecific_NodeJS_Functions(TFCPS_CodeUnitSpecific_Base):
107
107
 
108
108
 
109
109
  @GeneralUtilities.check_arguments
110
- def standardized_tasks_build_bom_for_node_project(self) -> None:
110
+ def standardized_tasks_build_bom_for_node_project(self) -> None:
111
111
  relative_path_to_bom_file = f"Other/Artifacts/BOM/{os.path.basename(self.get_codeunit_folder())}.{self.tfcps_Tools_General.get_version_of_codeunit(self.get_codeunit_file())}.sbom.xml"
112
- self._protected_sc.run_with_epew("cyclonedx-npm", f"--output-format xml --output-file {relative_path_to_bom_file}", self.get_codeunit_folder())
112
+ self._protected_sc.run_with_epew("cyclonedx-npm", f"--output-format xml --output-file {relative_path_to_bom_file}", self.get_codeunit_folder(),print_live_output=self._protected_sc.log.loglevel==LogLevel.Diagnostic)
113
113
  self._protected_sc.format_xml_file(self.get_codeunit_folder()+"/"+relative_path_to_bom_file)
114
114
 
115
115
  class TFCPS_CodeUnitSpecific_NodeJS_CLI:
@@ -180,13 +180,6 @@ class TFCPS_CodeUnitSpecific_Base(ABC):
180
180
  # set default constants
181
181
  self.tfcps_Tools_General.set_default_constants(os.path.join(codeunit_folder))
182
182
 
183
- # Copy changelog-file
184
- changelog_folder = os.path.join(repository_folder, "Other", "Resources", "Changelog")
185
- changelog_file = os.path.join(changelog_folder, f"v{project_version}.md")
186
- target_folder = os.path.join(codeunit_folder, "Other", "Artifacts", "Changelog")
187
- GeneralUtilities.ensure_directory_exists(target_folder)
188
- shutil.copy(changelog_file, target_folder)
189
-
190
183
  # Hints-file
191
184
  hints_file = os.path.join(codeunit_folder, "Other", "Reference", "ReferenceContent", "Hints.md")
192
185
  if not os.path.isfile(hints_file):
@@ -86,14 +86,14 @@ class TFCPS_CodeUnit_BuildCodeUnits:
86
86
  tFCPS_CodeUnit_BuildCodeUnit.build_codeunit()
87
87
 
88
88
  #TODO run static code analysis tool to search for vulnerabilities
89
- self.__search_for_secrets()
89
+ #TODO self.__search_for_secrets()
90
90
  self.__save_lines_of_code(self.repository,self.tFCPS_Other.get_version_of_project(self.repository))
91
91
 
92
92
  self.sc.log.log(GeneralUtilities.get_line())
93
93
  self.sc.log.log("Finished building codeunits.")
94
94
  self.sc.log.log(GeneralUtilities.get_line())
95
95
 
96
- def __search_for_secrets(self):
96
+ def __search_for_secrets(self):#pylint:disable=unused-private-member
97
97
  exe_paths=self.tFCPS_Other.ensure_trufflehog_is_available()
98
98
  exe_path:str=None
99
99
  if GeneralUtilities.current_system_is_windows():
@@ -1211,3 +1211,55 @@ class TFCPS_Tools_General:
1211
1211
  GeneralUtilities.ensure_directory_does_not_exist(trg_folder)
1212
1212
  GeneralUtilities.ensure_directory_exists(trg_folder)
1213
1213
  GeneralUtilities.copy_content_of_folder(src_folder, trg_folder)
1214
+
1215
+ @GeneralUtilities.check_arguments
1216
+ def start_dockerfile_example(self, current_file: str,remove_old_container: bool, remove_volumes_folder: bool, env_file: str) -> None:
1217
+ folder = os.path.dirname(current_file)
1218
+ example_name = os.path.basename(folder)
1219
+ oci_image_artifacts_folder = GeneralUtilities.resolve_relative_path("../../../../Artifacts/BuildResult_OCIImage", folder)
1220
+ image_filename = os.path.basename(self.__sc.find_file_by_extension(oci_image_artifacts_folder, "tar"))
1221
+ codeunit_name = os.path.basename(GeneralUtilities.resolve_relative_path("../../../../..", folder))
1222
+ if remove_old_container:
1223
+ docker_compose_file = f"{folder}/docker-compose.yml"
1224
+ container_names = []
1225
+ lines = GeneralUtilities.read_lines_from_file(docker_compose_file)
1226
+ for line in lines:
1227
+ if match := re.search("container_name:\\s*'?([^']+)'?", line):
1228
+ container_names.append(match.group(1))
1229
+ self.__sc.log.log(f"Ensure container of {docker_compose_file} do not exist...")
1230
+ for container_name in container_names:
1231
+ self.__sc.log.log(f"Ensure container {container_name} does not exist...")
1232
+ self.__sc.run_program("docker", f"container rm -f {container_name}", oci_image_artifacts_folder, throw_exception_if_exitcode_is_not_zero=False)
1233
+ if remove_volumes_folder:
1234
+ volumes_folder = os.path.join(folder, "Volumes")
1235
+ self.__sc.log.log(f"Ensure volumes-folder '{volumes_folder}' does not exist...")
1236
+ GeneralUtilities.ensure_directory_does_not_exist(volumes_folder)
1237
+ GeneralUtilities.ensure_directory_exists(volumes_folder)
1238
+ self.__sc.log.log("Load docker-image...")
1239
+ self.__sc.run_program("docker", f"load -i {image_filename}", oci_image_artifacts_folder)
1240
+ docker_project_name = f"{codeunit_name}_{example_name}".lower()
1241
+ self.__sc.log.log("Start docker-container...")
1242
+ argument = f"compose --project-name {docker_project_name}"
1243
+ if env_file is not None:
1244
+ argument = f"{argument} --env-file {env_file}"
1245
+ argument = f"{argument} up --detach"
1246
+ self.__sc.run_program("docker", argument, folder)
1247
+
1248
+ @GeneralUtilities.check_arguments
1249
+ def ensure_env_file_is_generated(self, current_file: str, env_file_name: str, env_values: dict[str, str]):
1250
+ folder = os.path.dirname(current_file)
1251
+ env_file = os.path.join(folder, env_file_name)
1252
+ if not os.path.isfile(env_file):
1253
+ lines = []
1254
+ for key, value in env_values.items():
1255
+ lines.append(f"{key}={value}")
1256
+ GeneralUtilities.write_lines_to_file(env_file, lines)
1257
+
1258
+ @GeneralUtilities.check_arguments
1259
+ def stop_dockerfile_example(self, current_file: str, remove_old_container: bool, remove_volumes_folder: bool) -> None:
1260
+ folder = os.path.dirname(current_file)
1261
+ example_name = os.path.basename(folder)
1262
+ codeunit_name = os.path.basename(GeneralUtilities.resolve_relative_path("../../../../..", folder))
1263
+ docker_project_name = f"{codeunit_name}_{example_name}".lower()
1264
+ self.__sc.log.log("Stop docker-container...")
1265
+ self.__sc.run_program("docker", f"compose --project-name {docker_project_name} down", folder)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ScriptCollection
3
- Version: 4.0.49
3
+ Version: 4.0.51
4
4
  Summary: The ScriptCollection is the place for reusable scripts.
5
5
  Home-page: https://github.com/anionDev/ScriptCollection
6
6
  Author: Marius Göcke
@@ -9,18 +9,18 @@ ScriptCollection/ProgramRunnerEpew.py,sha256=TJdDx9zIMSiCaXh8X-ekrMlbXfGtmd0Mmyx
9
9
  ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrRjAPIwT5Y,37
10
10
  ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
11
11
  ScriptCollection/SCLog.py,sha256=dxGOI4E9lG5v9jk_LajXCkM5nghliCDV8YB8Ihn160s,4541
12
- ScriptCollection/ScriptCollectionCore.py,sha256=myrHEN83GP6Is8_b-TN0tQfOXYKLkv7DNfEEfvA5ET0,142113
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=n-QprUwKp_hE2W9jPHzktCEDurVVcvkH4Sz8EIcyV0M,142178
13
13
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=2Ng-GyKWQ6FfTUmogd7g-xF6_XeTMxvkeJddagxFR5o,25853
14
+ ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=H9ampfCfJ4-ohN33VkYWTKwYaTV-y3AelZAiTduwHzw,25442
15
15
  ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=4rYKgTAga11NiDx8YUqz3K_Q4eX_n3kC6lvNdXEa24s,7389
16
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=EH5yV33emYfbYqdikrPgW9UdF7UYV6rpBS1JGHNxA6M,7483
16
+ ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=f9oGnopuzn3iDHC1AksU7Qr60LbDe0eLjYeXGiDPhAk,7526
17
17
  ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=bcJlfI062Eoq7MOIhun-_iNG7SdO1ZIuC_cylaoLI1s,6332
18
18
  ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=O-0guM_LJCcZmPZJhMgTvXD2RXUJEBWWv6Bt6hDFhvM,1943
19
19
  ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=41g219jaBRZ2VQCrWM4-Trvervrt8b5oATPwIIGNpag,7244
20
20
  ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=ifB1K6A903vvfH0LvtiFbZgYSgR94thfEI-jjf40LpU,21653
21
21
  ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=CxdwUklhZVuJGp0vcokoH_KMXFzmlUlZwj77xFYijho,2242
22
22
  ScriptCollection/TFCPS/TFCPS_Tools_Dependencies.py,sha256=o7HI3ki3WWqlAiUsrh3Lky_w6UhYh9hdjYPGOhubQGA,414
23
- ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=R4LxdLLl1lVEr2aWsxi92FylpiS6CZKMPChi0Ty2XH4,76571
23
+ ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=nIOEeZ3UWzzD5S7RkMnJedDV8oHlPMaCc_2qPH1YxBY,79912
24
24
  ScriptCollection/TFCPS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py,sha256=ylPvcdiN7RuqXpM-3uNqs40v1kyhaC0guV4JA2pIt_M,5234
26
26
  ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -31,12 +31,12 @@ ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=ufeWuqtNOP
31
31
  ScriptCollection/TFCPS/DotNet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=TIR95f6TVOnW25ieX9q4RUi1FogbYEfrlZOcZ1aE014,6969
33
33
  ScriptCollection/TFCPS/Flutter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
- ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py,sha256=dnuDlQXThFmhe6EbUAWmGhx7AAYGL0lVUqsrhOgtmC8,6255
34
+ ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py,sha256=e2bvR_zzArIJcjDLixMOI7ItUQTNuK1zPb4v4sknihg,6531
35
35
  ScriptCollection/TFCPS/NodeJS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py,sha256=q7msAxCb5VIZ-xhFg1MfzUvWomQRKYldqmW42KFhyMU,6868
37
37
  ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
- scriptcollection-4.0.49.dist-info/METADATA,sha256=hOgBoSuHOVM_45XUcdWZTIBpgqym-h8eiOjVkoSwp2U,7688
39
- scriptcollection-4.0.49.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
- scriptcollection-4.0.49.dist-info/entry_points.txt,sha256=_izhaQEyHiyBIfM2zTYDaJ7qvgsP1WntkVChFnkWymE,4431
41
- scriptcollection-4.0.49.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
42
- scriptcollection-4.0.49.dist-info/RECORD,,
38
+ scriptcollection-4.0.51.dist-info/METADATA,sha256=IAPmwcVuxRDd8BqNGVtKq5bZyU9gwBJzD4N1k6jiby8,7688
39
+ scriptcollection-4.0.51.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
+ scriptcollection-4.0.51.dist-info/entry_points.txt,sha256=_izhaQEyHiyBIfM2zTYDaJ7qvgsP1WntkVChFnkWymE,4431
41
+ scriptcollection-4.0.51.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
42
+ scriptcollection-4.0.51.dist-info/RECORD,,