Mercurial > public > mercurial-scm > hg
diff mercurial/util.py @ 30639:d524c88511a7
py3: replace os.name with pycompat.osname (part 1 of 2)
os.name returns unicodes on py3 and we have pycompat.osname which returns
bytes. This series of 2 patches will change every ocurrence of os.name with
pycompat.osname.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 19 Dec 2016 00:16:52 +0530 |
parents | 344e68882cd3 |
children | e995f00a9e9a |
line wrap: on
line diff
--- a/mercurial/util.py Sun Dec 18 02:08:59 2016 +0530 +++ b/mercurial/util.py Mon Dec 19 00:16:52 2016 +0530 @@ -63,7 +63,7 @@ urlreq = pycompat.urlreq xmlrpclib = pycompat.xmlrpclib -if os.name == 'nt': +if pycompat.osname == 'nt': from . import windows as platform stdout = platform.winstdout(pycompat.stdout) else: @@ -238,7 +238,7 @@ def buffer(sliceable, offset=0): return memoryview(sliceable)[offset:] -closefds = os.name == 'posix' +closefds = pycompat.osname == 'posix' _chunksize = 4096 @@ -1175,7 +1175,7 @@ return _("filename ends with '%s', which is not allowed " "on Windows") % t -if os.name == 'nt': +if pycompat.osname == 'nt': checkosfilename = checkwinfilename else: checkosfilename = platform.checkosfilename @@ -1394,7 +1394,7 @@ # pure build; use a safe default return True else: - return os.name == "nt" or encoding.environ.get("DISPLAY") + return pycompat.osname == "nt" or encoding.environ.get("DISPLAY") def mktempcopy(name, emptyok=False, createmode=None): """Create a temporary file with the same contents from name