diff --git a/docs/conf.py b/docs/conf.py index e82b2e0b..fb5cd9c8 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -16,12 +16,20 @@ # directory, add these directories to sys.path here. If the directory is # relative to the documentation root, use os.path.abspath to make it # absolute, like shown here. -# +from pathlib import Path + import os import sys sys.path.insert(0, os.path.abspath('..')) -import xhydro +import xhydro # noqa + + +if os.environ.get("READTHEDOCS") and "ESMFMKFILE" not in os.environ: + # RTD doesn't activate the env, and esmpy depends on an env var set there + # We assume the `os` package is in {ENV}/lib/pythonX.X/os.py + # See conda-forge/esmf-feedstock#91 and readthedocs/readthedocs.org#4067 + os.environ["ESMFMKFILE"] = str(Path(os.__file__).parent.parent / "esmf.mk") # -- General configuration ---------------------------------------------