@@ -997,7 +997,7 @@ def convert(items, symlink=True, converter=None,
997
997
if exists (scaninfo ):
998
998
lgr .info ("Post-treating %s file" , scaninfo )
999
999
treat_infofile (scaninfo )
1000
- os . chmod (outname , 0o0440 )
1000
+ set_readonly (outname )
1001
1001
1002
1002
if custom_callable is not None :
1003
1003
custom_callable (* item )
@@ -1168,9 +1168,9 @@ def tuneup_bids_json_files(json_files):
1168
1168
lgr .error ("Failed to open magnitude file: %s" , exc )
1169
1169
1170
1170
# might have been made R/O already
1171
- os . chmod (json_phasediffname , 0o0664 )
1171
+ set_readonly (json_phasediffname , False )
1172
1172
json .dump (json_ , open (json_phasediffname , 'w' ), indent = 2 )
1173
- os . chmod (json_phasediffname , 0o0444 )
1173
+ set_readonly (json_phasediffname )
1174
1174
1175
1175
# phasediff one should contain two PhaseDiff's
1176
1176
# -- one for original amplitude and the other already replicating what is there
@@ -1244,15 +1244,15 @@ in that one though
1244
1244
if global_options ['overwrite' ] and os .path .lexists (scaninfo ):
1245
1245
# TODO: handle annexed file case
1246
1246
if not os .path .islink (scaninfo ):
1247
- os . chmod (scaninfo , 0o0660 )
1247
+ set_readonly (scaninfo , False )
1248
1248
res = embedfunc .run ()
1249
- os . chmod (scaninfo , 0o0444 )
1249
+ set_readonly (scaninfo )
1250
1250
if with_prov :
1251
1251
g = res .provenance .rdf ()
1252
1252
g .parse (prov_file ,
1253
1253
format = 'turtle' )
1254
1254
g .serialize (prov_file , format = 'turtle' )
1255
- os . chmod (prov_file , 0o0440 )
1255
+ set_readonly (prov_file )
1256
1256
except Exception as exc :
1257
1257
lgr .error ("Embedding failed: %s" , str (exc ))
1258
1258
os .chdir (cwd )
@@ -1269,10 +1269,10 @@ def treat_infofile(filename):
1269
1269
j_slim = slim_down_info (j )
1270
1270
j_pretty = json_dumps_pretty (j_slim , indent = 2 , sort_keys = True )
1271
1271
1272
- os . chmod (filename , 0o0664 )
1272
+ set_readonly (filename , False )
1273
1273
with open (filename , 'wt' ) as fp :
1274
1274
fp .write (j_pretty )
1275
- os . chmod (filename , 0o0444 )
1275
+ set_readonly (filename )
1276
1276
1277
1277
1278
1278
def convert_dicoms (sid ,
0 commit comments