##// END OF EJS Templates
Fix writing git commit ID to a file on build with Python 3.
Thomas Kluyver -
Show More
@@ -20,7 +20,6 b' from __future__ import print_function'
20 #-------------------------------------------------------------------------------
20 #-------------------------------------------------------------------------------
21 # Imports
21 # Imports
22 #-------------------------------------------------------------------------------
22 #-------------------------------------------------------------------------------
23 import io
24 import os
23 import os
25 import sys
24 import sys
26
25
@@ -55,11 +54,6 b' except NameError:'
55 locs = locs or globs
54 locs = locs or globs
56 exec(compile(open(fname).read(), fname, "exec"), globs, locs)
55 exec(compile(open(fname).read(), fname, "exec"), globs, locs)
57
56
58 try:
59 unicode
60 except NameError:
61 unicode = str
62
63 # A little utility we'll need below, since glob() does NOT allow you to do
57 # A little utility we'll need below, since glob() does NOT allow you to do
64 # exclusion on multiple endings!
58 # exclusion on multiple endings!
65 def file_doesnt_endwith(test,endings):
59 def file_doesnt_endwith(test,endings):
@@ -396,9 +390,9 b' def record_commit_info(pkg_dir, build_cmd=build_py):'
396 repo_commit = repo_commit.strip()
390 repo_commit = repo_commit.strip()
397 # We write the installation commit even if it's empty
391 # We write the installation commit even if it's empty
398 out_pth = pjoin(self.build_lib, pkg_dir, 'utils', '_sysinfo.py')
392 out_pth = pjoin(self.build_lib, pkg_dir, 'utils', '_sysinfo.py')
399 with io.open(out_pth, 'w') as out_file:
393 with open(out_pth, 'w') as out_file:
400 out_file.writelines(map(unicode, [
394 out_file.writelines([
401 '# GENERATED BY setup.py\n',
395 '# GENERATED BY setup.py\n',
402 'commit = "%s"\n' % repo_commit,
396 'commit = "%s"\n' % repo_commit.decode('ascii'),
403 ]))
397 ])
404 return MyBuildPy
398 return MyBuildPy
General Comments 0
You need to be logged in to leave comments. Login now