Sphinx: Set tags from RTD SPHINX_TAGS env variable

Up until now I mistakenly thought that ReadTheDocs' tags
were the same as Sphinx tags, and would be passed to the
build. It turns out that aren't, so our `.. only:: i18n`
logic did not work.

Instead, we now use RTD environment variables to pass
comma-separated tags to Sphinx.
This commit is contained in:
Rémi Verschelde 2019-07-15 17:51:39 +02:00
parent bafd8b654e
commit 2a957dfc7e
1 changed files with 8 additions and 0 deletions

View File

@ -32,11 +32,19 @@ version = 'latest'
# The full version, including alpha/beta/rc tags
release = 'latest'
# Parse Sphinx tags passed from RTD via environment
env_tags = os.getenv('SPHINX_TAGS', [])
for tag in env_tags.split(','):
print("Adding Sphinx tag: %s" % tag.strip())
tags.add(tag.strip())
# Language / i18n
language = 'en'
is_i18n = tags.has('i18n')
exclude_patterns = ['_build']
# GDScript syntax highlighting
from gdscript import GDScriptLexer
from sphinx.highlighting import lexers
lexers['gdscript'] = GDScriptLexer()