File tree 2 files changed +13
-5
lines changed
2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 17
17
# add these directories to sys.path here. If the directory is relative to the
18
18
# documentation root, use os.path.abspath to make it absolute, like shown here.
19
19
#
20
+ import builtins
20
21
import configparser
21
22
import importlib
22
23
from pathlib import Path
23
24
import pkg_resources
24
25
import sys
25
26
27
+ # Make it possible for our code to tell that it is running under Sphinx.
28
+ # See https://stackoverflow.com/a/65147676/167694
29
+ builtins .__sphinx_build__ = True
30
+
31
+
26
32
sys .path .insert (0 , str (Path (__file__ ).parents [1 ]))
27
33
28
34
Original file line number Diff line number Diff line change 1
1
"""Detect if we are running under Sphinx."""
2
- import os
3
- import sys
4
-
5
2
__all__ = ('SPHINX' ,)
6
3
7
- SPHINX = (os .path .basename (sys .argv [0 ]) == 'sphinx-build'
8
- or 'build_sphinx' in sys .argv )
4
+
5
+ try :
6
+ # This global builtin variable is set in doc/conf.py.
7
+ # See https://stackoverflow.com/a/65147676/167694
8
+ SPHINX = __sphinx_build__
9
+ except NameError :
10
+ SPHINX = False
You can’t perform that action at this time.
0 commit comments