mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #8528 from jdufresne/drop-workaround
Drop outdated workaround for distutils' Command._ensure_stringlike()
This commit is contained in:
commit
8823d1c528
@ -14,7 +14,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from distutils.cmd import Command
|
from distutils.cmd import Command
|
||||||
from distutils.errors import DistutilsExecError, DistutilsOptionError
|
from distutils.errors import DistutilsExecError
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
from sphinx.application import Sphinx
|
from sphinx.application import Sphinx
|
||||||
@ -121,20 +121,6 @@ class BuildDoc(Command):
|
|||||||
return root
|
return root
|
||||||
return os.curdir
|
return os.curdir
|
||||||
|
|
||||||
# Overriding distutils' Command._ensure_stringlike which doesn't support
|
|
||||||
# unicode, causing finalize_options to fail if invoked again. Workaround
|
|
||||||
# for https://bugs.python.org/issue19570
|
|
||||||
def _ensure_stringlike(self, option, what, default=None):
|
|
||||||
# type: (str, str, Any) -> Any
|
|
||||||
val = getattr(self, option)
|
|
||||||
if val is None:
|
|
||||||
setattr(self, option, default)
|
|
||||||
return default
|
|
||||||
elif not isinstance(val, str):
|
|
||||||
raise DistutilsOptionError("'%s' must be a %s (got `%s`)"
|
|
||||||
% (option, what, val))
|
|
||||||
return val
|
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.ensure_string_list('builder')
|
self.ensure_string_list('builder')
|
||||||
|
Loading…
Reference in New Issue
Block a user