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():
41
41
try :
42
42
clout = CommandLine (command = 'afni_vcheck' ,
43
43
terminal_output = 'allatonce' ).run ()
44
- out = clout .runtime .stdout .split ('\n ' )[1 ]
45
44
except IOError :
46
45
# If afni_vcheck is not present, return None
47
46
warn ('afni_vcheck executable not found.' )
48
47
return None
49
- except RuntimeError :
48
+ except RuntimeError as e :
50
49
# If AFNI is outdated, afni_vcheck throws error
51
50
warn ('AFNI is outdated' )
52
- out = clout . runtime . stderr . split ('\n ' )[1 ]
51
+ return str ( e ). split ('\n ' )[4 ]. split ( '=' , 1 )[ 1 ]. strip ()
53
52
54
53
# 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 :]
59
58
60
- v = m . group ( 0 ) .split ('.' )
59
+ v = out .split ('.' )
61
60
try :
62
61
v = [int (n ) for n in v ]
63
62
except ValueError :
You can’t perform that action at this time.
0 commit comments