Skip to content

Commit 67cfe04

Browse files
committed
mrtrix3: use looseversion to avoid undefined version
1 parent 6ab8a24 commit 67cfe04

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

nipype/interfaces/mrtrix3/base.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from __future__ import (print_function, division, unicode_literals,
55
absolute_import)
66

7-
from ... import logging
7+
from ... import logging, LooseVersion
88
from ...utils.filemanip import which
99
from ..base import (CommandLineInputSpec, CommandLine, traits, File, isdefined, PackageInfo)
1010
iflogger = logging.getLogger('nipype.interface')
@@ -30,6 +30,18 @@ def parse_version(raw_info):
3030

3131
return '.'.join(v_string.split('.')[:3])
3232

33+
@classmethod
34+
def looseversion(cls):
35+
""" Return a comparable version object
36+
37+
If no version found, use LooseVersion('0.0.0')
38+
"""
39+
ver = cls.version()
40+
if ver is None:
41+
return LooseVersion('0.0.0')
42+
43+
return cls.version())
44+
3345

3446
class MRTrix3BaseInputSpec(CommandLineInputSpec):
3547
nthreads = traits.Int(

nipype/interfaces/mrtrix3/reconst.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class FitTensor(MRTrix3Base):
7575
"""
7676

7777
_cmd = 'dwi2tensor'
78-
if Info.version() < LooseVersion("0.3.14"):
78+
if Info.looseversion() < LooseVersion("0.3.14"):
7979
input_spec = FitTensorInputSpec0_3_13
8080
else:
8181
input_spec = FitTensorInputSpec

0 commit comments

Comments
 (0)