Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools>=64", "wheel"]
build-backend = "setuptools.build_meta"
11 changes: 9 additions & 2 deletions sphinx_tabs/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
LEXER_MAP[short_name] = lexer[0]


def _get_env_app(env):
"""Return Sphinx app without triggering deprecated BuildEnvironment.app."""
return getattr(env, "_app", None) or env.app


def get_compatible_builders(app):
builders = [
"html",
Expand Down Expand Up @@ -103,7 +108,8 @@ def run(self):

self.state.nested_parse(self.content, self.content_offset, node)

if self.env.app.builder.name in get_compatible_builders(self.env.app):
app = _get_env_app(self.env)
if app.builder.name in get_compatible_builders(app):
tablist = SphinxTabsTablist()
tablist["role"] = "tablist"
tablist["aria-label"] = "Tabbed content"
Expand Down Expand Up @@ -187,7 +193,8 @@ def run(self):

self.state.nested_parse(self.content[1:], self.content_offset, panel)

if self.env.app.builder.name not in get_compatible_builders(self.env.app):
app = _get_env_app(self.env)
if app.builder.name not in get_compatible_builders(app):
# Use base docutils classes
outer_node = nodes.container()
tab = nodes.container()
Expand Down
8 changes: 7 additions & 1 deletion tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pytest
import sphinx
from sphinx.application import Sphinx
from rinoh.resource import ResourceNotFound


@pytest.mark.sphinx(testroot="basic")
Expand Down Expand Up @@ -74,7 +75,12 @@ def test_custom_lexer(app, check_asset_links):
def test_rinohtype_pdf(
app, status, warning, check_build_success, get_sphinx_app_doctree
):
app.build()
try:
app.build()
except ResourceNotFound as err:
if "Tex Gyre Heros" in str(err):
pytest.skip("Tex Gyre Heros typeface is not available in this environment")
raise
check_build_success(status, warning)
get_sphinx_app_doctree(app, regress=True)
# Doesn't currently regression test pdf output
Expand Down
Loading