ScriptCollection 4.0.11__py3-none-any.whl → 4.0.13__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.
- ScriptCollection/AnionBuildPlatform.py +2 -0
- ScriptCollection/ScriptCollectionCore.py +1 -1
- ScriptCollection/TFCPS/Docker/TFCPS_CodeUnitSpecific_Docker.py +88 -0
- ScriptCollection/TFCPS/Docker/__init__.py +0 -0
- ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationBase.py +8 -0
- ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py +6 -0
- ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py +7 -0
- ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py +479 -0
- ScriptCollection/TFCPS/DotNet/__init__.py +0 -0
- ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py +43 -0
- ScriptCollection/TFCPS/Flutter/__init__.py +0 -0
- ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py +123 -0
- ScriptCollection/TFCPS/NodeJS/__init__.py +0 -0
- ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py +114 -0
- ScriptCollection/TFCPS/Python/__init__.py +0 -0
- ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py +417 -0
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py +120 -0
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py +80 -0
- ScriptCollection/TFCPS/TFCPS_CreateRelease.py +97 -0
- ScriptCollection/TFCPS/TFCPS_Generic.py +43 -0
- ScriptCollection/TFCPS/TFCPS_MergeToMain.py +125 -0
- ScriptCollection/TFCPS/TFCPS_MergeToStable.py +361 -0
- ScriptCollection/TFCPS/TFCPS_Tools_Dependencies.py +16 -0
- ScriptCollection/TFCPS/TFCPS_Tools_General.py +1076 -0
- ScriptCollection/TFCPS/__init__.py +0 -0
- {scriptcollection-4.0.11.dist-info → scriptcollection-4.0.13.dist-info}/METADATA +1 -1
- scriptcollection-4.0.13.dist-info/RECORD +41 -0
- scriptcollection-4.0.11.dist-info/RECORD +0 -17
- {scriptcollection-4.0.11.dist-info → scriptcollection-4.0.13.dist-info}/WHEEL +0 -0
- {scriptcollection-4.0.11.dist-info → scriptcollection-4.0.13.dist-info}/entry_points.txt +0 -0
- {scriptcollection-4.0.11.dist-info → scriptcollection-4.0.13.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
from ...GeneralUtilities import GeneralUtilities
|
2
|
+
from ...SCLog import LogLevel
|
3
|
+
from ..TFCPS_CodeUnitSpecific_Base import TFCPS_CodeUnitSpecific_Base,TFCPS_CodeUnitSpecific_Base_CLI
|
4
|
+
|
5
|
+
class TFCPS_CodeUnitSpecific_Flutter_Functions(TFCPS_CodeUnitSpecific_Base):
|
6
|
+
|
7
|
+
def __init__(self,current_file:str,verbosity:LogLevel,targetenvironmenttype:str,use_cache:bool):
|
8
|
+
super().__init__(current_file, verbosity,targetenvironmenttype,use_cache)
|
9
|
+
|
10
|
+
|
11
|
+
@GeneralUtilities.check_arguments
|
12
|
+
def build(self) -> None:
|
13
|
+
pass#TODO
|
14
|
+
|
15
|
+
@GeneralUtilities.check_arguments
|
16
|
+
def linting(self) -> None:
|
17
|
+
pass#TODO
|
18
|
+
|
19
|
+
@GeneralUtilities.check_arguments
|
20
|
+
def do_common_tasks(self,current_codeunit_version:str )-> None:
|
21
|
+
self.do_common_tasks_base(current_codeunit_version)
|
22
|
+
|
23
|
+
@GeneralUtilities.check_arguments
|
24
|
+
def generate_reference(self) -> None:
|
25
|
+
self.generate_reference_using_docfx()
|
26
|
+
|
27
|
+
@GeneralUtilities.check_arguments
|
28
|
+
def update_dependencies(self) -> None:
|
29
|
+
pass#TODO
|
30
|
+
|
31
|
+
@GeneralUtilities.check_arguments
|
32
|
+
def run_testcases(self) -> None:
|
33
|
+
pass#TODO
|
34
|
+
|
35
|
+
class TFCPS_CodeUnitSpecific_Flutter_CLI:
|
36
|
+
|
37
|
+
@staticmethod
|
38
|
+
def parse(file:str)->TFCPS_CodeUnitSpecific_Flutter_Functions:
|
39
|
+
parser=TFCPS_CodeUnitSpecific_Base_CLI.get_base_parser()
|
40
|
+
#add custom parameter if desired
|
41
|
+
args=parser.parse_args()
|
42
|
+
result:TFCPS_CodeUnitSpecific_Flutter_Functions=TFCPS_CodeUnitSpecific_Flutter_Functions(file,LogLevel(int(args.verbosity)),args.targetenvironmenttype,not args.nocache)
|
43
|
+
return result
|
File without changes
|
@@ -0,0 +1,123 @@
|
|
1
|
+
import os
|
2
|
+
import re
|
3
|
+
from lxml import etree
|
4
|
+
from ...GeneralUtilities import GeneralUtilities
|
5
|
+
from ...SCLog import LogLevel
|
6
|
+
from ..TFCPS_CodeUnitSpecific_Base import TFCPS_CodeUnitSpecific_Base,TFCPS_CodeUnitSpecific_Base_CLI
|
7
|
+
|
8
|
+
class TFCPS_CodeUnitSpecific_NodeJS_Functions(TFCPS_CodeUnitSpecific_Base):
|
9
|
+
|
10
|
+
|
11
|
+
def __init__(self,current_file:str,verbosity:LogLevel,targetenvironmenttype:str,use_cache:bool):
|
12
|
+
super().__init__(current_file, verbosity,targetenvironmenttype,use_cache)
|
13
|
+
|
14
|
+
|
15
|
+
@GeneralUtilities.check_arguments
|
16
|
+
def build(self) -> None:
|
17
|
+
self._protected_sc.run_with_epew("npm", "run build", self.get_codeunit_folder())
|
18
|
+
self.standardized_tasks_build_bom_for_node_project()
|
19
|
+
self.copy_source_files_to_output_directory()
|
20
|
+
|
21
|
+
@GeneralUtilities.check_arguments
|
22
|
+
def linting(self) -> None:
|
23
|
+
self._protected_sc.run_with_epew("npm", "run lint", self.get_codeunit_folder())
|
24
|
+
|
25
|
+
@GeneralUtilities.check_arguments
|
26
|
+
def do_common_tasks(self,current_codeunit_version:str)-> None:
|
27
|
+
codeunit_version = current_codeunit_version
|
28
|
+
codeunit_folder = self.get_codeunit_folder()
|
29
|
+
self.do_common_tasks_base(current_codeunit_version)
|
30
|
+
self.tfcps_Tools_General.replace_version_in_packagejson_file(GeneralUtilities.resolve_relative_path("./package.json", codeunit_folder), codeunit_version)
|
31
|
+
self.tfcps_Tools_General.do_npm_install(codeunit_folder, True,self.use_cache())
|
32
|
+
#if generateAPIClientBase.generate_api_client():
|
33
|
+
# generateAPIClientGenerate:GenerateAPIClientGenerate=generateAPIClientBase
|
34
|
+
# self.tfcps_Tools_General.generate_api_client_from_dependent_codeunit_in_angular(codeunit_folder, generateAPIClientGenerate.name_of_api_providing_codeunit,generateAPIClientGenerate.generate_api_client)
|
35
|
+
|
36
|
+
@GeneralUtilities.check_arguments
|
37
|
+
def generate_reference(self) -> None:
|
38
|
+
self.generate_reference_using_docfx()
|
39
|
+
|
40
|
+
@GeneralUtilities.check_arguments
|
41
|
+
def update_dependencies(self) -> None:
|
42
|
+
pass#TODO
|
43
|
+
|
44
|
+
@GeneralUtilities.check_arguments
|
45
|
+
def run_testcases(self) -> None:
|
46
|
+
# prepare
|
47
|
+
codeunit_name: str =self.get_codeunit_name()
|
48
|
+
|
49
|
+
codeunit_folder =self.get_codeunit_folder()
|
50
|
+
repository_folder = os.path.dirname(codeunit_folder)
|
51
|
+
|
52
|
+
# run testcases
|
53
|
+
self._protected_sc.run_with_epew("npm", f"run test-{self.get_target_environment_type()}", self.get_codeunit_folder())
|
54
|
+
|
55
|
+
# rename file
|
56
|
+
coverage_folder = os.path.join(codeunit_folder, "Other", "Artifacts", "TestCoverage")
|
57
|
+
target_file = os.path.join(coverage_folder, "TestCoverage.xml")
|
58
|
+
GeneralUtilities.ensure_file_does_not_exist(target_file)
|
59
|
+
os.rename(os.path.join(coverage_folder, "cobertura-coverage.xml"), target_file)
|
60
|
+
self.__rename_packagename_in_coverage_file(target_file, codeunit_name)
|
61
|
+
|
62
|
+
# adapt backslashs to slashs
|
63
|
+
content = GeneralUtilities.read_text_from_file(target_file)
|
64
|
+
content = re.sub('\\\\', '/', content)
|
65
|
+
GeneralUtilities.write_text_to_file(target_file, content)
|
66
|
+
|
67
|
+
# aggregate packages in testcoverage-file
|
68
|
+
roottree: etree._ElementTree = etree.parse(target_file)
|
69
|
+
existing_classes = list(roottree.xpath('//coverage/packages/package/classes/class'))
|
70
|
+
|
71
|
+
old_packages_list = roottree.xpath('//coverage/packages/package')
|
72
|
+
for package in old_packages_list:
|
73
|
+
package.getparent().remove(package)
|
74
|
+
|
75
|
+
root = roottree.getroot()
|
76
|
+
packages_element = root.find("packages")
|
77
|
+
package_element = etree.SubElement(packages_element, "package")
|
78
|
+
package_element.attrib['name'] = codeunit_name
|
79
|
+
package_element.attrib['lines-valid'] = root.attrib["lines-valid"]
|
80
|
+
package_element.attrib['lines-covered'] = root.attrib["lines-covered"]
|
81
|
+
package_element.attrib['line-rate'] = root.attrib["line-rate"]
|
82
|
+
package_element.attrib['branches-valid'] = root.attrib["branches-valid"]
|
83
|
+
package_element.attrib['branches-covered'] = root.attrib["branches-covered"]
|
84
|
+
package_element.attrib['branch-rate'] = root.attrib["branch-rate"]
|
85
|
+
package_element.attrib['timestamp'] = root.attrib["timestamp"]
|
86
|
+
package_element.attrib['complexity'] = root.attrib["complexity"]
|
87
|
+
|
88
|
+
classes_element = etree.SubElement(package_element, "classes")
|
89
|
+
|
90
|
+
for existing_class in existing_classes:
|
91
|
+
classes_element.append(existing_class)
|
92
|
+
|
93
|
+
result = etree.tostring(roottree, pretty_print=True).decode("utf-8")
|
94
|
+
GeneralUtilities.write_text_to_file(target_file, result)
|
95
|
+
|
96
|
+
# post tasks
|
97
|
+
self.run_testcases_common_post_task(repository_folder, codeunit_name, True, self.get_target_environment_type())
|
98
|
+
|
99
|
+
@GeneralUtilities.check_arguments
|
100
|
+
def __rename_packagename_in_coverage_file(self, file: str, codeunit_name: str) -> None:
|
101
|
+
root: etree._ElementTree = etree.parse(file)
|
102
|
+
packages = root.xpath('//coverage/packages/package')
|
103
|
+
for package in packages:
|
104
|
+
package.attrib['name'] = codeunit_name
|
105
|
+
result = etree.tostring(root).decode("utf-8")
|
106
|
+
GeneralUtilities.write_text_to_file(file, result)
|
107
|
+
|
108
|
+
|
109
|
+
@GeneralUtilities.check_arguments
|
110
|
+
def standardized_tasks_build_bom_for_node_project(self) -> None:
|
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())
|
113
|
+
self._protected_sc.format_xml_file(self.get_codeunit_folder()+"/"+relative_path_to_bom_file)
|
114
|
+
|
115
|
+
class TFCPS_CodeUnitSpecific_NodeJS_CLI:
|
116
|
+
|
117
|
+
@staticmethod
|
118
|
+
def parse(file:str)->TFCPS_CodeUnitSpecific_NodeJS_Functions:
|
119
|
+
parser=TFCPS_CodeUnitSpecific_Base_CLI.get_base_parser()
|
120
|
+
#add custom parameter if desired
|
121
|
+
args=parser.parse_args()
|
122
|
+
result:TFCPS_CodeUnitSpecific_NodeJS_Functions=TFCPS_CodeUnitSpecific_NodeJS_Functions(file,LogLevel(int(args.verbosity)),args.targetenvironmenttype,not args.nocache)
|
123
|
+
return result
|
File without changes
|
@@ -0,0 +1,114 @@
|
|
1
|
+
import os
|
2
|
+
from ...GeneralUtilities import GeneralUtilities
|
3
|
+
from ...SCLog import LogLevel
|
4
|
+
from ..TFCPS_CodeUnitSpecific_Base import TFCPS_CodeUnitSpecific_Base,TFCPS_CodeUnitSpecific_Base_CLI
|
5
|
+
|
6
|
+
class TFCPS_CodeUnitSpecific_Python_Functions(TFCPS_CodeUnitSpecific_Base):
|
7
|
+
|
8
|
+
def __init__(self,current_file:str,verbosity:LogLevel,targetenvironmenttype:str,use_cache:bool):
|
9
|
+
super().__init__(current_file, verbosity,targetenvironmenttype,use_cache)
|
10
|
+
|
11
|
+
|
12
|
+
@GeneralUtilities.check_arguments
|
13
|
+
def build(self) -> None:
|
14
|
+
codeunit_folder = self.get_codeunit_folder()
|
15
|
+
target_directory = GeneralUtilities.resolve_relative_path("../Artifacts/BuildResult_Wheel", os.path.join(self.get_artifacts_folder()))
|
16
|
+
GeneralUtilities.ensure_directory_exists(target_directory)
|
17
|
+
self._protected_sc.run_program("python", f"-m build --wheel --outdir {target_directory}", codeunit_folder)
|
18
|
+
self.generate_bom_for_python_project( )
|
19
|
+
self.copy_source_files_to_output_directory()
|
20
|
+
#TODO check for updateable dependencies (in a unified way)
|
21
|
+
|
22
|
+
@GeneralUtilities.check_arguments
|
23
|
+
def generate_bom_for_python_project(self) -> None:
|
24
|
+
codeunit_folder: str=self.get_codeunit_folder()
|
25
|
+
codeunitname: str=self.get_codeunit_name()
|
26
|
+
repository_folder = os.path.dirname(codeunit_folder)
|
27
|
+
|
28
|
+
codeunitversion = self.tfcps_Tools_General.get_version_of_codeunit(self.get_codeunit_file())
|
29
|
+
bom_folder = "Other/Artifacts/BOM"
|
30
|
+
bom_folder_full = os.path.join(codeunit_folder, bom_folder)
|
31
|
+
GeneralUtilities.ensure_directory_exists(bom_folder_full)
|
32
|
+
if not os.path.isfile(os.path.join(codeunit_folder, "requirements.txt")):
|
33
|
+
raise ValueError(f"Codeunit {codeunitname} does not have a 'requirements.txt'-file.")
|
34
|
+
# TODO check that all values from setup.cfg are contained in requirements.txt
|
35
|
+
result = self._protected_sc.run_program("cyclonedx-py", "requirements", codeunit_folder)
|
36
|
+
bom_file_relative_json = f"{bom_folder}/{codeunitname}.{codeunitversion}.bom.json"
|
37
|
+
bom_file_relative_xml = f"{bom_folder}/{codeunitname}.{codeunitversion}.bom.xml"
|
38
|
+
bom_file_json = os.path.join(codeunit_folder, bom_file_relative_json)
|
39
|
+
bom_file_xml = os.path.join(codeunit_folder, bom_file_relative_xml)
|
40
|
+
|
41
|
+
GeneralUtilities.ensure_file_exists(bom_file_json)
|
42
|
+
GeneralUtilities.write_text_to_file(bom_file_json, result[1])
|
43
|
+
self.tfcps_Tools_General.ensure_cyclonedxcli_is_available(repository_folder,not self.use_cache())
|
44
|
+
cyclonedx_exe ="cyclonedx-cli"# cyclonedx_exe = os.path.join(repository_folder, "Other/Resources/CycloneDXCLI/cyclonedx-cli")
|
45
|
+
#if GeneralUtilities.current_system_is_windows():
|
46
|
+
# cyclonedx_exe = cyclonedx_exe+".exe"
|
47
|
+
self._protected_sc.run_program(cyclonedx_exe, f"convert --input-file ./{codeunitname}/{bom_file_relative_json} --input-format json --output-file ./{codeunitname}/{bom_file_relative_xml} --output-format xml", repository_folder)
|
48
|
+
self._protected_sc.format_xml_file(bom_file_xml)
|
49
|
+
GeneralUtilities.ensure_file_does_not_exist(bom_file_json)
|
50
|
+
|
51
|
+
@GeneralUtilities.check_arguments
|
52
|
+
def linting(self) -> None:
|
53
|
+
codeunitname: str = self.get_codeunit_name()
|
54
|
+
|
55
|
+
repository_folder: str = self.get_repository_folder()
|
56
|
+
errors_found = False
|
57
|
+
self._protected_sc.log.log(f"Check for linting-issues in codeunit {codeunitname}.")
|
58
|
+
src_folder = os.path.join(repository_folder, codeunitname, codeunitname)
|
59
|
+
tests_folder = src_folder+"Tests"
|
60
|
+
# TODO check if there are errors in sarif-file
|
61
|
+
for file in GeneralUtilities.get_all_files_of_folder(src_folder)+GeneralUtilities.get_all_files_of_folder(tests_folder):
|
62
|
+
relative_file_path_in_repository = os.path.relpath(file, repository_folder)
|
63
|
+
if file.endswith(".py") and os.path.getsize(file) > 0 and not self._protected_sc.file_is_git_ignored(relative_file_path_in_repository, repository_folder):
|
64
|
+
self._protected_sc.log.log(f"Check for linting-issues in {os.path.relpath(file, os.path.join(repository_folder, codeunitname))}.")
|
65
|
+
linting_result = self._protected_sc.python_file_has_errors(file, repository_folder)
|
66
|
+
if (linting_result[0]):
|
67
|
+
errors_found = True
|
68
|
+
for error in linting_result[1]:
|
69
|
+
self._protected_sc.log.log(error, LogLevel.Warning)
|
70
|
+
if errors_found:
|
71
|
+
raise ValueError("Linting-issues occurred.")
|
72
|
+
else:
|
73
|
+
self._protected_sc.log.log("No linting-issues found.")
|
74
|
+
|
75
|
+
@GeneralUtilities.check_arguments
|
76
|
+
def do_common_tasks(self,current_codeunit_version:str )-> None:
|
77
|
+
self.do_common_tasks_base(current_codeunit_version)
|
78
|
+
codeunitname =self.get_codeunit_name()
|
79
|
+
codeunit_version = self.tfcps_Tools_General.get_version_of_project(self.get_repository_folder())
|
80
|
+
self._protected_sc.replace_version_in_ini_file(GeneralUtilities.resolve_relative_path("./setup.cfg", self.get_codeunit_folder()), codeunit_version)
|
81
|
+
self._protected_sc.replace_version_in_python_file(GeneralUtilities.resolve_relative_path(f"./{codeunitname}/{codeunitname}Core.py", self.get_codeunit_folder()), codeunit_version)
|
82
|
+
|
83
|
+
@GeneralUtilities.check_arguments
|
84
|
+
def generate_reference(self) -> None:
|
85
|
+
self.generate_reference_using_docfx()
|
86
|
+
|
87
|
+
@GeneralUtilities.check_arguments
|
88
|
+
def update_dependencies(self) -> None:
|
89
|
+
pass
|
90
|
+
|
91
|
+
@GeneralUtilities.check_arguments
|
92
|
+
def run_testcases(self) -> None:
|
93
|
+
codeunitname: str =self.get_codeunit_name()
|
94
|
+
repository_folder: str = self.get_repository_folder()
|
95
|
+
codeunit_folder = os.path.join(repository_folder, codeunitname)
|
96
|
+
self._protected_sc.run_program("coverage", f"run -m pytest -s ./{codeunitname}Tests", codeunit_folder)
|
97
|
+
self._protected_sc.run_program("coverage", "xml", codeunit_folder)
|
98
|
+
coveragefolder = os.path.join(repository_folder, codeunitname, "Other/Artifacts/TestCoverage")
|
99
|
+
GeneralUtilities.ensure_directory_exists(coveragefolder)
|
100
|
+
coveragefile = os.path.join(coveragefolder, "TestCoverage.xml")
|
101
|
+
GeneralUtilities.ensure_file_does_not_exist(coveragefile)
|
102
|
+
os.rename(os.path.join(repository_folder, codeunitname, "coverage.xml"), coveragefile)
|
103
|
+
self.tfcps_Tools_General.merge_packages(coveragefile,codeunitname)
|
104
|
+
self.run_testcases_common_post_task(repository_folder, codeunitname, True, self.get_type_environment_type())
|
105
|
+
|
106
|
+
class TFCPS_CodeUnitSpecific_Python_CLI:
|
107
|
+
|
108
|
+
@staticmethod
|
109
|
+
def parse(file:str)->TFCPS_CodeUnitSpecific_Python_Functions:
|
110
|
+
parser=TFCPS_CodeUnitSpecific_Base_CLI.get_base_parser()
|
111
|
+
#add custom parameter if desired
|
112
|
+
args=parser.parse_args()
|
113
|
+
result:TFCPS_CodeUnitSpecific_Python_Functions=TFCPS_CodeUnitSpecific_Python_Functions(file,LogLevel(int(args.verbosity)),args.targetenvironmenttype,not args.nocache)
|
114
|
+
return result
|
File without changes
|