ScriptCollection 4.0.24__py3-none-any.whl → 4.0.26__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.
@@ -1,5 +1,8 @@
1
1
  import argparse
2
2
  import os
3
+ from .TFCPS.TFCPS_CodeUnit_BuildCodeUnit import TFCPS_CodeUnit_BuildCodeUnit
4
+ from .TFCPS.TFCPS_CodeUnit_BuildCodeUnits import TFCPS_CodeUnit_BuildCodeUnits
5
+ from .TFCPS.TFCPS_Tools_General import TFCPS_Tools_General
3
6
  from .SCLog import LogLevel
4
7
  from .GeneralUtilities import GeneralUtilities
5
8
  from .ScriptCollectionCore import ScriptCollectionCore
@@ -11,6 +14,7 @@ class AnionBuildPlatformConfiguration:
11
14
  verbosity:LogLevel
12
15
  source_branch:str
13
16
  common_remote_name:str
17
+ update_dependencies:bool
14
18
 
15
19
  def __init__(self,
16
20
  build_repositories_folder:str,
@@ -18,23 +22,27 @@ class AnionBuildPlatformConfiguration:
18
22
  additional_arguments_file:str,
19
23
  verbosity:LogLevel,
20
24
  source_branch:str,
21
- common_remote_name:str):
25
+ common_remote_name:str,
26
+ update_dependencies:bool):
22
27
  self.build_repositories_folder=build_repositories_folder
23
28
  self.project_to_build=project_to_build
24
29
  self.additional_arguments_file=additional_arguments_file
25
30
  self.verbosity=verbosity
26
31
  self.source_branch=source_branch
27
32
  self.common_remote_name=common_remote_name
33
+ self.update_dependencies=update_dependencies
28
34
 
29
35
  class AnionBuildPlatform:
30
36
 
31
37
  __configuration: AnionBuildPlatformConfiguration
32
38
  __sc:ScriptCollectionCore
39
+ __tFCPS_Tools_General:TFCPS_Tools_General
33
40
 
34
41
  def __init__(self, configuration: AnionBuildPlatformConfiguration):
35
42
  self.__configuration = configuration
36
43
  self.__sc = ScriptCollectionCore()
37
44
  self.__sc.log.loglevel=configuration.verbosity
45
+ self._tFCPS_Tools_General=TFCPS_Tools_General(self.__sc)
38
46
 
39
47
  def run(self) -> None:
40
48
  # Checkout source branch
@@ -49,6 +57,10 @@ class AnionBuildPlatform:
49
57
  self.__sc.git_merge(repository,self.__configuration.common_remote_name+"/"+self.__configuration.source_branch,self.__configuration.source_branch,fastforward=True)#TODO check if is anchestor and throw exception if nor
50
58
  self.__sc.git_commit(build_repo_folder,"Updated changes")
51
59
 
60
+ #Update dependencies
61
+ if self.__configuration.update_dependencies:
62
+ self.__update_dependencies()
63
+
52
64
  #Do release
53
65
  scripts_folder:str=os.path.join(build_repo_folder,"Scripts","CreateRelease")
54
66
  self.__sc.run_program("python","MergeToMain.py",scripts_folder)
@@ -57,18 +69,56 @@ class AnionBuildPlatform:
57
69
  #prepare for next-release
58
70
  self.__sc.git_checkout(repository,self.__configuration.source_branch)
59
71
 
72
+ def __update_dependencies(self) -> None:
73
+ self.__sc.log.log("Update dependencies...")
74
+ repository:str=os.path.join(self.__configuration,self.__configuration.project_to_build+"Build","Submodules",self.__configuration.project_to_build)
75
+ self.__sc.assert_no_uncommitted_changes(repository)
76
+ self.__sc.run_program("python","UpdateDependencies.py",os.path.join(repository,"Other","Scripts"))
77
+ codeunits:list[str]=self._tFCPS_Tools_General.get_codeunits(repository)
78
+ for codeunit_name in codeunits:
79
+ self.__sc.log.log(f"Update dependencies of codeunit {codeunit_name}...")
80
+ codeunit_folder=os.path.join(repository,codeunit_name)
81
+ tFCPS_CodeUnit_BuildCodeUnit:TFCPS_CodeUnit_BuildCodeUnit = TFCPS_CodeUnit_BuildCodeUnit(codeunit_folder,self.__sc.log.loglevel,"QualityCheck",None,True,False)
82
+ tFCPS_CodeUnit_BuildCodeUnit.build_codeunit()#ensure requirements for updating are there (some programming types needs this)
83
+ if self.__tFCPS_Tools_General.codeunit_has_updatable_dependencies(os.path.join(codeunit_folder,f"{codeunit_name}.codeunit.xml")):
84
+ self.__sc.run_program("python","UpdateDependencies.py",os.path.join(codeunit_folder,"Other"))
85
+ tFCPS_CodeUnit_BuildCodeUnit.build_codeunit()#check if codeunit is still buildable
86
+
87
+ if self.__sc.git_repository_has_uncommitted_changes(repository):
88
+ changelog_folder = os.path.join(repository, "Other", "Resources", "Changelog")
89
+ project_version:str=self._tFCPS_Tools_General.get_version_of_project(repository)
90
+ changelog_file = os.path.join(changelog_folder, f"v{project_version}.md")
91
+ if not os.path.isfile(changelog_file):
92
+ self.__ensure_changelog_file_is_added(repository, project_version)
93
+ t=TFCPS_CodeUnit_BuildCodeUnits(repository,self.__sc.log.loglevel,"QualityCheck",None,True,False)
94
+ t.build_codeunits()#check codeunits are buildable at all
95
+ self.__sc.git_commit(repository, "Updated dependencies", stage_all_changes=True)
96
+
97
+
98
+ def __ensure_changelog_file_is_added(self, repository_folder: str, version_of_project: str):
99
+ changelog_file = os.path.join(repository_folder, "Other", "Resources", "Changelog", f"v{version_of_project}.md")
100
+ if not os.path.isfile(changelog_file):
101
+ GeneralUtilities.ensure_file_exists(changelog_file)
102
+ GeneralUtilities.write_text_to_file(changelog_file, """# Release notes
103
+
104
+ ## Changes
105
+
106
+ - Updated dependencies.
107
+ """)
108
+
60
109
  class TFCPS_AnionBuildPlatform_CLI:
61
110
 
62
111
  @staticmethod
63
112
  def get_with_overwritable_defaults(default_project_to_build:str=None,default_loglevel:LogLevel=None,default_additionalargumentsfile:str=None,default_build_repositories_folder:str=None,default_source_branch:str=None,default_remote_name:str=None)->AnionBuildPlatform:
64
113
  parser = argparse.ArgumentParser()
65
114
  verbosity_values = ", ".join(f"{lvl.value}={lvl.name}" for lvl in LogLevel)
66
- parser.add_argument('-r', '--buildrepositoriesfolder', required=False,default=None)
115
+ parser.add_argument('-b', '--buildrepositoriesfolder', required=False,default=None)
67
116
  parser.add_argument('-p', '--projecttobuild', required=False, default=None)
68
117
  parser.add_argument('-a', '--additionalargumentsfile', required=False, default=None)
69
118
  parser.add_argument('-v', '--verbosity', required=False, default=3, help=f"Sets the loglevel. Possible values: {verbosity_values}")
70
119
  parser.add_argument('-s', '--sourcebranch', required=False, default="other/next-release")
71
120
  parser.add_argument('-r', '--defaultremotename', required=False, default="origin")
121
+ parser.add_argument('-u', '--updatedependencies', required=False, action='store_true', default=False)
72
122
  args=parser.parse_args()
73
123
 
74
124
  if args.projecttobuild is not None:
@@ -100,6 +150,6 @@ class TFCPS_AnionBuildPlatform_CLI:
100
150
  default_remote_name=args.defaultremotename
101
151
  GeneralUtilities.assert_not_null(default_remote_name,"defaultremotename is not set")
102
152
 
103
- config:AnionBuildPlatformConfiguration=AnionBuildPlatformConfiguration(default_build_repositories_folder,default_project_to_build,default_additionalargumentsfile,default_loglevel,default_source_branch,default_remote_name)
153
+ config:AnionBuildPlatformConfiguration=AnionBuildPlatformConfiguration(default_build_repositories_folder,default_project_to_build,default_additionalargumentsfile,default_loglevel,default_source_branch,default_remote_name,args.updatedependencies)
104
154
  tFCPS_MergeToMain:AnionBuildPlatform=AnionBuildPlatform(config)
105
155
  return tFCPS_MergeToMain
@@ -843,6 +843,7 @@ def CreateRelease()->int:
843
843
  verbosity_values = ", ".join(f"{lvl.value}={lvl.name}" for lvl in LogLevel)
844
844
  parser.add_argument('-v', '--verbosity', required=False, default=3, help=f"Sets the loglevel. Possible values: {verbosity_values}")
845
845
  parser.add_argument('-s', '--sourcebranch', required=False, default="other/next-release")
846
+ parser.add_argument('-u', '--updatedependencies', required=False, action='store_true', default=False)
846
847
  args = parser.parse_args()
847
848
 
848
849
  build_repo_folder: str = None
@@ -855,6 +856,9 @@ def CreateRelease()->int:
855
856
  sc.log.loglevel=LogLevel(verbosity)
856
857
 
857
858
  scripts_folder:str=os.path.join(build_repo_folder,"Scripts","CreateRelease")
858
- sc.run_program("python",f"CreateRelease.py --buildrepositoriesfolder {build_repo_folder} --verbosity {verbosity} --sourcebranch {args.sourcebranch}",os.path.join(build_repo_folder,"Scripts","CreateRelease"),scripts_folder)
859
+ arguments=f"CreateRelease.py --buildrepositoriesfolder {build_repo_folder} --verbosity {verbosity} --sourcebranch {args.sourcebranch}"
860
+ if args.updatedependencies:
861
+ arguments=arguments+" --updatedependencies"
862
+ sc.run_program("python", arguments, scripts_folder)
859
863
 
860
864
  return 0
@@ -36,7 +36,7 @@ from .ProgramRunnerPopen import ProgramRunnerPopen
36
36
  from .ProgramRunnerEpew import ProgramRunnerEpew, CustomEpewArgument
37
37
  from .SCLog import SCLog, LogLevel
38
38
 
39
- version = "4.0.24"
39
+ version = "4.0.26"
40
40
  __version__ = version
41
41
 
42
42
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ScriptCollection
3
- Version: 4.0.24
3
+ Version: 4.0.26
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
@@ -1,6 +1,6 @@
1
- ScriptCollection/AnionBuildPlatform.py,sha256=Hi2Gg-zEw3FKb417CtyANcC_vGvFNUBy68qE3NIxkvU,5488
1
+ ScriptCollection/AnionBuildPlatform.py,sha256=nT-P5plz8wFZoxK1Axqjdudf4fwB0unEdSfOdcxK2DA,8763
2
2
  ScriptCollection/CertificateUpdater.py,sha256=GXPxmYaW-ufOqsiP9kUYdtI6eNg1-GzrrCqsZdwW_HY,9199
3
- ScriptCollection/Executables.py,sha256=UUww7lgOAeEsrAhrAVp2zlnbdv3mMbS4eiN6xDp-o5Y,41710
3
+ ScriptCollection/Executables.py,sha256=7Tsbk-1Oy-lgigyKQz5JGux_d5A5dBcRZG7OBBjPR6I,41868
4
4
  ScriptCollection/GeneralUtilities.py,sha256=9Xd9aKPj3TkpVtdHXzFMILrRoXAfJCph69XRTstdsBo,49280
5
5
  ScriptCollection/ImageUpdater.py,sha256=qTe3yoqzQJY7LZdXBbjbWvrsSQaeHy1VwmOxaRzU2ig,29305
6
6
  ScriptCollection/ProcessesRunner.py,sha256=3mu4ZxzZleQo0Op6o9EYTCFiJfb6kx5ov2YfZfT89mU,1395
@@ -9,7 +9,7 @@ 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=VltwKkLX85TWwsR5AMfko3vIQ9ywh1HH7XmwsMc0PWc,140598
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=mBaeIvfLu-g9P5R0-OEHyBvvLEhTJuObEX5gVTXCygU,140598
13
13
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=Cj89Xhzf5CRSDVH_-0JachQMsPHfjkz8jtRi_BpiGvY,25979
15
15
  ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=4rYKgTAga11NiDx8YUqz3K_Q4eX_n3kC6lvNdXEa24s,7389
@@ -35,8 +35,8 @@ ScriptCollection/TFCPS/NodeJS/TFCPS_CodeUnitSpecific_NodeJS.py,sha256=dnuDlQXThF
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.24.dist-info/METADATA,sha256=QatyoBqdvyFPbjA6tSY5jy8MTP8veu8i2tmAqTcNfqY,7688
39
- scriptcollection-4.0.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
- scriptcollection-4.0.24.dist-info/entry_points.txt,sha256=NeU26D6q7d8n2cmKQiOvHK21w1C7D2kxoNRJaKiyZ5w,4295
41
- scriptcollection-4.0.24.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
42
- scriptcollection-4.0.24.dist-info/RECORD,,
38
+ scriptcollection-4.0.26.dist-info/METADATA,sha256=l1BtIZAHX5WMQKkzUljFhZL8xD7xaP_6EqHs5bGyS10,7688
39
+ scriptcollection-4.0.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
+ scriptcollection-4.0.26.dist-info/entry_points.txt,sha256=NeU26D6q7d8n2cmKQiOvHK21w1C7D2kxoNRJaKiyZ5w,4295
41
+ scriptcollection-4.0.26.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
42
+ scriptcollection-4.0.26.dist-info/RECORD,,