diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py --- a/mercurial/chgserver.py +++ b/mercurial/chgserver.py @@ -47,7 +47,6 @@ import os import re import signal import struct -import sys import time from .i18n import _ @@ -59,6 +58,7 @@ from . import ( error, extensions, osutil, + pycompat, util, ) @@ -122,7 +122,7 @@ def _getmtimepaths(ui): modules.append(__version__) except ImportError: pass - files = [sys.executable] + files = [pycompat.sysexecutable] for m in modules: try: files.append(inspect.getabsfile(m)) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1889,7 +1889,7 @@ def debuginstall(ui, **opts): # 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 --git a/mercurial/i18n.py b/mercurial/i18n.py --- a/mercurial/i18n.py +++ b/mercurial/i18n.py @@ -19,7 +19,7 @@ from . import ( # modelled after templater.templatepath: if getattr(sys, 'frozen', None) is not None: - module = sys.executable + module = pycompat.sysexecutable else: module = __file__ diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py --- a/mercurial/sslutil.py +++ b/mercurial/sslutil.py @@ -669,9 +669,9 @@ def _plainapplepython(): 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 --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -931,7 +931,7 @@ def mainfrozen(): # 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 @@ def hgexecutable(): # 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 @@ def hgcmd(): # Env variable set by py2app return [encoding.environ['EXECUTABLEPATH']] else: - return [sys.executable] + return [pycompat.sysexecutable] return gethgcmd() def rundetached(args, condfn):