ScriptCollection 4.3.35__py3-none-any.whl → 4.3.36__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.
@@ -357,7 +357,7 @@ def GenerateCertificateSignRequest() -> int:
357
357
  parser.add_argument('--subj_o', required=True)
358
358
  parser.add_argument('--subj_ou', required=True)
359
359
  args = parser.parse_args()
360
- ScriptCollectionCore().generate_certificate_sign_request(os.getcwd(), args.domain, args.filename, args.subj_c, args.subj_st, args.subj_l, args.subj_o, args.sub_ou)
360
+ ScriptCollectionCore().generate_certificate_sign_request(os.getcwd(), args.domain, args.filename, args.subj_c, args.subj_st, args.subj_l, args.subj_o, args.subj_ou)
361
361
  return 0
362
362
 
363
363
 
@@ -369,7 +369,7 @@ def SignCertificate() -> int:
369
369
  parser.add_argument('--filename', required=True)
370
370
  parser.add_argument('--days_until_expire', required=False, default=None, type=int)
371
371
  args = parser.parse_args()
372
- ScriptCollectionCore().sign_certificate(os.getcwd(), args.cafolder, args.caname, args.targetcertificate, args.filename, args.args.days_until_expire)
372
+ ScriptCollectionCore().sign_certificate(os.getcwd(), args.cafolder, args.caname, args.targetcertificate, args.filename, args.days_until_expire)
373
373
  return 0
374
374
 
375
375
 
@@ -38,7 +38,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
38
38
  from .ProgramRunnerPopen import ProgramRunnerPopen
39
39
  from .SCLog import SCLog, LogLevel
40
40
 
41
- version = "4.3.35"
41
+ version = "4.3.36"
42
42
  __version__ = version
43
43
 
44
44
  class VSCodeWorkspaceShellTask:
@@ -2657,7 +2657,9 @@ class ScriptCollectionCore:
2657
2657
  def get_version_from_gitversion(self, folder: str, variable: str) -> str:
2658
2658
  git_folder:str=self.get_real_git_folder(folder)
2659
2659
  cache_folder:str=os.path.join(git_folder,"gitversion_cache")
2660
- GeneralUtilities.ensure_directory_does_not_exist(cache_folder)
2660
+ enable_cache:bool=False
2661
+ if enable_cache:
2662
+ GeneralUtilities.ensure_directory_does_not_exist(cache_folder)
2661
2663
  # /nofetch and /nonormalize: avoid network calls / branch normalization (no auth, no DNS, deterministic in containers and offline).
2662
2664
  # called twice as workaround for issue 1877 in gitversion ( https://github.com/GitTools/GitVersion/issues/1877 )
2663
2665
  # timeoutInSeconds: gitversion finishes within seconds on a normal repository; enforce a timeout so a hanging gitversion-process (observed in some build-containers) aborts the build instead of waiting forever.
@@ -42,88 +42,95 @@ class TFCPS_CodeUnit_BuildCodeUnits:
42
42
  def build_codeunits(self) -> None:
43
43
  self.sc.log.log(GeneralUtilities.get_line())
44
44
  start_time:datetime=GeneralUtilities.get_now()
45
-
46
- #assert that the product-information-file exists
47
- product_information_file = os.path.join(self.repository, ".ScriptCollection", "ProductInformation.xml")
48
- GeneralUtilities.assert_file_exists(product_information_file, f"The file '{product_information_file}' does not exist.")
49
-
50
- #when the build runs inside a container, ensure the used SCBuilder-image is at least the version required by this repository (defined in .ScriptCollection/OCIImages/ImageDefinition.csv)
51
- if self.sc.is_runnning_in_container():
52
- scbuilder_version_environment_value = os.environ.get("SCBuilderVersion")
53
- GeneralUtilities.assert_condition(GeneralUtilities.string_has_content(scbuilder_version_environment_value), "The environment-variable 'SCBuilderVersion' is not set although the build runs inside a container (environment-variable 'ISRUNNINGINCONTAINER' is 'true').")
54
- required_scbuilder_version = Version(self.tfcps_tools_general.oci_image_manager.get_tag_for_image(self.repository, "SCBuilder"))
55
- version_match = re.search(r"\d+(\.\d+)+", scbuilder_version_environment_value)
56
- GeneralUtilities.assert_condition(version_match is not None, f"The environment-variable 'SCBuilderVersion' (value: '{scbuilder_version_environment_value}') does not contain a version-string.")
57
- actual_scbuilder_version = Version(version_match.group(0))
58
- GeneralUtilities.assert_condition(actual_scbuilder_version >= required_scbuilder_version, f"The used SCBuilder-version {actual_scbuilder_version} is older than the version {required_scbuilder_version} required by '{self.tfcps_tools_general.get_product_name(self.repository)}' (defined in .ScriptCollection/OCIImages/ImageDefinition.csv). Please update to a newer SCBuilder-image.")
59
-
60
- if self.is_pre_merge():
61
- GeneralUtilities.assert_condition(not self.__assert_no_new_changes,f"A pre-merge build can not be done with the assert-no-new-changes-option.")
62
45
  ready_to_merge_file=os.path.join(self.repository,".ScriptCollection",".IsReadyToMerge")
63
- GeneralUtilities.ensure_file_does_not_exist(ready_to_merge_file)
64
-
65
- #ensure <repo>/.ScriptCollection/.gitignore is set up (ignores the cache-folder so cache-files never show up as uncommitted changes)
66
- self.sc.ensure_scriptcollection_gitignore_is_setup(self.repository)
67
-
68
- self.sc.log.log(f"Start building codeunits at {GeneralUtilities.datetime_to_string_for_readable_entry(start_time,False)}. (Target environment-type: {self.target_environment_type})")
69
- if self.__assert_no_new_changes:
70
- self.sc.assert_no_uncommitted_changes(self.repository,"Can not build codeunit: There are uncommitted changes in the repository.")
71
-
46
+ error_occurred=False
72
47
  try:
73
- xmlschema.validate(product_information_file, "https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/raw/main/Conventions/RepositoryStructure/CommonProjectStructure/projectinformation.xsd")
74
- except Exception as exception:
75
- self.sc.log.log_exception(f"'{product_information_file}' could not be validated against the XSD:", exception, LogLevel.Warning)
76
-
77
- #run prepare-script
78
- self.run_prepare_script()
48
+ #assert that the product-information-file exists
49
+ product_information_file = os.path.join(self.repository, ".ScriptCollection", "ProductInformation.xml")
50
+ GeneralUtilities.assert_file_exists(product_information_file, f"The file '{product_information_file}' does not exist.")
51
+
52
+ #when the build runs inside a container, ensure the used SCBuilder-image is at least the version required by this repository (defined in .ScriptCollection/OCIImages/ImageDefinition.csv)
53
+ if self.sc.is_runnning_in_container():
54
+ scbuilder_version_environment_value = os.environ.get("SCBuilderVersion")
55
+ GeneralUtilities.assert_condition(GeneralUtilities.string_has_content(scbuilder_version_environment_value), "The environment-variable 'SCBuilderVersion' is not set although the build runs inside a container (environment-variable 'ISRUNNINGINCONTAINER' is 'true').")
56
+ required_scbuilder_version = Version(self.tfcps_tools_general.oci_image_manager.get_tag_for_image(self.repository, "SCBuilder"))
57
+ version_match = re.search(r"\d+(\.\d+)+", scbuilder_version_environment_value)
58
+ GeneralUtilities.assert_condition(version_match is not None, f"The environment-variable 'SCBuilderVersion' (value: '{scbuilder_version_environment_value}') does not contain a version-string.")
59
+ actual_scbuilder_version = Version(version_match.group(0))
60
+ GeneralUtilities.assert_condition(actual_scbuilder_version >= required_scbuilder_version, f"The used SCBuilder-version {actual_scbuilder_version} is older than the version {required_scbuilder_version} required by '{self.tfcps_tools_general.get_product_name(self.repository)}' (defined in .ScriptCollection/OCIImages/ImageDefinition.csv). Please update to a newer SCBuilder-image.")
61
+
62
+ if self.is_pre_merge():
63
+ GeneralUtilities.assert_condition(not self.__assert_no_new_changes,f"A pre-merge build can not be done with the assert-no-new-changes-option.")
64
+
65
+
66
+ #ensure <repo>/.ScriptCollection/.gitignore is set up (ignores the cache-folder so cache-files never show up as uncommitted changes)
67
+ self.sc.ensure_scriptcollection_gitignore_is_setup(self.repository)
68
+
69
+ self.sc.log.log(f"Start building codeunits at {GeneralUtilities.datetime_to_string_for_readable_entry(start_time,False)}. (Target environment-type: {self.target_environment_type})")
70
+ if self.__assert_no_new_changes:
71
+ self.sc.assert_no_uncommitted_changes(self.repository,"Can not build codeunit: There are uncommitted changes in the repository.")
72
+
73
+ try:
74
+ xmlschema.validate(product_information_file, "https://projects.aniondev.de/PublicProjects/Common/ProjectTemplates/-/raw/main/Conventions/RepositoryStructure/CommonProjectStructure/projectinformation.xsd")
75
+ except Exception as exception:
76
+ self.sc.log.log_exception(f"'{product_information_file}' could not be validated against the XSD:", exception, LogLevel.Warning)
77
+
78
+ #run prepare-script
79
+ self.run_prepare_script()
80
+
81
+ #check if changelog exists
82
+ changelog_file=os.path.join(self.repository,"Other","Resources","Changelog",f"v{self.tfcps_tools_general.get_version_of_project(self.repository)}.md")
83
+ GeneralUtilities.assert_file_exists(changelog_file,f"Changelogfile \"{changelog_file}\" does not exist. Try to create it for example using \"sccreatechangelogentry -m ...\".")
84
+
85
+ #mark current version as supported
86
+ now = GeneralUtilities.get_now()
87
+ project_version:str=self.tfcps_tools_general.get_version_of_project(self.repository)
88
+ if not self.tfcps_tools_general.suport_information_exists(self.repository, project_version):
89
+ amount_of_years_for_support:int=1
90
+ support_time = timedelta(days=365*amount_of_years_for_support+30*3+1)
91
+ until = now + support_time
92
+ until_day = datetime(until.year, until.month, until.day, 0, 0, 0)
93
+ from_day = datetime(now.year, now.month, now.day, 0, 0, 0)
94
+ self.tfcps_tools_general.mark_current_version_as_supported(self.repository,project_version,from_day,until_day)
95
+
96
+ codeunits:list[str]=self.tfcps_tools_general.get_codeunits(self.repository)
97
+ GeneralUtilities.assert_condition(0<len(codeunits),f"No codeunits found in repository {self.repository}.")
98
+ self.sc.log.log("Codeunits will be built in the following order:")
99
+ for codeunit_name in codeunits:
100
+ self.sc.log.log(f" - {codeunit_name}")
101
+ for codeunit_name in codeunits:
102
+ tFCPS_CodeUnit_BuildCodeUnit:TFCPS_CodeUnit_BuildCodeUnit = TFCPS_CodeUnit_BuildCodeUnit(os.path.join(self.repository,codeunit_name),self.sc.log.loglevel,self.target_environment_type,self.additionalargumentsfile,self.use_cache(),self.is_pre_merge())
103
+ self.sc.log.log(GeneralUtilities.get_line())
104
+ tFCPS_CodeUnit_BuildCodeUnit.build_codeunit()
79
105
 
80
- #check if changelog exists
81
- changelog_file=os.path.join(self.repository,"Other","Resources","Changelog",f"v{self.tfcps_tools_general.get_version_of_project(self.repository)}.md")
82
- GeneralUtilities.assert_file_exists(changelog_file,f"Changelogfile \"{changelog_file}\" does not exist. Try to create it for example using \"sccreatechangelogentry -m ...\".")
83
-
84
- #mark current version as supported
85
- now = GeneralUtilities.get_now()
86
- project_version:str=self.tfcps_tools_general.get_version_of_project(self.repository)
87
- if not self.tfcps_tools_general.suport_information_exists(self.repository, project_version):
88
- amount_of_years_for_support:int=1
89
- support_time = timedelta(days=365*amount_of_years_for_support+30*3+1)
90
- until = now + support_time
91
- until_day = datetime(until.year, until.month, until.day, 0, 0, 0)
92
- from_day = datetime(now.year, now.month, now.day, 0, 0, 0)
93
- self.tfcps_tools_general.mark_current_version_as_supported(self.repository,project_version,from_day,until_day)
94
-
95
- codeunits:list[str]=self.tfcps_tools_general.get_codeunits(self.repository)
96
- GeneralUtilities.assert_condition(0<len(codeunits),f"No codeunits found in repository {self.repository}.")
97
- self.sc.log.log("Codeunits will be built in the following order:")
98
- for codeunit_name in codeunits:
99
- self.sc.log.log(f" - {codeunit_name}")
100
- for codeunit_name in codeunits:
101
- tFCPS_CodeUnit_BuildCodeUnit:TFCPS_CodeUnit_BuildCodeUnit = TFCPS_CodeUnit_BuildCodeUnit(os.path.join(self.repository,codeunit_name),self.sc.log.loglevel,self.target_environment_type,self.additionalargumentsfile,self.use_cache(),self.is_pre_merge())
102
106
  self.sc.log.log(GeneralUtilities.get_line())
103
- tFCPS_CodeUnit_BuildCodeUnit.build_codeunit()
104
107
 
105
- self.sc.log.log(GeneralUtilities.get_line())
108
+ self.search_for_secrets()
109
+ self.__normalize_md_and_txt_line_endings()
110
+ self.tfcps_tools_general.generate_svg_files_from_plantuml_files_for_repository(self.repository, self.use_cache())
106
111
 
107
- self.search_for_secrets()
108
- self.__normalize_md_and_txt_line_endings()
109
- self.tfcps_tools_general.generate_svg_files_from_plantuml_files_for_repository(self.repository, self.use_cache())
112
+ if self.is_pre_merge():
113
+ self.__translate()
114
+ self.__collect_metrics()
115
+ self.__generate_loc_diagram()
116
+
117
+ except Exception as exception:
118
+ error_occurred=True
119
+ raise
120
+ finally:
121
+ if error_occurred:
122
+ GeneralUtilities.ensure_file_does_not_exist(ready_to_merge_file)
123
+ else:
124
+ if self.is_pre_merge():
125
+ GeneralUtilities.ensure_file_does_not_exist(ready_to_merge_file)#ensure it does not exist because the flag is not supposed to be on the main branch
126
+ else:
127
+ if self.is_working_branch():
128
+ if self.add_ready_to_merge_flag():
129
+ GeneralUtilities.ensure_file_exists(ready_to_merge_file)
110
130
 
111
- if self.is_pre_merge():
112
- self.__translate()
113
- self.__collect_metrics()
114
- self.__generate_loc_diagram()
115
131
 
116
132
  if self.__assert_no_new_changes:
117
133
  self.sc.assert_no_uncommitted_changes(self.repository,"There are new uncommitted changes in the repository.")
118
-
119
- #the ready-to-merge-flag-file itself must not be part of the uncommitted-changes-check above, otherwise setting/clearing it would always trigger that assertion.
120
- if self.is_pre_merge():
121
- GeneralUtilities.ensure_file_does_not_exist(ready_to_merge_file)
122
- else:
123
- if self.is_working_branch():
124
- if self.add_ready_to_merge_flag():
125
- GeneralUtilities.ensure_file_exists(ready_to_merge_file)
126
-
127
134
  end_time:datetime=GeneralUtilities.get_now()
128
135
  duration=end_time-start_time
129
136
  self.sc.log.log(f"Finished building codeunits at {GeneralUtilities.datetime_to_string_for_readable_entry(end_time,False)}. (Duration: {GeneralUtilities.timedelta_to_simple_string(duration)})")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.3.35
3
+ Version: 4.3.36
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,6 +1,6 @@
1
1
  ScriptCollection/AnionBuildPlatform.py,sha256=GP-jnb1GbvT8jzlH-cqnxgOzBzeUdiaWnDXtKNjsxiA,12153
2
2
  ScriptCollection/CertificateUpdater.py,sha256=dR5JpJDlZdjD4_pgMz7zCrt1IM7VfatmK6pULSczxQw,9693
3
- ScriptCollection/Executables.py,sha256=bIeZZwmMFeTAyaqREHzsfgHrbyNSLMKwhGGW2sFnS_o,67929
3
+ ScriptCollection/Executables.py,sha256=8rkQIx417g3slWcI7ablJ_euCGJr6Sp52j4vWYy-aYg,67925
4
4
  ScriptCollection/GeneralUtilities.py,sha256=qYhrKkwbEewGIppuxYRmGhLP50C443tw7sBlwH7Mkbc,71606
5
5
  ScriptCollection/HTTPMaintenanceOverheadHelper.py,sha256=TToNtyO1XzsMbBsTBf3o0xgOK0v4Jf03qw2Z0xb2nCk,2007
6
6
  ScriptCollection/ProcessesRunner.py,sha256=yYaC95h40uszuZPggn2kK3qXIN2ZjGMCavo-NQ53ElQ,1537
@@ -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=RXsiceQ8W6a8YDk_2BPscVbIAmDIpIxqe9WHBy2r4CM,5233
11
11
  ScriptCollection/SCLog.py,sha256=LdzSJy3NnnwYCCefz2h4tiTy4BjT8lOz3IBG_bMOg9E,4821
12
- ScriptCollection/ScriptCollectionCore.py,sha256=U09nz6LRvoIBNLV0vFMYLh6CLUllQjOAQCsZNhE-fxg,246436
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=WMmwhfzYlB--wP5Sl8KlCzebrVK5qqEemfw_je4znn4,246499
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=WO2M28c2tUwsXFNa2L9zqMhdlyObWm3qpPE0LdIs7SE,2315
@@ -35,7 +35,7 @@ ScriptCollection/Resources/MaintenanceSite/MaintenanceSite.html,sha256=CX9S1bdOz
35
35
  ScriptCollection/TFCPS/SCTaskRunnerServer.py,sha256=rpuwSsQ6YQfZS2LGnvOH5ql8zs_-cHU4LQttS7XNT60,11272
36
36
  ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=H9FWlS6BPK-UWJXdWN686ePky4Hq-Q13T0Kx8HSJu7s,34990
37
37
  ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=Ll5EOkpVpPiFrM2mLeQXolaF7075IwgtnHXvfdpkH4k,9904
38
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=fbCwM-eRcdCtXWx__48E43fT55rXBXag5_jWSgdeIz4,30218
38
+ ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=pfxZC4b2dPOpDC1Zm0upyk9Bv0vhLn4gcV2nbcBdesA,30620
39
39
  ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=X2NgZgbOkJsdZ6wMHB_RuS_rQCuz5oQCqzYrxyXBN9Q,6680
40
40
  ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=5vCFfDiU8bvfcnoKNs2ATS8nsl6mYXcIuX7XfYE0tvg,2116
41
41
  ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=zp7n0Li7GTi4tERDMgDcJ-o3m6131m31zvkat0lALEc,7781
@@ -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.35.dist-info/METADATA,sha256=WKOYwBJ_s-tWqB3y4ShwEq8X9HNL4VawcG2MdrproHE,7816
67
- scriptcollection-4.3.35.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
68
- scriptcollection-4.3.35.dist-info/entry_points.txt,sha256=Iq9YMSTWNCAJpBzM5L9CQx80tL9-XUu6MzDRAdBrIPg,5875
69
- scriptcollection-4.3.35.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
70
- scriptcollection-4.3.35.dist-info/RECORD,,
66
+ scriptcollection-4.3.36.dist-info/METADATA,sha256=kH5NYhqGd197oB56WuZwvl52H1RnAk5cFUu2wztaoJE,7816
67
+ scriptcollection-4.3.36.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
68
+ scriptcollection-4.3.36.dist-info/entry_points.txt,sha256=Iq9YMSTWNCAJpBzM5L9CQx80tL9-XUu6MzDRAdBrIPg,5875
69
+ scriptcollection-4.3.36.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
70
+ scriptcollection-4.3.36.dist-info/RECORD,,