Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 30642:344e68882cd3
py3: replace os.environ with encoding.environ (part 4 of 5)
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 18 Dec 2016 02:06:00 +0530 |
parents | bcf4a975f93d |
children | d524c88511a7 |
line wrap: on
line diff
--- a/mercurial/util.py Sun Dec 18 01:54:36 2016 +0530 +++ b/mercurial/util.py Sun Dec 18 02:06:00 2016 +0530 @@ -948,14 +948,14 @@ Defaults to $HG or 'hg' in the search path. """ if _hgexecutable is None: - hg = os.environ.get('HG') + hg = encoding.environ.get('HG') mainmod = sys.modules['__main__'] if hg: _sethgexecutable(hg) elif mainfrozen(): if getattr(sys, 'frozen', None) == 'macosx_app': # Env variable set by py2app - _sethgexecutable(os.environ['EXECUTABLEPATH']) + _sethgexecutable(encoding.environ['EXECUTABLEPATH']) else: _sethgexecutable(sys.executable) elif os.path.basename(getattr(mainmod, '__file__', '')) == 'hg': @@ -1006,7 +1006,7 @@ os.chdir(cwd) rc = os.system(cmd) else: - env = dict(os.environ) + env = dict(encoding.environ) env.update((k, py2shell(v)) for k, v in environ.iteritems()) env['HG'] = hgexecutable() if out is None or _isstdout(out): @@ -1384,7 +1384,7 @@ def gui(): '''Are we running in a GUI?''' if sys.platform == 'darwin': - if 'SSH_CONNECTION' in os.environ: + if 'SSH_CONNECTION' in encoding.environ: # handle SSH access to a box where the user is logged in return False elif getattr(osutil, 'isgui', None): @@ -1394,7 +1394,7 @@ # pure build; use a safe default return True else: - return os.name == "nt" or os.environ.get("DISPLAY") + return os.name == "nt" or encoding.environ.get("DISPLAY") def mktempcopy(name, emptyok=False, createmode=None): """Create a temporary file with the same contents from name @@ -2297,7 +2297,7 @@ if mainfrozen(): if getattr(sys, 'frozen', None) == 'macosx_app': # Env variable set by py2app - return [os.environ['EXECUTABLEPATH']] + return [encoding.environ['EXECUTABLEPATH']] else: return [sys.executable] return gethgcmd()