Emergency fix for py3 breakage introduced in 576f6f (merge of #1538)

Unicode literals (u'foo') aren't valid in Python 3.{1,2} (they will be
again in 3.3, and I failed to notice this.  This is a quick fix, will
discuss further on-list.  But I want master to remain working for py3
users.
Fernando Perez 14 years ago
parent 4b73021647
commit ffe488ee0b

@ -45,6 +45,9 @@ def oscmd(s):
print(">", s)
os.system(s)
# Py3 compatibility hacks, without assuming IPython itself is installed with
# the full py3compat machinery.
try:
execfile
except NameError:
@ -52,6 +55,11 @@ except NameError:
locs = locs or globs
exec(compile(open(fname).read(), fname, "exec"), globs, locs)
try:
unicode
except NameError:
unicode = str
# A little utility we'll need below, since glob() does NOT allow you to do
# exclusion on multiple endings!
def file_doesnt_endwith(test,endings):
@ -389,8 +397,8 @@ def record_commit_info(pkg_dir, build_cmd=build_py):
# We write the installation commit even if it's empty
out_pth = pjoin(self.build_lib, pkg_dir, 'utils', '_sysinfo.py')
with io.open(out_pth, 'w') as out_file:
out_file.writelines([
u"# GENERATED BY setup.py\n",
u"commit = '%s'\n" % repo_commit,
])
out_file.writelines(map(unicode, [
'# GENERATED BY setup.py\n',
'commit = "%s"\n' % repo_commit,
]))
return MyBuildPy

Loading…
Cancel
Save