Skip to content

Commit

Permalink
Added config file for readthedocs (#3086)
Browse files Browse the repository at this point in the history
- Created a config file for readthedocs, because this is the only way to turn on the option "fail the build in case of warnings/errors";
- Fixed production of errors from `XPythonDomain`: now it uses standard sphinx' mechanism.
  • Loading branch information
st-pasha authored Jul 20, 2021
1 parent d56b591 commit ad1a450
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 14 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# [Read the Docs] configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

sphinx:
builder: html
configuration: docs/conf.py
fail_on_warning: true

python:
version: 3.6
install:
- requirements: requirements_docs.txt
7 changes: 3 additions & 4 deletions docs/_ext/xpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#
#-------------------------------------------------------------------------------
import docutils
import logging
import re
import sphinx.domains
import sphinx.ext
Expand All @@ -45,7 +44,7 @@
from docutils.nodes import Node, system_message
from typing import List, Dict, Tuple

logger = logging.getLogger(__name__)
logger = sphinx.util.logging.getLogger(__name__)


#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -416,7 +415,7 @@ def translate_type(objtype):
return fulltype

def warn(self, msg):
print("\x1B[93mWarning\x1B[33m: " + msg + "\x1B[m")
logger.warn(msg)

def error(self, msg, node=None):
doc = None
Expand All @@ -428,7 +427,7 @@ def error(self, msg, node=None):
msg += f" -- at {doc}:{line}"
else:
msg += f" -- at {self.env.docname}"
logger.error(f"\x1B[91mError: {msg}\x1B[m")
logger.error(msg)



Expand Down

0 comments on commit ad1a450

Please sign in to comment.