diff --git a/CHANGES b/CHANGES index 5e9d28cb6..05696fa37 100644 --- a/CHANGES +++ b/CHANGES @@ -58,6 +58,7 @@ 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()`` * 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 0dcd9a787..de2cbc1a0 100644 --- a/doc/extdev/index.rst +++ b/doc/extdev/index.rst @@ -242,6 +242,11 @@ The following is a list of deprecated interfaces. - 4.0 - N/A + * - arguments of ``EpubBuilder.build_mimetype()`` + - 2.0 + - 4.0 + - N/A + * - ``nodetype`` argument of ``sphinx.search.WordCollector.is_meta_keywords()`` - 2.0 diff --git a/sphinx/builders/_epub_base.py b/sphinx/builders/_epub_base.py index f07fef21d..f20084d23 100644 --- a/sphinx/builders/_epub_base.py +++ b/sphinx/builders/_epub_base.py @@ -10,6 +10,7 @@ import os import re +import warnings from collections import namedtuple from os import path from zipfile import ZIP_DEFLATED, ZIP_STORED, ZipFile @@ -19,6 +20,7 @@ from docutils.utils import smartquotes from sphinx import addnodes from sphinx.builders.html import BuildInfo, StandaloneHTMLBuilder +from sphinx.deprecation import RemovedInSphinx40Warning from sphinx.locale import __ from sphinx.util import logging from sphinx.util import status_iterator @@ -470,9 +472,15 @@ class EpubBuilder(StandaloneHTMLBuilder): addctx['doctype'] = self.doctype super().handle_page(pagename, addctx, templatename, outfilename, event_arg) - def build_mimetype(self, outdir, outname): + def build_mimetype(self, outdir=None, outname='mimetype'): # type: (str, str) -> None """Write the metainfo file mimetype.""" + if outdir: + warnings.warn('The arguments of EpubBuilder.build_mimetype() is deprecated.', + RemovedInSphinx40Warning, stacklevel=2) + else: + outdir = self.outdir + logger.info(__('writing %s file...'), outname) copy_asset_file(path.join(self.template_dir, 'mimetype'), path.join(outdir, outname)) diff --git a/sphinx/builders/epub3.py b/sphinx/builders/epub3.py index 88f93e90f..a20009017 100644 --- a/sphinx/builders/epub3.py +++ b/sphinx/builders/epub3.py @@ -78,7 +78,7 @@ class Epub3Builder(_epub_base.EpubBuilder): """Create the metainfo files and finally the epub.""" self.validate_config_value() self.get_toc() - self.build_mimetype(self.outdir, 'mimetype') + self.build_mimetype() self.build_container(self.outdir, 'META-INF/container.xml') self.build_content(self.outdir, 'content.opf') self.build_navigation_doc(self.outdir, 'nav.xhtml')