Commit c9ab81b5 authored by Leo Pound Singer's avatar Leo Pound Singer
Browse files

Fix sphinx detection

Readthedocs has changed how it invokes sphinx. See
https://github.com/readthedocs/readthedocs.org/pull/7846
parent 0ec2b1d5
......@@ -17,12 +17,18 @@
# 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.
#
import builtins
import configparser
import importlib
from pathlib import Path
import pkg_resources
import sys
# Make it possible for our code to tell that it is running under Sphinx.
# See https://stackoverflow.com/a/65147676/167694
builtins.__sphinx_build__ = True
sys.path.insert(0, str(Path(__file__).parents[1]))
......
"""Detect if we are running under Sphinx."""
import os
import sys
__all__ = ('SPHINX',)
SPHINX = (os.path.basename(sys.argv[0]) == 'sphinx-build'
or 'build_sphinx' in sys.argv)
try:
# This global builtin variable is set in doc/conf.py.
# See https://stackoverflow.com/a/65147676/167694
SPHINX = __sphinx_build__
except NameError:
SPHINX = False
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment