Skip to content

Commit

Permalink
Use LooseVersion rather than StrictVersion (#1312)
Browse files Browse the repository at this point in the history
LooseVersion plays nicer when development versions of other libraries (e.g.,
dask) are installed.
  • Loading branch information
shoyer authored Mar 16, 2017
1 parent 57776ab commit 31b46dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions xarray/backends/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import print_function
import gzip
import os.path
from distutils.version import StrictVersion
from distutils.version import LooseVersion
from glob import glob
from io import BytesIO
from numbers import Number
Expand Down Expand Up @@ -230,7 +230,7 @@ def maybe_decode_store(store, lock=False):
except ImportError:
# raise the usual error if dask is entirely missing
import dask
if StrictVersion(dask.__version__) < StrictVersion('0.6'):
if LooseVersion(dask.__version__) < LooseVersion('0.6'):
raise ImportError(
'xarray requires dask version 0.6 or newer')
else:
Expand Down
4 changes: 2 additions & 2 deletions xarray/backends/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import time
import traceback
from collections import Mapping
from distutils.version import StrictVersion
from distutils.version import LooseVersion

from ..conventions import cf_encoder
from ..core.utils import FrozenOrderedDict
Expand Down Expand Up @@ -164,7 +164,7 @@ def sync(self):
if self.sources:
import dask.array as da
import dask
if StrictVersion(dask.__version__) > StrictVersion('0.8.1'):
if LooseVersion(dask.__version__) > LooseVersion('0.8.1'):
da.store(self.sources, self.targets, lock=GLOBAL_LOCK)
else:
da.store(self.sources, self.targets)
Expand Down

0 comments on commit 31b46dc

Please sign in to comment.