Commits

Anonymous committed 1e91160

Fix SyntaxError in config generated by quickstart and the quickstart test

Comments (0)

Files changed (2)

sphinx/quickstart.py

     :license: BSD, see LICENSE for details.
 """
 
-import sys, os, time
+import sys, os, time, re
 from os import path
 from codecs import open
 
     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()

tests/test_quickstart.py

         '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',