diff --git a/stistools/__init__.py b/stistools/__init__.py index 65864d48..67ac0654 100644 --- a/stistools/__init__.py +++ b/stistools/__init__.py @@ -1,6 +1,9 @@ from __future__ import absolute_import from .version import * +from .r_util import check_hstcal_status +check_hstcal_status() # Is the 'hstcal' dependency installed? + from . import calstis from . import basic2d from . import ocrreject diff --git a/stistools/r_util.py b/stistools/r_util.py index f8082376..ea003b99 100644 --- a/stistools/r_util.py +++ b/stistools/r_util.py @@ -1,6 +1,7 @@ import os import os.path import copy +import shutil NOT_APPLICABLE = 'n/a' @@ -84,3 +85,11 @@ def interpolate(x, values, xp): break return value + + +def check_hstcal_status(): + on_readthedocs = os.environ.get('READTHEDOCS', 'False') == 'True' + + if not on_readthedocs and not shutil.which('cs0.e'): + raise ImportError("The 'hstcal' package binaries were not found in $PATH. " + "Please check that it is installed.")