Merge pull request #1282 from xonsh/ua

more unicode escapes in amagamate for anaconda
This commit is contained in:
Morten Enemark Lund 2016-06-18 23:11:28 +02:00 committed by GitHub
commit a4df81ca04

View file

@ -293,14 +293,14 @@ def write_amalgam(src, pkg):
"""Write out __amalgam__.py file"""
pkgdir = pkg.replace('.', os.sep)
fname = os.path.join(pkgdir, '__amalgam__.py')
with open(fname, 'w') as f:
with open(fname, 'w', encoding='utf-8', errors='surrogateescape') as f:
f.write(src)
def _init_name_lines(pkg):
pkgdir = pkg.replace('.', os.sep)
fname = os.path.join(pkgdir, '__init__.py')
with open(fname) as f:
with open(fname, encoding='utf-8', errors='surrogateescape') as f:
raw = f.read()
lines = raw.splitlines()
return fname, lines
@ -351,7 +351,7 @@ def rewrite_init(pkg, order, debug='DEBUG'):
lines[start+1] = s
lines = lines[:start+2] + lines[stop:]
init = '\n'.join(lines)
with open(fname, 'w') as f:
with open(fname, 'w', encoding='utf-8', errors='surrogateescape') as f:
f.write(init)