Drop python 3.6 support (#10468)

This commit is contained in:
Takeshi KOMIYA
2022-06-17 03:33:55 +09:00
committed by GitHub
parent 0d2a989517
commit 7e68154e49
24 changed files with 201 additions and 414 deletions

View File

@@ -22,29 +22,23 @@ def nonascii_srcdir(request, rootdir, sphinx_test_tempdir):
# If supported, build in a non-ASCII source dir
test_name = '\u65e5\u672c\u8a9e'
basedir = sphinx_test_tempdir / request.node.originalname
try:
srcdir = basedir / test_name
if not srcdir.exists():
(rootdir / 'test-root').copytree(srcdir)
except UnicodeEncodeError:
# Now Python 3.7+ follows PEP-540 and uses utf-8 encoding for filesystem by default.
# So this error handling will be no longer used (after dropping python 3.6 support).
srcdir = basedir / 'all'
if not srcdir.exists():
(rootdir / 'test-root').copytree(srcdir)
else:
# add a doc with a non-ASCII file name to the source dir
(srcdir / (test_name + '.txt')).write_text(dedent("""
nonascii file name page
=======================
"""), encoding='utf8')
srcdir = basedir / test_name
if not srcdir.exists():
(rootdir / 'test-root').copytree(srcdir)
root_doc = srcdir / 'index.txt'
root_doc.write_text(root_doc.read_text(encoding='utf8') + dedent("""
.. toctree::
# add a doc with a non-ASCII file name to the source dir
(srcdir / (test_name + '.txt')).write_text(dedent("""
nonascii file name page
=======================
"""), encoding='utf8')
root_doc = srcdir / 'index.txt'
root_doc.write_text(root_doc.read_text(encoding='utf8') + dedent("""
.. toctree::
%(test_name)s/%(test_name)s
""" % {'test_name': test_name}), encoding='utf8')
%(test_name)s/%(test_name)s
""" % {'test_name': test_name}), encoding='utf8')
return srcdir