@@ -44,15 +44,6 @@ def __call__(self, parser, namespace, values, option_string=None):
44
44
setattr (namespace , self .dest , directory )
45
45
46
46
47
- class StoreValidFile (argparse .Action ):
48
- def __call__ (self , parser , namespace , values , option_string = None ):
49
- fn = abspath (values )
50
- if not isfile (fn ):
51
- raise argparse .ArgumentError (
52
- None , "The file %s does not exist!" % fn )
53
- setattr (namespace , self .dest , fn )
54
-
55
-
56
47
class SetLogLevel (argparse .Action ):
57
48
def __call__ (self , parser , namespace , values , option_string = None ):
58
49
logging .basicConfig (level = values )
@@ -261,7 +252,7 @@ def normalize_commit_sha(sha_lst):
261
252
parser .add_argument ('-c' , '--config-file' ,
262
253
help = "Configuration file" ,
263
254
required = True ,
264
- action = StoreValidFile )
255
+ type = argparse . FileType ( 'r' ) )
265
256
266
257
if ROOT not in abspath (os .curdir ):
267
258
parser .error ("This script must be run from the mbed-os directory "
@@ -274,8 +265,7 @@ def normalize_commit_sha(sha_lst):
274
265
commit_msg = "[" + repo_dir + "]" + ": Updated to " + sha
275
266
276
267
# Read configuration data
277
- with open (args .config_file , 'r' ) as config :
278
- json_data = json .load (config )
268
+ json_data = json .load (args .config_file )
279
269
280
270
'''
281
271
Check if branch exists already, in case branch is present
0 commit comments