Skip to content

Commit 6238148

Browse files
Fix ESMFMKFILE env variable not set in RTD build (#577)
1 parent 104a5d5 commit 6238148

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/conf.py

+8
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,18 @@
1919
#
2020
import os
2121
import sys
22+
from pathlib import Path
2223
from typing import Dict
2324

2425
import sphinx_autosummary_accessors
2526

27+
# A workaround that sets the "ESMFMKFILE" env variable for the Read The Docs
28+
# build to work. Read The Docs does not activate the conda environment which
29+
# causes "ESMFMKFILE" to not be set (required by `esmpy` and `xesmf`).
30+
# Source: https://github.com/conda-forge/esmf-feedstock/issues/91
31+
if os.environ.get("READTHEDOCS") and "ESMFMKFILE" not in os.environ:
32+
os.environ["ESMFMKFILE"] = str(Path(os.__file__).parent.parent / "esmf.mk")
33+
2634
sys.path.insert(0, os.path.abspath("..")) # noqa: I001, I003
2735
import xcdat # noqa: I001, E402
2836

0 commit comments

Comments
 (0)