Skip to content

Commit

Permalink
Use LooseVersion for bottleneck checks (#1235)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaussion authored and shoyer committed Jan 30, 2017
1 parent 6ccbdfd commit 384c9b3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions xarray/core/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import inspect
import operator
import warnings
from distutils.version import StrictVersion
from distutils.version import LooseVersion

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -525,7 +525,7 @@ def inject_bottleneck_rolling_methods(cls):

# bottleneck rolling methods
if has_bottleneck:
if StrictVersion(bn.__version__) < StrictVersion('1.0'):
if LooseVersion(bn.__version__) < LooseVersion('1.0'):
return

for bn_name, method_name in BOTTLENECK_ROLLING_METHODS.items():
Expand Down
4 changes: 2 additions & 2 deletions xarray/core/rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import print_function
import numpy as np
import warnings
from distutils.version import StrictVersion
from distutils.version import LooseVersion

from .pycompat import OrderedDict, zip
from .common import ImplementsRollingArrayReduce, full_like
Expand Down Expand Up @@ -51,7 +51,7 @@ def __init__(self, obj, min_periods=None, center=False, **windows):
"""

if (has_bottleneck and
(StrictVersion(bn.__version__) < StrictVersion('1.0'))):
(LooseVersion(bn.__version__) < LooseVersion('1.0'))):
warnings.warn('xarray requires bottleneck version of 1.0 or '
'greater for rolling operations. Rolling '
'aggregation methods will use numpy instead'
Expand Down
4 changes: 2 additions & 2 deletions xarray/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import print_function
import warnings
from contextlib import contextmanager
from distutils.version import StrictVersion
from distutils.version import LooseVersion

import numpy as np
from numpy.testing import assert_array_equal
Expand Down Expand Up @@ -70,7 +70,7 @@

try:
import bottleneck
if StrictVersion(bottleneck.__version__) < StrictVersion('1.0'):
if LooseVersion(bottleneck.__version__) < LooseVersion('1.0'):
raise ImportError('Fall back to numpy')
has_bottleneck = True
except ImportError:
Expand Down

0 comments on commit 384c9b3

Please sign in to comment.