Deprecate sphinx.util.pycompat:sys_encoding

This commit is contained in:
Takeshi KOMIYA
2019-02-11 16:41:19 +09:00
parent b25deb259e
commit 2efc1065c0
4 changed files with 10 additions and 8 deletions
+1
View File
@@ -125,6 +125,7 @@ Deprecated
* ``sphinx.util.pycompat.UnicodeMixin`` * ``sphinx.util.pycompat.UnicodeMixin``
* ``sphinx.util.pycompat.htmlescape`` * ``sphinx.util.pycompat.htmlescape``
* ``sphinx.util.pycompat.indent`` * ``sphinx.util.pycompat.indent``
* ``sphinx.util.pycompat.sys_encoding``
* ``sphinx.util.pycompat.terminal_safe()`` * ``sphinx.util.pycompat.terminal_safe()``
* ``sphinx.util.pycompat.u`` * ``sphinx.util.pycompat.u``
* ``sphinx.writers.latex.ExtBabel`` * ``sphinx.writers.latex.ExtBabel``
+5
View File
@@ -445,6 +445,11 @@ The following is a list of deprecated interfaces.
- 4.0 - 4.0
- ``textwrap.indent()`` - ``textwrap.indent()``
* - ``sphinx.util.pycompat.sys_encoding``
- 2.0
- 4.0
- ``sys.getdefaultencoding()``
* - ``sphinx.util.pycompat.terminal_safe()`` * - ``sphinx.util.pycompat.terminal_safe()``
- 2.0 - 2.0
- 4.0 - 4.0
+3 -3
View File
@@ -12,6 +12,7 @@ import posixpath
import re import re
import shutil import shutil
import subprocess import subprocess
import sys
import tempfile import tempfile
from hashlib import sha1 from hashlib import sha1
from os import path from os import path
@@ -26,7 +27,6 @@ from sphinx.util import logging
from sphinx.util.math import get_node_equation_number, wrap_displaymath from sphinx.util.math import get_node_equation_number, wrap_displaymath
from sphinx.util.osutil import ensuredir from sphinx.util.osutil import ensuredir
from sphinx.util.png import read_png_depth, write_png_depth from sphinx.util.png import read_png_depth, write_png_depth
from sphinx.util.pycompat import sys_encoding
if False: if False:
# For type annotation # For type annotation
@@ -46,9 +46,9 @@ class MathExtError(SphinxError):
def __init__(self, msg, stderr=None, stdout=None): def __init__(self, msg, stderr=None, stdout=None):
# type: (str, bytes, bytes) -> None # type: (str, bytes, bytes) -> None
if stderr: if stderr:
msg += '\n[stderr]\n' + stderr.decode(sys_encoding, 'replace') msg += '\n[stderr]\n' + stderr.decode(sys.getdefaultencoding(), 'replace')
if stdout: if stdout:
msg += '\n[stdout]\n' + stdout.decode(sys_encoding, 'replace') msg += '\n[stdout]\n' + stdout.decode(sys.getdefaultencoding(), 'replace')
super().__init__(msg) super().__init__(msg)
+1 -5
View File
@@ -31,11 +31,6 @@ logger = logging.getLogger(__name__)
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Python 2/3 compatibility # Python 2/3 compatibility
# sys_encoding: some kind of default system encoding; should be used with
# a lenient error handler
sys_encoding = sys.getdefaultencoding()
# convert_with_2to3(): # convert_with_2to3():
# support for running 2to3 over config files # support for running 2to3 over config files
def convert_with_2to3(filepath): def convert_with_2to3(filepath):
@@ -98,6 +93,7 @@ deprecated_alias('sphinx.util.pycompat',
'htmlescape': html.escape, 'htmlescape': html.escape,
'indent': textwrap.indent, 'indent': textwrap.indent,
'terminal_safe': terminal_safe, 'terminal_safe': terminal_safe,
'sys_encoding': sys.getdefaultencoding(),
'u': '', 'u': '',
}, },
RemovedInSphinx40Warning) RemovedInSphinx40Warning)