# HG changeset patch # User Matt Harbison # Date 1536856652 14400 # Node ID ec68135a89352a20f1f05d86084c51bdb4969efe # Parent 5362c96f2febdd938577e3b42b69ced19b17aee9 py3: add b'' to some setup.py strings for Windows These were things found trying to do `make PYTHON="py -3" local`. The following is dumped out, before dying while compiling the C extensions: C:\Program Files\Python37\lib\site-packages\setuptools\dist.py:406: UserWarning: The version specified (b'4.7.1') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details. "details." % self.metadata.version running build_py byte-compiling .\mercurial\thirdparty\concurrent\futures\_base.py to _base.cpython-37.pyc File "mercurial\thirdparty\concurrent\futures\_base.py", line 416 raise exception_type, self._exception, self._traceback ^ SyntaxError: invalid syntax # skip-blame since these are just converting to bytes literals diff -r 5362c96f2feb -r ec68135a8935 setup.py --- a/setup.py Thu Sep 13 18:09:22 2018 -0400 +++ b/setup.py Thu Sep 13 12:37:32 2018 -0400 @@ -610,7 +610,7 @@ 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 @@ 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 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()