Fix SyntaxError in config generated by quickstart and the quickstart test

This commit is contained in:
Daniel Neuhäuser 2010-05-28 04:08:15 +02:00
parent c967651712
commit 625127fd63
2 changed files with 15 additions and 3 deletions

View File

@ -9,7 +9,7 @@
:license: BSD, see LICENSE for details.
"""
import sys, os, time
import sys, os, time, re
from os import path
from codecs import open
@ -685,6 +685,18 @@ def do_prompt(d, key, text, default=None, validator=nonempty):
d[key] = x
if sys.version_info >= (3, 0):
# remove Unicode literal prefixes
_unicode_string_re = re.compile(r"[uU]('.*?')")
def _convert_python_source(source):
return _unicode_string_re.sub('\\1', source)
for f in ['QUICKSTART_CONF', 'EPUB_CONFIG', 'INTERSPHINX_CONFIG']:
globals()[f] = convert_python_source(globals()[f])
del _unicode_string_re, _convert_python_source
def inner_main(args):
d = {}
texescape.init()

View File

@ -117,8 +117,8 @@ def test_quickstart_all_answers(tempdir):
'Root path': tempdir,
'Separate source and build': 'y',
'Name prefix for templates': '.',
'Project name': 'STASI\xe2\x84\xa2',
'Author name': 'Wolfgang Sch\xc3\xa4uble & G\'Beckstein',
'Project name': u'STASI™'.encode('utf-8'),
'Author name': u'Wolfgang Schäuble & G\'Beckstein'.encode('utf-8'),
'Project version': '2.0',
'Project release': '2.0.1',
'Source file suffix': '.txt',