File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -41,23 +41,22 @@ def version():
4141 try :
4242 clout = CommandLine (command = 'afni_vcheck' ,
4343 terminal_output = 'allatonce' ).run ()
44- out = clout .runtime .stdout .split ('\n ' )[1 ]
4544 except IOError :
4645 # If afni_vcheck is not present, return None
4746 warn ('afni_vcheck executable not found.' )
4847 return None
49- except RuntimeError :
48+ except RuntimeError as e :
5049 # If AFNI is outdated, afni_vcheck throws error
5150 warn ('AFNI is outdated' )
52- out = clout . runtime . stderr . split ('\n ' )[1 ]
51+ return str ( e ). split ('\n ' )[4 ]. split ( '=' , 1 )[ 1 ]. strip ()
5352
5453 # Try to parse the version number
55- m = re . search ( r'[\.\d]*$' , out )
56- # is the format kept through versions before 16.x?
57- if m is None or not m . group ( 0 ):
58- return out
54+ out = clout . runtime . stdout . split ( ' \n ' )[ 1 ]. split ( '=' , 1 )[ 1 ]. strip ( )
55+
56+ if out . startswith ( 'AFNI_' ):
57+ out = out [ 5 :]
5958
60- v = m . group ( 0 ) .split ('.' )
59+ v = out .split ('.' )
6160 try :
6261 v = [int (n ) for n in v ]
6362 except ValueError :
You can’t perform that action at this time.
0 commit comments