mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
When Sphinx couldn't decode multibyte filename, now Sphinx notices UnicodeError and continuing if possible instead of raise exception. Closes #703
This commit is contained in:
parent
445bb5daec
commit
58be2f19b3
2
CHANGES
2
CHANGES
@ -18,6 +18,8 @@ Bugs fixed
|
||||
named target.
|
||||
* A wrong conditoin check break search feature on first page that is usually
|
||||
index.rst. This issue was introduced at 1.2b1
|
||||
* #703: When Sphinx couldn't decode multibyte filename, now Sphinx notices
|
||||
UnicodeError and continuing if possible instead of raise exception.
|
||||
|
||||
|
||||
Release 1.2 beta2 (released Sep 17, 2013)
|
||||
|
@ -22,7 +22,7 @@ from sphinx.errors import SphinxError
|
||||
from sphinx.application import Sphinx
|
||||
from sphinx.util import Tee, format_exception_cut_frames, save_traceback
|
||||
from sphinx.util.console import red, nocolor, color_terminal
|
||||
from sphinx.util.osutil import abspath
|
||||
from sphinx.util.osutil import abspath, fs_encoding
|
||||
from sphinx.util.pycompat import terminal_safe, bytes
|
||||
|
||||
|
||||
@ -112,6 +112,11 @@ def main(argv):
|
||||
except IndexError:
|
||||
usage(argv, 'Error: Insufficient arguments.')
|
||||
return 1
|
||||
except UnicodeError:
|
||||
print >>sys.stderr, (
|
||||
'Error: Multibyte filename did not support on this filesystem '
|
||||
'encoding: %s' % fs_encoding)
|
||||
return 1
|
||||
|
||||
filenames = args[2:]
|
||||
err = 0
|
||||
|
@ -77,7 +77,14 @@ def walk(top, topdown=True, followlinks=False):
|
||||
|
||||
dirs, nondirs = [], []
|
||||
for name in names:
|
||||
if path.isdir(path.join(top, name)):
|
||||
try:
|
||||
fullpath = path.join(top, name)
|
||||
except UnicodeError:
|
||||
print >>sys.stderr, (
|
||||
'%s:: ERROR: multibyte filename did not support on this filesystem '
|
||||
'encoding %r, skipped.' % (name, fs_encoding))
|
||||
continue
|
||||
if path.isdir(fullpath):
|
||||
dirs.append(name)
|
||||
else:
|
||||
nondirs.append(name)
|
||||
|
@ -9,7 +9,7 @@
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
from util import with_app, test_root, path
|
||||
from util import with_app, test_root, path, SkipTest
|
||||
from textwrap import dedent
|
||||
|
||||
|
||||
@ -76,7 +76,14 @@ def test_pseudoxml(app):
|
||||
def test_multibyte_path(app):
|
||||
srcdir = path(app.srcdir)
|
||||
mb_name = u'\u65e5\u672c\u8a9e'
|
||||
try:
|
||||
(srcdir / mb_name).makedirs()
|
||||
except UnicodeEncodeError:
|
||||
from path import FILESYSTEMENCODING
|
||||
raise SkipTest(
|
||||
'multibyte filename did not support on this filesystem encoding: '
|
||||
'%s', FILESYSTEMENCODING)
|
||||
|
||||
(srcdir / mb_name / (mb_name + '.txt')).write_text(dedent("""
|
||||
multi byte file name page
|
||||
==========================
|
||||
|
@ -14,7 +14,7 @@ import time
|
||||
from StringIO import StringIO
|
||||
import tempfile
|
||||
|
||||
from util import raises, with_tempdir, with_app
|
||||
from util import raises, with_tempdir, with_app, SkipTest
|
||||
|
||||
from sphinx import application
|
||||
from sphinx import quickstart as qs
|
||||
@ -114,7 +114,12 @@ def test_do_prompt_with_multibyte():
|
||||
'Q1': u'\u30c9\u30a4\u30c4',
|
||||
}
|
||||
qs.term_input = mock_raw_input(answers)
|
||||
try:
|
||||
qs.do_prompt(d, 'k1', 'Q1', default=u'\u65e5\u672c')
|
||||
except UnicodeEncodeError:
|
||||
raise SkipTest(
|
||||
'multibyte console input did not support on this encoding: %s',
|
||||
qs.TERM_ENCODING)
|
||||
assert d['k1'] == u'\u30c9\u30a4\u30c4'
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ import subprocess
|
||||
from functools import wraps
|
||||
import tempfile
|
||||
|
||||
from util import with_tempdir, test_roots
|
||||
from util import with_tempdir, test_roots, SkipTest
|
||||
from path import path
|
||||
from textwrap import dedent
|
||||
|
||||
@ -62,7 +62,14 @@ def test_build_sphinx(pkgroot, proc):
|
||||
def test_build_sphinx_with_multibyte_path(pkgroot, proc):
|
||||
mb_name = u'\u65e5\u672c\u8a9e'
|
||||
srcdir = (pkgroot / 'doc')
|
||||
try:
|
||||
(srcdir / mb_name).makedirs()
|
||||
except UnicodeEncodeError:
|
||||
from path import FILESYSTEMENCODING
|
||||
raise SkipTest(
|
||||
'multibyte filename did not support on this filesystem encoding: '
|
||||
'%s', FILESYSTEMENCODING)
|
||||
|
||||
(srcdir / mb_name / (mb_name + '.txt')).write_text(dedent("""
|
||||
multi byte file name page
|
||||
==========================
|
||||
|
Loading…
Reference in New Issue
Block a user