mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #3221: Deprecate EPUB2 builder
This commit is contained in:
parent
8a98a1ad3d
commit
622ca9795f
1
CHANGES
1
CHANGES
@ -138,6 +138,7 @@ Deprecated
|
||||
* #3429: deprecate config setting ``latex_keep_old_macro_names``. It will be
|
||||
removed at 1.7, and already its default value has changed from ``True`` to
|
||||
``False``.
|
||||
* #3221: epub2 builder is deprecated
|
||||
|
||||
Release 1.5.4 (in development)
|
||||
==============================
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
import os
|
||||
import re
|
||||
import warnings
|
||||
from os import path
|
||||
from zipfile import ZIP_DEFLATED, ZIP_STORED, ZipFile
|
||||
from datetime import datetime
|
||||
@ -30,6 +31,7 @@ from docutils import nodes
|
||||
from sphinx import addnodes
|
||||
from sphinx import package_dir
|
||||
from sphinx.builders.html import StandaloneHTMLBuilder
|
||||
from sphinx.deprecation import RemovedInSphinx17Warning
|
||||
from sphinx.util import logging
|
||||
from sphinx.util import status_iterator
|
||||
from sphinx.util.osutil import ensuredir, copyfile, make_filename
|
||||
@ -713,10 +715,18 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
||||
epub.write(path.join(outdir, filename), filename, ZIP_DEFLATED) # type: ignore
|
||||
|
||||
|
||||
def emit_deprecation_warning(app):
|
||||
# type: (Sphinx) -> None
|
||||
if app.builder.__class__ is EpubBuilder:
|
||||
warnings.warn('epub2 builder is deprecated. Please use epub3 builder instead.',
|
||||
RemovedInSphinx17Warning)
|
||||
|
||||
|
||||
def setup(app):
|
||||
# type: (Sphinx) -> Dict[unicode, Any]
|
||||
app.setup_extension('sphinx.builders.html')
|
||||
app.add_builder(EpubBuilder)
|
||||
app.connect('builder-inited', emit_deprecation_warning)
|
||||
|
||||
# config values
|
||||
app.add_config_value('epub_basename', lambda self: make_filename(self.project), None)
|
||||
|
Loading…
Reference in New Issue
Block a user