Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ESMFMKFILE env variable not set in RTD build #577

Merged
merged 3 commits into from
Dec 5, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,21 @@
#
import os
import sys
from pathlib import Path
from typing import Dict

import sphinx_autosummary_accessors

# A workaround that sets the "ESMFMKFILE" env variable for the Read The Docs
# build to work. Read The Docs does not activate the conda environment which
# causes "ESMFMKFILE" to not be set.
# Source: https://github.com/conda-forge/esmf-feedstock/issues/91
if os.environ.get("READTHEDOCS") and "ESMFMKFILE" not in os.environ:
# RTD doesn't activate the env, and esmpy depends on a 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")
tomvothecoder marked this conversation as resolved.
Show resolved Hide resolved

sys.path.insert(0, os.path.abspath("..")) # noqa: I001, I003
import xcdat # noqa: I001, E402

Expand Down
Loading