summaryrefslogtreecommitdiff
path: root/sphinx/builders/latex
diff options
context:
space:
mode:
authorAdam Turner <9087854+AA-Turner@users.noreply.github.com>2022-04-22 02:53:25 +0100
committerAdam Turner <9087854+AA-Turner@users.noreply.github.com>2022-04-22 04:21:38 +0100
commita8827f3329fc47064a6542825c8248cc5dc6b8ba (patch)
treeb407a33c3f236edd9da9d525d2d2673fc11df770 /sphinx/builders/latex
parent55669f6cfc03e96cee236dc9b9cdeb1deb31cef0 (diff)
downloadsphinx-git-a8827f3329fc47064a6542825c8248cc5dc6b8ba.tar.gz
Catch `DeprecationWarning` for `docutils.frontend.OptionParser`
Diffstat (limited to 'sphinx/builders/latex')
-rw-r--r--sphinx/builders/latex/__init__.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/sphinx/builders/latex/__init__.py b/sphinx/builders/latex/__init__.py
index d4fc66177..f1611ca80 100644
--- a/sphinx/builders/latex/__init__.py
+++ b/sphinx/builders/latex/__init__.py
@@ -1,6 +1,7 @@
"""LaTeX builder."""
import os
+import warnings
from os import path
from typing import Any, Dict, Iterable, List, Tuple, Union
@@ -250,10 +251,14 @@ class LaTeXBuilder(Builder):
def write(self, *ignored: Any) -> None:
docwriter = LaTeXWriter(self)
- docsettings: Any = OptionParser(
- defaults=self.env.settings,
- components=(docwriter,),
- read_config_files=True).get_default_values()
+ with warnings.catch_warnings():
+ warnings.filterwarnings('ignore', category=DeprecationWarning)
+ # DeprecationWarning: The frontend.OptionParser class will be replaced
+ # by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
+ docsettings: Any = OptionParser(
+ defaults=self.env.settings,
+ components=(docwriter,),
+ read_config_files=True).get_default_values()
self.init_document_data()
self.write_stylesheet()