mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
The arguments of EpubBuilder.build_mimetype() is deprecated
This commit is contained in:
parent
90b93dda33
commit
0f972e8bbf
1
CHANGES
1
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
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user