# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1482173407 -19800 # Node ID 10b17ed9b591ec1908126f2675a6adbb5a33efb1 # Parent 3fcaf0f660cead2e3313947a1147ebb4df545bc4 py3: replace sys.executable with pycompat.sysexecutable sys.executable returns unicodes on Python 3. This patch replaces occurences of sys.executable with pycompat.sysexecutable. diff -r 3fcaf0f660ce -r 10b17ed9b591 mercurial/chgserver.py --- a/mercurial/chgserver.py Tue Dec 20 00:02:24 2016 +0530 +++ b/mercurial/chgserver.py Tue Dec 20 00:20:07 2016 +0530 @@ -47,7 +47,6 @@ import re import signal import struct -import sys import time from .i18n import _ @@ -59,6 +58,7 @@ error, extensions, osutil, + pycompat, util, ) @@ -122,7 +122,7 @@ modules.append(__version__) except ImportError: pass - files = [sys.executable] + files = [pycompat.sysexecutable] for m in modules: try: files.append(inspect.getabsfile(m)) diff -r 3fcaf0f660ce -r 10b17ed9b591 mercurial/commands.py --- a/mercurial/commands.py Tue Dec 20 00:02:24 2016 +0530 +++ b/mercurial/commands.py Tue Dec 20 00:20:07 2016 +0530 @@ -1889,7 +1889,7 @@ # Python fm.write('pythonexe', _("checking Python executable (%s)\n"), - sys.executable) + pycompat.sysexecutable) fm.write('pythonver', _("checking Python version (%s)\n"), ("%d.%d.%d" % sys.version_info[:3])) fm.write('pythonlib', _("checking Python lib (%s)...\n"), diff -r 3fcaf0f660ce -r 10b17ed9b591 mercurial/i18n.py --- a/mercurial/i18n.py Tue Dec 20 00:02:24 2016 +0530 +++ b/mercurial/i18n.py Tue Dec 20 00:20:07 2016 +0530 @@ -19,7 +19,7 @@ # modelled after templater.templatepath: if getattr(sys, 'frozen', None) is not None: - module = sys.executable + module = pycompat.sysexecutable else: module = __file__ diff -r 3fcaf0f660ce -r 10b17ed9b591 mercurial/sslutil.py --- a/mercurial/sslutil.py Tue Dec 20 00:02:24 2016 +0530 +++ b/mercurial/sslutil.py Tue Dec 20 00:20:07 2016 +0530 @@ -669,9 +669,9 @@ cacerts file """ if (pycompat.sysplatform != 'darwin' or - util.mainfrozen() or not sys.executable): + util.mainfrozen() or not pycompat.sysexecutable): return False - exe = os.path.realpath(sys.executable).lower() + exe = os.path.realpath(pycompat.sysexecutable).lower() return (exe.startswith('/usr/bin/python') or exe.startswith('/system/library/frameworks/python.framework/')) diff -r 3fcaf0f660ce -r 10b17ed9b591 mercurial/util.py --- a/mercurial/util.py Tue Dec 20 00:02:24 2016 +0530 +++ b/mercurial/util.py Tue Dec 20 00:20:07 2016 +0530 @@ -931,7 +931,7 @@ # the location of data files matching the source code if mainfrozen() and getattr(sys, 'frozen', None) != 'macosx_app': # executable version (py2exe) doesn't support __file__ - datapath = os.path.dirname(sys.executable) + datapath = os.path.dirname(pycompat.sysexecutable) else: datapath = os.path.dirname(__file__) @@ -957,7 +957,7 @@ # Env variable set by py2app _sethgexecutable(encoding.environ['EXECUTABLEPATH']) else: - _sethgexecutable(sys.executable) + _sethgexecutable(pycompat.sysexecutable) elif os.path.basename(getattr(mainmod, '__file__', '')) == 'hg': _sethgexecutable(mainmod.__file__) else: @@ -2299,7 +2299,7 @@ # Env variable set by py2app return [encoding.environ['EXECUTABLEPATH']] else: - return [sys.executable] + return [pycompat.sysexecutable] return gethgcmd() def rundetached(args, condfn):