summaryrefslogtreecommitdiff
path: root/sphinx/cmd/quickstart.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-09-22 21:53:00 +0900
committerGitHub <noreply@github.com>2018-09-22 21:53:00 +0900
commit0e882d1587680c1f78258688599dbb90df4a7a60 (patch)
treee6dba4193caab6649b4cc142fb17ad6fabed8382 /sphinx/cmd/quickstart.py
parent02fea029bfc5bfd64e43de9e810aef2dd3c8cb2c (diff)
parent6c1a696fe8e5c178d1dc5b4f5662eefc1fc65685 (diff)
downloadsphinx-git-0e882d1587680c1f78258688599dbb90df4a7a60.tar.gz
Merge branch 'master' into open
Diffstat (limited to 'sphinx/cmd/quickstart.py')
-rw-r--r--sphinx/cmd/quickstart.py29
1 files changed, 8 insertions, 21 deletions
diff --git a/sphinx/cmd/quickstart.py b/sphinx/cmd/quickstart.py
index 51285efa5..dbc2f4a52 100644
--- a/sphinx/cmd/quickstart.py
+++ b/sphinx/cmd/quickstart.py
@@ -17,6 +17,7 @@ import os
import re
import sys
import time
+import warnings
from collections import OrderedDict
from os import path
@@ -33,12 +34,13 @@ except ImportError:
USE_LIBEDIT = False
from docutils.utils import column_width
-from six import PY2, PY3, text_type, binary_type
+from six import text_type, binary_type
from six.moves import input
from six.moves.urllib.parse import quote as urlquote
import sphinx.locale
from sphinx import __display_version__, package_dir
+from sphinx.deprecation import RemovedInSphinx40Warning
from sphinx.locale import __
from sphinx.util import texescape
from sphinx.util.console import ( # type: ignore
@@ -184,20 +186,6 @@ def do_prompt(text, default=None, validator=nonempty):
prompt = PROMPT_PREFIX + '%s [%s]: ' % (text, default) # type: unicode
else:
prompt = PROMPT_PREFIX + text + ': '
- if PY2:
- # for Python 2.x, try to get a Unicode string out of it
- if prompt.encode('ascii', 'replace').decode('ascii', 'replace') \
- != prompt:
- if TERM_ENCODING:
- prompt = prompt.encode(TERM_ENCODING)
- else:
- print(turquoise(__('* Note: non-ASCII default value provided '
- 'and terminal encoding unknown -- assuming '
- 'UTF-8 or Latin-1.')))
- try:
- prompt = prompt.encode('utf-8')
- except UnicodeEncodeError:
- prompt = prompt.encode('latin1')
if USE_LIBEDIT:
# Note: libedit has a problem for combination of ``input()`` and escape
# sequence (see #5335). To avoid the problem, all prompts are not colored
@@ -221,10 +209,9 @@ def do_prompt(text, default=None, validator=nonempty):
def convert_python_source(source, rex=re.compile(r"[uU]('.*?')")):
# type: (unicode, Pattern) -> unicode
# remove Unicode literal prefixes
- if PY3:
- return rex.sub('\\1', source)
- else:
- return source
+ warnings.warn('convert_python_source() is deprecated.',
+ RemovedInSphinx40Warning)
+ return rex.sub('\\1', source)
class QuickstartRenderer(SphinxRenderer):
@@ -398,7 +385,7 @@ def generate(d, overwrite=True, silent=False, templatedir=None):
if 'mastertocmaxdepth' not in d:
d['mastertocmaxdepth'] = 2
- d['PY3'] = PY3
+ d['PY3'] = True
d['project_fn'] = make_filename(d['project'])
d['project_url'] = urlquote(d['project'].encode('idna'))
d['project_manpage'] = d['project_fn'].lower()
@@ -454,7 +441,7 @@ def generate(d, overwrite=True, silent=False, templatedir=None):
if not conf_path or not path.isfile(conf_path):
conf_path = os.path.join(package_dir, 'templates', 'quickstart', 'conf.py_t')
with open(conf_path) as f:
- conf_text = convert_python_source(f.read())
+ conf_text = f.read()
write_file(path.join(srcdir, 'conf.py'), template.render_string(conf_text, d))