diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -610,7 +610,7 @@ class buildhgexe(build_ext): if filelen > 0 and filelen != size: dllbasename = os.path.basename(buf.value) - if not dllbasename.lower().endswith('.dll'): + if not dllbasename.lower().endswith(b'.dll'): raise SystemExit('Python DLL does not end with .dll: %s' % dllbasename) pythonlib = dllbasename[:-4] @@ -623,8 +623,8 @@ class buildhgexe(build_ext): log.info('using %s as Python library name' % pythonlib) with open('mercurial/hgpythonlib.h', 'wb') as f: - f.write('/* this file is autogenerated by setup.py */\n') - f.write('#define HGPYTHONLIB "%s"\n' % pythonlib) + f.write(b'/* this file is autogenerated by setup.py */\n') + f.write(b'#define HGPYTHONLIB "%s"\n' % pythonlib) objects = self.compiler.compile(['mercurial/exewrapper.c'], output_dir=self.build_temp) dir = os.path.dirname(self.get_ext_fullpath('dummy')) @@ -1000,7 +1000,7 @@ if py2exeloaded: if os.name == 'nt': # Windows binary file versions for exe/dll files must have the # form W.X.Y.Z, where W,X,Y,Z are numbers in the range 0..65535 - setupversion = version.split('+', 1)[0] + setupversion = version.split(b'+', 1)[0] if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'): version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[1].splitlines()