Skip to content

Commit

Permalink
Include "metplus" in autodoc_mock_imports list in the configuration f…
Browse files Browse the repository at this point in the history
…ile for sphinx (conf.py) (this will give sphinx access to METplus); remove definition of METPLUS_ROOT as an environment variable from the Makefile for the docs and instead define it in conf.py (as just a null string since it isn't actually used to load METplus).
  • Loading branch information
gsketefian committed Nov 15, 2024
1 parent 7b8bc8d commit 3ca5387
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 3 additions & 5 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Makefile for Sphinx documentation

#SPHINXOPTS = -a -n -W
SPHINXOPTS = -a -n
SPHINXOPTS = -a -n -W
SPHINXBUILD = sphinx-build
SOURCEDIR = .
BUILDDIR = build
LINKCHECKDIR = $(BUILDDIR)/linkcheck
METPLUSROOT = /scratch1/NCEPDEV/nems/role.epic/spack-stack/spack-stack-1.6.0/envs/upp-addon-env/install/intel/2021.5.0/metplus-5.1.0-eznr7ze

.PHONY: help Makefile linkcheck

Expand All @@ -16,8 +14,8 @@ help:

doc:
make clean
export METPLUS_ROOT=$(METPLUSROOT) ; $(MAKE) linkcheck
export METPLUS_ROOT=$(METPLUSROOT) ; $(MAKE) html
$(MAKE) linkcheck
$(MAKE) html

linkcheck:
$(SPHINXBUILD) -b linkcheck $(SPHINXOPTS) $(SOURCEDIR) $(LINKCHECKDIR)
Expand Down
10 changes: 9 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def setup(app):
# -- Options for autodoc extension ---------------------------------------

autodoc_mock_imports = ["f90nml","cartopy","mpl_toolkits.basemap","fill_jinja_template",
"matplotlib","numpy","uwtools","mpl_toolkits",
"matplotlib","numpy","uwtools","mpl_toolkits","metplus",
]

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -310,3 +310,11 @@ def warn_undocumented_members(app, what, name, obj, options, lines):
'fire-ug': ('https://fire-behavior.readthedocs.io/en/latest/%s', '%s'),
}

# Define environment variables that need to exist when running the top-level code in python
# files (outside of functions, classes, etc.).
#
# METPLUS_ROOT just needs to exist in the environment; its value is not important since for
# the purpose of building the documentation, METplus is loaded by including "metplus" in
# the autodoc_mock_imports list above, not via use of the METPLUS_ROOT environment variable.
os.environ["METPLUS_ROOT"] = ""

0 comments on commit 3ca5387

Please sign in to comment.