1717EPICS_DIR = "EPICS"
1818IBEX_DIR = "IBEX"
1919SCRIPT_GEN_DIR = "SCRIPT_GEN"
20- UKTENA_DIR = "uktena "
20+ UKTENA_DIR = "UKTENA "
2121JSON_BOURNE_DIR = "JSON_bourne"
2222
2323INSTETC_TEMPLATE_LOCAL_PATH = os .path .join (
4646SCRIPT_GENERATOR_POM_ABSOLUTE_PATH = os .path .join (SCRIPT_GEN_DIR , SCRIPT_GENERATOR_POM_LOCAL_PATH )
4747
4848
49- def write_instetc_version (version : str ):
49+ def write_instetc_version (version : str ) -> None :
5050 logging .info (f"Writing version '{ version } ' to '{ INSTETC_TEMPLATE_ABSOLUTE_PATH } '." )
5151
5252 with open (INSTETC_TEMPLATE_ABSOLUTE_PATH , "r" ) as file :
@@ -61,7 +61,7 @@ def write_instetc_version(version: str):
6161 file .write (data )
6262
6363
64- def write_gui_version (manifest_path : str , pom_path : str , version : str ):
64+ def write_gui_version (manifest_path : str , pom_path : str , version : str ) -> None :
6565 # In Manifest file.
6666 logging .info (f"Writing version '{ version } ' to '{ manifest_path } '." )
6767
@@ -97,15 +97,17 @@ def write_gui_version(manifest_path: str, pom_path: str, version: str):
9797class ReleaseBranch :
9898 """Wrapper around a Repo object. Used to perform Git operations on a release branch."""
9999
100- def __init__ (self , repo : Repo = None ):
100+ def __init__ (self , repo : Repo = None ) -> None :
101101 self .repo = repo
102102
103- def create (self , url : str , dir : str , branch_name : str , submodules : bool = False ):
103+ def create (self , url : str , dir : str , branch_name : str , submodules : bool = False ) -> None :
104104 """
105105 Initializes a repository by using 'git clone'.
106106 Creates a release branch for the main repository and, optionally, all submodules.
107107
108- Uses an environment variable 'REMOTE' set in Jenkins to check if submodules should be updated with '--remote'.
108+ Uses an environment variable 'REMOTE' set in Jenkins to check if submodules
109+ should be updated with '--remote'.
110+
109111 Will fail the script if there are any new submodule commits. Defaults to true.
110112
111113 Uses an environment variable 'TAG' set in Jenkins as the source for the release branch.
@@ -123,7 +125,7 @@ def create(self, url: str, dir: str, branch_name: str, submodules: bool = False)
123125 logging .info (f"Cloning '{ url } ' into '{ dir } '." )
124126 self .repo = git .Repo .clone_from (url = url , to_path = dir )
125127 if branch_name in self .repo .references :
126- logging .error (f"Branch name '{ branch_name } ' already exists for repo '{ url } '." )
128+ logging .error (f"Branch name '{ branch_name } ' " f" already exists for repo '{ url } '." )
127129 sys .exit (1 )
128130
129131 source = os .getenv ("TAG" )
@@ -150,7 +152,8 @@ def create(self, url: str, dir: str, branch_name: str, submodules: bool = False)
150152 new_commits = False
151153 for i in self .repo .index .diff (None ).iter_change_type ("M" ):
152154 logging .warning (
153- f"Submodule '{ i .a_path } ' in repo '{ self .repo .remotes .origin .url } ' has new commits."
155+ f"Submodule '{ i .a_path } ' in repo "
156+ f"'{ self .repo .remotes .origin .url } ' has new commits."
154157 )
155158 new_commits = True
156159
@@ -168,7 +171,8 @@ def create(self, url: str, dir: str, branch_name: str, submodules: bool = False)
168171 for submodule in self .repo .submodules :
169172 if branch_name in submodule .module ().references :
170173 logging .error (
171- f"Branch name '{ branch_name } ' already exists for repo '{ submodule .module ().remote ().url } '."
174+ f"Branch name '{ branch_name } ' already "
175+ f"exists for repo '{ submodule .module ().remote ().url } '."
172176 )
173177 sys .exit (1 )
174178
@@ -178,7 +182,7 @@ def create(self, url: str, dir: str, branch_name: str, submodules: bool = False)
178182 )
179183 submodule .module ().create_head (branch_name ).checkout ()
180184
181- def commit (self , items : List [Any ], msg : str ):
185+ def commit (self , items : List [Any ], msg : str ) -> None :
182186 """
183187 Commits a list of items.
184188
@@ -191,7 +195,7 @@ def commit(self, items: List[Any], msg: str):
191195 self .repo .index .add (items )
192196 self .repo .index .commit (msg )
193197
194- def push (self , submodules : bool = False ):
198+ def push (self , submodules : bool = False ) -> None :
195199 """
196200 Pushes changes to remote.
197201
@@ -228,7 +232,8 @@ def push(self, submodules: bool = False):
228232 ioc_submodule = epics .repo .submodule ("ioc/master" )
229233 ioc = ReleaseBranch (ioc_submodule .module ())
230234 ioc .commit ([INSTETC_TEMPLATE_LOCAL_PATH ], f"Update version to { args .version } ." )
231- # Set submodule hash to created commit hash. This ensures we use the latest submodule commit.
235+ # Set submodule hash to created commit hash.
236+ # This ensures we use the latest submodule commit.
232237 ioc_submodule .binsha = ioc .repo .head .commit .binsha
233238
234239 epics .commit ([ioc_submodule ], "Update submodule ioc." )
0 commit comments