comparison mercurial/pycompat.py @ 40577:1b49b84d5ed5

pycompat: adding Linux detection and fixing Mac Python 3 recommends detecting OSs with the prefix of the platform, but we were comparing the full string for macOS. We also didn't have Linux detection, which is convenient for extensions to use (rather than have some OSs detected by hg and some by the extension). Reference: https://docs.python.org/3/library/sys.html#sys.platform Differential Revision: https://phab.mercurial-scm.org/D5227
author rdamazio@google.com
date Mon, 05 Nov 2018 19:52:42 -0800
parents 24e493ec2229
children 2cc453284d5c
comparison
equal deleted inserted replaced
40576:1419f780207c 40577:1b49b84d5ed5
401 rawinput = raw_input 401 rawinput = raw_input
402 getargspec = inspect.getargspec 402 getargspec = inspect.getargspec
403 403
404 isjython = sysplatform.startswith(b'java') 404 isjython = sysplatform.startswith(b'java')
405 405
406 isdarwin = sysplatform == b'darwin' 406 isdarwin = sysplatform.startswith(b'darwin')
407 islinux = sysplatform.startswith(b'linux')
407 isposix = osname == b'posix' 408 isposix = osname == b'posix'
408 iswindows = osname == b'nt' 409 iswindows = osname == b'nt'
409 410
410 def getoptb(args, shortlist, namelist): 411 def getoptb(args, shortlist, namelist):
411 return _getoptbwrapper(getopt.getopt, args, shortlist, namelist) 412 return _getoptbwrapper(getopt.getopt, args, shortlist, namelist)