diff --git a/CHANGES b/CHANGES index 3b292d864..487897120 100644 --- a/CHANGES +++ b/CHANGES @@ -59,7 +59,8 @@ Deprecated * Support for evaluating Python 2 syntax is deprecated. This includes configuration files which should be converted to Python 3. * The arguments of ``EpubBuilder.build_mimetype()``, - ``EpubBuilder.build_container()``, ``EpubBuilder.bulid_content()`` + ``EpubBuilder.build_container()``, ``EpubBuilder.bulid_content()``, + ``EpubBuilder.build_toc()`` * The ``encoding`` argument of ``autodoc.Documenter.get_doc()``, ``autodoc.DocstringSignatureMixin.get_doc()``, ``autodoc.DocstringSignatureMixin._find_signature()``, and diff --git a/doc/extdev/index.rst b/doc/extdev/index.rst index 192898472..b24fb6f87 100644 --- a/doc/extdev/index.rst +++ b/doc/extdev/index.rst @@ -243,7 +243,8 @@ The following is a list of deprecated interfaces. - N/A * - arguments of ``EpubBuilder.build_mimetype()``, - ``EpubBuilder.build_container()``, ``EpubBuilder.build_content()`` + ``EpubBuilder.build_container()``, ``EpubBuilder.build_content()``, + ``EpubBuilder.build_toc()`` - 2.0 - 4.0 - N/A diff --git a/sphinx/builders/_epub_base.py b/sphinx/builders/_epub_base.py index d494a86e1..3b99bf438 100644 --- a/sphinx/builders/_epub_base.py +++ b/sphinx/builders/_epub_base.py @@ -706,9 +706,15 @@ class EpubBuilder(StandaloneHTMLBuilder): metadata['navpoints'] = navpoints return metadata - def build_toc(self, outdir, outname): + def build_toc(self, outdir=None, outname='toc.ncx'): # type: (str, str) -> None """Write the metainfo file toc.ncx.""" + if outdir: + warnings.warn('The arguments of EpubBuilder.build_toc() is deprecated.', + RemovedInSphinx40Warning, stacklevel=2) + else: + outdir = self.outdir + logger.info(__('writing %s file...'), outname) if self.config.epub_tocscope == 'default': diff --git a/sphinx/builders/epub3.py b/sphinx/builders/epub3.py index 4937728a0..6b770bb5c 100644 --- a/sphinx/builders/epub3.py +++ b/sphinx/builders/epub3.py @@ -82,7 +82,7 @@ class Epub3Builder(_epub_base.EpubBuilder): self.build_container() self.build_content() self.build_navigation_doc(self.outdir, 'nav.xhtml') - self.build_toc(self.outdir, 'toc.ncx') + self.build_toc() self.build_epub(self.outdir, self.config.epub_basename + '.epub') def validate_config_value(self):