diff mercurial/posix.py @ 30646:16b5df5792a8

py3: replace sys.platform with pycompat.sysplatform (part 1 of 2) sys.platform returns unicode on python 3 world. Our code base has most of the things bytes because of the transformer. So we have a bytes version of this as pycompat.sysplatform. This series of 2 patches replaces occurences of sys.platform with pycompat.sysplatform.
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 19 Dec 2016 02:15:24 +0530
parents ad15646dc61c
children e995f00a9e9a
line wrap: on
line diff
--- a/mercurial/posix.py	Mon Dec 19 00:28:12 2016 +0530
+++ b/mercurial/posix.py	Mon Dec 19 02:15:24 2016 +0530
@@ -303,7 +303,7 @@
 # fallback normcase function for non-ASCII strings
 normcasefallback = normcase
 
-if sys.platform == 'darwin':
+if pycompat.sysplatform == 'darwin':
 
     def normcase(path):
         '''
@@ -354,7 +354,7 @@
         # drop HFS+ ignored characters
         return encoding.hfsignoreclean(enc)
 
-if sys.platform == 'cygwin':
+if pycompat.sysplatform == 'cygwin':
     # workaround for cygwin, in which mount point part of path is
     # treated as case sensitive, even though underlying NTFS is case
     # insensitive.
@@ -447,7 +447,7 @@
     If command is a basename then PATH is searched for command.
     PATH isn't searched if command is an absolute or relative path.
     If command isn't found None is returned.'''
-    if sys.platform == 'OpenVMS':
+    if pycompat.sysplatform == 'OpenVMS':
         return command
 
     def findexisting(executable):
@@ -459,7 +459,7 @@
     if pycompat.ossep in command:
         return findexisting(command)
 
-    if sys.platform == 'plan9':
+    if pycompat.sysplatform == 'plan9':
         return findexisting(os.path.join('/bin', command))
 
     for path in encoding.environ.get('PATH', '').split(pycompat.ospathsep):