mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Merge pull request #1594 from takluyver/setupbase-py3
Fix writing git commit ID to a file on build with Python 3 use builtin open / str literals instead of io.open & unicode.
This commit is contained in:
commit
ee9cbf39cb
14
setupbase.py
14
setupbase.py
@ -20,7 +20,6 @@ from __future__ import print_function
|
|||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Imports
|
# Imports
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
import io
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -55,11 +54,6 @@ except NameError:
|
|||||||
locs = locs or globs
|
locs = locs or globs
|
||||||
exec(compile(open(fname).read(), fname, "exec"), globs, locs)
|
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
|
# A little utility we'll need below, since glob() does NOT allow you to do
|
||||||
# exclusion on multiple endings!
|
# exclusion on multiple endings!
|
||||||
def file_doesnt_endwith(test,endings):
|
def file_doesnt_endwith(test,endings):
|
||||||
@ -396,9 +390,9 @@ def record_commit_info(pkg_dir, build_cmd=build_py):
|
|||||||
repo_commit = repo_commit.strip()
|
repo_commit = repo_commit.strip()
|
||||||
# We write the installation commit even if it's empty
|
# We write the installation commit even if it's empty
|
||||||
out_pth = pjoin(self.build_lib, pkg_dir, 'utils', '_sysinfo.py')
|
out_pth = pjoin(self.build_lib, pkg_dir, 'utils', '_sysinfo.py')
|
||||||
with io.open(out_pth, 'w') as out_file:
|
with open(out_pth, 'w') as out_file:
|
||||||
out_file.writelines(map(unicode, [
|
out_file.writelines([
|
||||||
'# GENERATED BY setup.py\n',
|
'# GENERATED BY setup.py\n',
|
||||||
'commit = "%s"\n' % repo_commit,
|
'commit = "%s"\n' % repo_commit.decode('ascii'),
|
||||||
]))
|
])
|
||||||
return MyBuildPy
|
return MyBuildPy
|
||||||
|
Loading…
Reference in New Issue
Block a user