Skip to content

Commit f3a2804

Browse files
committed
Remove distutils
Closes #527
1 parent 4f78937 commit f3a2804

File tree

4 files changed

+15
-24
lines changed

4 files changed

+15
-24
lines changed

src/serpentTools/io/base.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44

55
from abc import ABC, abstractmethod
6-
from serpentTools.utils import checkScipy
76

87
__all__ = [
98
'MatlabConverter',
@@ -66,11 +65,6 @@ def checkContainerReq(self, container):
6665
"Gathering method not implemented for {}."
6766
.format(container.__class__.__name__))
6867

69-
def checkImports(self):
70-
"""Ensure that :term:`scipy` >= 1.0 is installed."""
71-
if not checkScipy('1.0'):
72-
raise ImportError("scipy >= 1.0 required")
73-
7468
def convert(self, reconvert, append=True, format='5', longNames=True,
7569
compress=True, oned='row'):
7670
"""

src/serpentTools/parsers/base.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@
1313
from serpentTools.messages import info
1414
from serpentTools.settings import rc
1515
from serpentTools.objects.base import BaseObject
16-
from serpentTools.utils import checkScipy
16+
17+
try:
18+
import scipy
19+
20+
_HAS_SCIPY = True
21+
except ImportError:
22+
_HAS_SCIPY = False
1723

1824

1925
class BaseReader(ABC, BaseObject):
@@ -135,10 +141,9 @@ class SparseReaderMixin(object):
135141
"""
136142

137143
def __init__(self, sparse):
138-
HAS_SCIPY = checkScipy()
139144
if sparse is None:
140-
self.__sparse = HAS_SCIPY
141-
elif sparse is True and not HAS_SCIPY:
145+
self.__sparse = _HAS_SCIPY
146+
elif sparse and not _HAS_SCIPY:
142147
raise ImportError(
143148
"scipy not installed and required for sparse support")
144149
else:

src/serpentTools/utils/__init__.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
"""
22
Commonly used functions and utilities
33
"""
4-
from distutils.version import StrictVersion
5-
64
from serpentTools.utils.core import * # noqa
75
from serpentTools.utils.docstrings import * # noqa
86
from serpentTools.utils.compare import * # noqa
97
from serpentTools.utils.plot import * # noqa
108

11-
12-
def checkScipy(version=None):
13-
"""Return ``True`` if the given version of :term:`scipy` is installed"""
14-
try:
15-
import scipy
16-
except ImportError:
17-
return False
18-
if version is None:
19-
return True
20-
return StrictVersion(scipy.__version__) >= StrictVersion(version)

tests/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from serpentTools.messages import (
1111
DictHandler, __logger__, removeHandler, addHandler,
1212
)
13-
from serpentTools.utils import checkScipy
1413

1514

1615
def computeMeansErrors(*arrays):
@@ -249,7 +248,12 @@ def assertMsgNotInLogs(self, level, msg, partial=False):
249248
msg=failMsg.format(matchType, msg, level))
250249

251250

252-
HAS_SCIPY = checkScipy('1.0')
251+
try:
252+
import scipy
253+
254+
HAS_SCIPY = True
255+
except ImportError:
256+
HAS_SCIPY = False
253257

254258

255259
class MatlabTesterHelper(TestCase):

0 commit comments

Comments
 (0)