##// END OF EJS Templates
py3: replace sys.platform with pycompat.sysplatform (part 2 of 2)
Pulkit Goyal -
r30642:e995f00a default
parent child Browse files
Show More
@@ -169,7 +169,7 b" problematic_encodings = '''big5 big5-tw "
169 def extsetup(ui):
169 def extsetup(ui):
170 # TODO: decide use of config section for this extension
170 # TODO: decide use of config section for this extension
171 if ((not os.path.supports_unicode_filenames) and
171 if ((not os.path.supports_unicode_filenames) and
172 (sys.platform != 'cygwin')):
172 (pycompat.sysplatform != 'cygwin')):
173 ui.warn(_("[win32mbcs] cannot activate on this platform.\n"))
173 ui.warn(_("[win32mbcs] cannot activate on this platform.\n"))
174 return
174 return
175 # determine encoding for filename
175 # determine encoding for filename
@@ -80,7 +80,7 b' def nlinks(name):'
80 def parsepatchoutput(output_line):
80 def parsepatchoutput(output_line):
81 """parses the output produced by patch and returns the filename"""
81 """parses the output produced by patch and returns the filename"""
82 pf = output_line[14:]
82 pf = output_line[14:]
83 if os.sys.platform == 'OpenVMS':
83 if pycompat.sysplatform == 'OpenVMS':
84 if pf[0] == '`':
84 if pf[0] == '`':
85 pf = pf[1:-1] # Remove the quotes
85 pf = pf[1:-1] # Remove the quotes
86 else:
86 else:
@@ -404,7 +404,7 b" if pycompat.sysplatform == 'cygwin':"
404
404
405 _needsshellquote = None
405 _needsshellquote = None
406 def shellquote(s):
406 def shellquote(s):
407 if os.sys.platform == 'OpenVMS':
407 if pycompat.sysplatform == 'OpenVMS':
408 return '"%s"' % s
408 return '"%s"' % s
409 global _needsshellquote
409 global _needsshellquote
410 if _needsshellquote is None:
410 if _needsshellquote is None:
@@ -423,7 +423,7 b" def popen(command, mode='r'):"
423
423
424 def testpid(pid):
424 def testpid(pid):
425 '''return False if pid dead, True if running or not sure'''
425 '''return False if pid dead, True if running or not sure'''
426 if os.sys.platform == 'OpenVMS':
426 if pycompat.sysplatform == 'OpenVMS':
427 return True
427 return True
428 try:
428 try:
429 os.kill(pid, 0)
429 os.kill(pid, 0)
@@ -12,7 +12,6 b' import ctypes.util'
12 import os
12 import os
13 import socket
13 import socket
14 import stat as statmod
14 import stat as statmod
15 import sys
16
15
17 from . import (
16 from . import (
18 policy,
17 policy,
@@ -70,14 +69,14 b' def listdirpure(path, stat=False, skip=N'
70 return result
69 return result
71
70
72 ffi = None
71 ffi = None
73 if modulepolicy not in policynocffi and sys.platform == 'darwin':
72 if modulepolicy not in policynocffi and pycompat.sysplatform == 'darwin':
74 try:
73 try:
75 from _osutil_cffi import ffi, lib
74 from _osutil_cffi import ffi, lib
76 except ImportError:
75 except ImportError:
77 if modulepolicy == 'cffi': # strict cffi import
76 if modulepolicy == 'cffi': # strict cffi import
78 raise
77 raise
79
78
80 if sys.platform == 'darwin' and ffi is not None:
79 if pycompat.sysplatform == 'darwin' and ffi is not None:
81 listdir_batch_size = 4096
80 listdir_batch_size = 4096
82 # tweakable number, only affects performance, which chunks
81 # tweakable number, only affects performance, which chunks
83 # of bytes do we get back from getattrlistbulk
82 # of bytes do we get back from getattrlistbulk
@@ -165,7 +164,7 b" if pycompat.osname != 'nt':"
165 _SCM_RIGHTS = 0x01
164 _SCM_RIGHTS = 0x01
166 _socklen_t = ctypes.c_uint
165 _socklen_t = ctypes.c_uint
167
166
168 if sys.platform == 'linux2':
167 if pycompat.sysplatform.startswith('linux'):
169 # socket.h says "the type should be socklen_t but the definition of
168 # socket.h says "the type should be socklen_t but the definition of
170 # the kernel is incompatible with this."
169 # the kernel is incompatible with this."
171 _cmsg_len_t = ctypes.c_size_t
170 _cmsg_len_t = ctypes.c_size_t
@@ -795,7 +795,7 b' def tempfilter(s, cmd):'
795 cmd = cmd.replace('INFILE', inname)
795 cmd = cmd.replace('INFILE', inname)
796 cmd = cmd.replace('OUTFILE', outname)
796 cmd = cmd.replace('OUTFILE', outname)
797 code = os.system(cmd)
797 code = os.system(cmd)
798 if sys.platform == 'OpenVMS' and code & 1:
798 if pycompat.sysplatform == 'OpenVMS' and code & 1:
799 code = 0
799 code = 0
800 if code:
800 if code:
801 raise Abort(_("command '%s' failed: %s") %
801 raise Abort(_("command '%s' failed: %s") %
@@ -998,7 +998,7 b' def system(cmd, environ=None, cwd=None, '
998 return str(val)
998 return str(val)
999 origcmd = cmd
999 origcmd = cmd
1000 cmd = quotecommand(cmd)
1000 cmd = quotecommand(cmd)
1001 if sys.platform == 'plan9' and (sys.version_info[0] == 2
1001 if pycompat.sysplatform == 'plan9' and (sys.version_info[0] == 2
1002 and sys.version_info[1] < 7):
1002 and sys.version_info[1] < 7):
1003 # subprocess kludge to work around issues in half-baked Python
1003 # subprocess kludge to work around issues in half-baked Python
1004 # ports, notably bichued/python:
1004 # ports, notably bichued/python:
@@ -1020,7 +1020,7 b' def system(cmd, environ=None, cwd=None, '
1020 out.write(line)
1020 out.write(line)
1021 proc.wait()
1021 proc.wait()
1022 rc = proc.returncode
1022 rc = proc.returncode
1023 if sys.platform == 'OpenVMS' and rc & 1:
1023 if pycompat.sysplatform == 'OpenVMS' and rc & 1:
1024 rc = 0
1024 rc = 0
1025 if rc and onerr:
1025 if rc and onerr:
1026 errmsg = '%s %s' % (os.path.basename(origcmd.split(None, 1)[0]),
1026 errmsg = '%s %s' % (os.path.basename(origcmd.split(None, 1)[0]),
@@ -1383,7 +1383,7 b' def splitpath(path):'
1383
1383
1384 def gui():
1384 def gui():
1385 '''Are we running in a GUI?'''
1385 '''Are we running in a GUI?'''
1386 if sys.platform == 'darwin':
1386 if pycompat.sysplatform == 'darwin':
1387 if 'SSH_CONNECTION' in encoding.environ:
1387 if 'SSH_CONNECTION' in encoding.environ:
1388 # handle SSH access to a box where the user is logged in
1388 # handle SSH access to a box where the user is logged in
1389 return False
1389 return False
General Comments 0
You need to be logged in to leave comments. Login now