Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1a58725

Browse files
committed
Don't emit a non-GUI warning when building the docs on Linux.
... and move the check for graphviz into the _check_dependencies() helper function, where it logically belongs to.
1 parent 2660901 commit 1a58725

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

doc/conf.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ def _check_dependencies():
7272
raise ImportError(
7373
"The following dependencies are missing to build the "
7474
"documentation: {}".format(", ".join(missing)))
75+
if shutil.which('dot') is None:
76+
raise OSError(
77+
"No binary named dot - graphviz must be installed to build the "
78+
"documentation")
7579

7680
_check_dependencies()
7781

@@ -83,10 +87,8 @@ def _check_dependencies():
8387
# The following import is only necessary to monkey patch the signature later on
8488
from sphinx_gallery import gen_rst
8589

86-
if shutil.which('dot') is None:
87-
raise OSError(
88-
"No binary named dot - you need to install the Graph Visualization "
89-
"software (usually packaged as 'graphviz') to build the documentation")
90+
# On Linux, prevent plt.show() from emitting a non-GUI backend warning.
91+
os.environ.pop("DISPLAY", None)
9092

9193
autosummary_generate = True
9294

0 commit comments

Comments
 (0)