Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 78203e0

Browse files
takluyverminrk
authored andcommitted
Fix writing git commit ID to a file on build with Python 3.
1 parent c5987c0 commit 78203e0

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

setupbase.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#-------------------------------------------------------------------------------
2121
# Imports
2222
#-------------------------------------------------------------------------------
23-
import io
2423
import os
2524
import sys
2625

@@ -55,11 +54,6 @@ def execfile(fname, globs, locs=None):
5554
locs = locs or globs
5655
exec(compile(open(fname).read(), fname, "exec"), globs, locs)
5756

58-
try:
59-
unicode
60-
except NameError:
61-
unicode = str
62-
6357
# A little utility we'll need below, since glob() does NOT allow you to do
6458
# exclusion on multiple endings!
6559
def file_doesnt_endwith(test,endings):
@@ -358,9 +352,9 @@ def run(self):
358352
repo_commit = repo_commit.strip()
359353
# We write the installation commit even if it's empty
360354
out_pth = pjoin(self.build_lib, pkg_dir, 'utils', '_sysinfo.py')
361-
with io.open(out_pth, 'w') as out_file:
362-
out_file.writelines(map(unicode, [
355+
with open(out_pth, 'w') as out_file:
356+
out_file.writelines([
363357
'# GENERATED BY setup.py\n',
364-
'commit = "%s"\n' % repo_commit,
365-
]))
358+
'commit = "%s"\n' % repo_commit.decode('ascii'),
359+
])
366360
return MyBuildPy

0 commit comments

Comments
 (0)