diff mercurial/util.py @ 30672:10b17ed9b591

py3: replace sys.executable with pycompat.sysexecutable sys.executable returns unicodes on Python 3. This patch replaces occurences of sys.executable with pycompat.sysexecutable.
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 20 Dec 2016 00:20:07 +0530
parents e995f00a9e9a
children d9e5b0aeeb90
line wrap: on
line diff
--- 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):