diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -74,18 +74,19 @@ def _usercachedir(ui): if path: return path if pycompat.osname == 'nt': - appdata = os.getenv('LOCALAPPDATA', os.getenv('APPDATA')) + appdata = pycompat.osgetenv('LOCALAPPDATA',\ + pycompat.osgetenv('APPDATA')) if appdata: return os.path.join(appdata, longname) elif platform.system() == 'Darwin': - home = os.getenv('HOME') + home = pycompat.osgetenv('HOME') if home: return os.path.join(home, 'Library', 'Caches', longname) elif pycompat.osname == 'posix': - path = os.getenv('XDG_CACHE_HOME') + path = pycompat.osgetenv('XDG_CACHE_HOME') if path: return os.path.join(path, longname) - home = os.getenv('HOME') + home = pycompat.osgetenv('HOME') if home: return os.path.join(home, '.cache', longname) else: diff --git a/mercurial/profiling.py b/mercurial/profiling.py --- a/mercurial/profiling.py +++ b/mercurial/profiling.py @@ -8,12 +8,12 @@ from __future__ import absolute_import, print_function import contextlib -import os import time from .i18n import _ from . import ( error, + pycompat, util, ) @@ -120,7 +120,7 @@ def profile(ui): Profiling is active when the context manager is active. When the context manager exits, profiling results will be written to the configured output. """ - profiler = os.getenv('HGPROF') + profiler = pycompat.osgetenv('HGPROF') if profiler is None: profiler = ui.config('profiling', 'type', default='stat') if profiler not in ('ls', 'stat', 'flame'): diff --git a/mercurial/url.py b/mercurial/url.py --- a/mercurial/url.py +++ b/mercurial/url.py @@ -18,6 +18,7 @@ from . import ( error, httpconnection as httpconnectionmod, keepalive, + pycompat, sslutil, util, ) @@ -79,7 +80,8 @@ class passwordmgr(object): class proxyhandler(urlreq.proxyhandler): def __init__(self, ui): - proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy') + proxyurl = (ui.config("http_proxy", "host") or + pycompat.osgetenv('http_proxy')) # XXX proxyauthinfo = None if proxyurl: @@ -97,7 +99,7 @@ class proxyhandler(urlreq.proxyhandler): no_list.extend([p.lower() for p in ui.configlist("http_proxy", "no")]) no_list.extend([p.strip().lower() for - p in os.getenv("no_proxy", '').split(',') + p in pycompat.osgetenv("no_proxy", '').split(',') if p.strip()]) # "http_proxy.always" config is for running tests on localhost if ui.configbool("http_proxy", "always"):