From b8753bb03cebb9a1da0ca8da6a9578a8e89ce200 Mon Sep 17 00:00:00 2001 From: Adrian Vollmer Date: Tue, 11 Oct 2022 18:28:58 +0200 Subject: [PATCH] Improve version dependent code --- zundler/sphinxext/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zundler/sphinxext/__init__.py b/zundler/sphinxext/__init__.py index bb6bff6..6706eb2 100644 --- a/zundler/sphinxext/__init__.py +++ b/zundler/sphinxext/__init__.py @@ -1,6 +1,7 @@ import os from pathlib import Path +from sphinx import version_info as sphinx_version_info from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.locale import get_translation from sphinx.util import logging, progress_message @@ -16,10 +17,9 @@ class ZundlerBuilder(StandaloneHTMLBuilder): epilog = "" def __init__(self, app, env=None): - try: + if sphinx_version_info[0] >= 5: super().__init__(app, env) - except TypeError: - # Sphinx<=4 expects only `app` + else: super().__init__(app) self.epilog = (