mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
py3: replace sys.platform with pycompat.sysplatform (part 2 of 2)
This commit is contained in:
parent
8edc9540ee
commit
d35cffe17d
@ -169,7 +169,7 @@ problematic_encodings = '''big5 big5-tw csbig5 big5hkscs big5-hkscs
|
||||
def extsetup(ui):
|
||||
# TODO: decide use of config section for this extension
|
||||
if ((not os.path.supports_unicode_filenames) and
|
||||
(sys.platform != 'cygwin')):
|
||||
(pycompat.sysplatform != 'cygwin')):
|
||||
ui.warn(_("[win32mbcs] cannot activate on this platform.\n"))
|
||||
return
|
||||
# determine encoding for filename
|
||||
|
@ -80,7 +80,7 @@ def nlinks(name):
|
||||
def parsepatchoutput(output_line):
|
||||
"""parses the output produced by patch and returns the filename"""
|
||||
pf = output_line[14:]
|
||||
if os.sys.platform == 'OpenVMS':
|
||||
if pycompat.sysplatform == 'OpenVMS':
|
||||
if pf[0] == '`':
|
||||
pf = pf[1:-1] # Remove the quotes
|
||||
else:
|
||||
@ -404,7 +404,7 @@ if pycompat.sysplatform == 'cygwin':
|
||||
|
||||
_needsshellquote = None
|
||||
def shellquote(s):
|
||||
if os.sys.platform == 'OpenVMS':
|
||||
if pycompat.sysplatform == 'OpenVMS':
|
||||
return '"%s"' % s
|
||||
global _needsshellquote
|
||||
if _needsshellquote is None:
|
||||
@ -423,7 +423,7 @@ def popen(command, mode='r'):
|
||||
|
||||
def testpid(pid):
|
||||
'''return False if pid dead, True if running or not sure'''
|
||||
if os.sys.platform == 'OpenVMS':
|
||||
if pycompat.sysplatform == 'OpenVMS':
|
||||
return True
|
||||
try:
|
||||
os.kill(pid, 0)
|
||||
|
@ -12,7 +12,6 @@ import ctypes.util
|
||||
import os
|
||||
import socket
|
||||
import stat as statmod
|
||||
import sys
|
||||
|
||||
from . import (
|
||||
policy,
|
||||
@ -70,14 +69,14 @@ def listdirpure(path, stat=False, skip=None):
|
||||
return result
|
||||
|
||||
ffi = None
|
||||
if modulepolicy not in policynocffi and sys.platform == 'darwin':
|
||||
if modulepolicy not in policynocffi and pycompat.sysplatform == 'darwin':
|
||||
try:
|
||||
from _osutil_cffi import ffi, lib
|
||||
except ImportError:
|
||||
if modulepolicy == 'cffi': # strict cffi import
|
||||
raise
|
||||
|
||||
if sys.platform == 'darwin' and ffi is not None:
|
||||
if pycompat.sysplatform == 'darwin' and ffi is not None:
|
||||
listdir_batch_size = 4096
|
||||
# tweakable number, only affects performance, which chunks
|
||||
# of bytes do we get back from getattrlistbulk
|
||||
@ -165,7 +164,7 @@ if pycompat.osname != 'nt':
|
||||
_SCM_RIGHTS = 0x01
|
||||
_socklen_t = ctypes.c_uint
|
||||
|
||||
if sys.platform == 'linux2':
|
||||
if pycompat.sysplatform.startswith('linux'):
|
||||
# socket.h says "the type should be socklen_t but the definition of
|
||||
# the kernel is incompatible with this."
|
||||
_cmsg_len_t = ctypes.c_size_t
|
||||
|
@ -795,7 +795,7 @@ def tempfilter(s, cmd):
|
||||
cmd = cmd.replace('INFILE', inname)
|
||||
cmd = cmd.replace('OUTFILE', outname)
|
||||
code = os.system(cmd)
|
||||
if sys.platform == 'OpenVMS' and code & 1:
|
||||
if pycompat.sysplatform == 'OpenVMS' and code & 1:
|
||||
code = 0
|
||||
if code:
|
||||
raise Abort(_("command '%s' failed: %s") %
|
||||
@ -998,7 +998,7 @@ def system(cmd, environ=None, cwd=None, onerr=None, errprefix=None, out=None):
|
||||
return str(val)
|
||||
origcmd = cmd
|
||||
cmd = quotecommand(cmd)
|
||||
if sys.platform == 'plan9' and (sys.version_info[0] == 2
|
||||
if pycompat.sysplatform == 'plan9' and (sys.version_info[0] == 2
|
||||
and sys.version_info[1] < 7):
|
||||
# subprocess kludge to work around issues in half-baked Python
|
||||
# ports, notably bichued/python:
|
||||
@ -1020,7 +1020,7 @@ def system(cmd, environ=None, cwd=None, onerr=None, errprefix=None, out=None):
|
||||
out.write(line)
|
||||
proc.wait()
|
||||
rc = proc.returncode
|
||||
if sys.platform == 'OpenVMS' and rc & 1:
|
||||
if pycompat.sysplatform == 'OpenVMS' and rc & 1:
|
||||
rc = 0
|
||||
if rc and onerr:
|
||||
errmsg = '%s %s' % (os.path.basename(origcmd.split(None, 1)[0]),
|
||||
@ -1383,7 +1383,7 @@ def splitpath(path):
|
||||
|
||||
def gui():
|
||||
'''Are we running in a GUI?'''
|
||||
if sys.platform == 'darwin':
|
||||
if pycompat.sysplatform == 'darwin':
|
||||
if 'SSH_CONNECTION' in encoding.environ:
|
||||
# handle SSH access to a box where the user is logged in
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user