##// END OF EJS Templates
py3: replace os.getenv with pycompat.osgetenv...
Pulkit Goyal -
r30664:69acfd2c default
parent child Browse files
Show More
@@ -74,18 +74,19 b' def _usercachedir(ui):'
74 if path:
74 if path:
75 return path
75 return path
76 if pycompat.osname == 'nt':
76 if pycompat.osname == 'nt':
77 appdata = os.getenv('LOCALAPPDATA', os.getenv('APPDATA'))
77 appdata = pycompat.osgetenv('LOCALAPPDATA',\
78 pycompat.osgetenv('APPDATA'))
78 if appdata:
79 if appdata:
79 return os.path.join(appdata, longname)
80 return os.path.join(appdata, longname)
80 elif platform.system() == 'Darwin':
81 elif platform.system() == 'Darwin':
81 home = os.getenv('HOME')
82 home = pycompat.osgetenv('HOME')
82 if home:
83 if home:
83 return os.path.join(home, 'Library', 'Caches', longname)
84 return os.path.join(home, 'Library', 'Caches', longname)
84 elif pycompat.osname == 'posix':
85 elif pycompat.osname == 'posix':
85 path = os.getenv('XDG_CACHE_HOME')
86 path = pycompat.osgetenv('XDG_CACHE_HOME')
86 if path:
87 if path:
87 return os.path.join(path, longname)
88 return os.path.join(path, longname)
88 home = os.getenv('HOME')
89 home = pycompat.osgetenv('HOME')
89 if home:
90 if home:
90 return os.path.join(home, '.cache', longname)
91 return os.path.join(home, '.cache', longname)
91 else:
92 else:
@@ -8,12 +8,12 b''
8 from __future__ import absolute_import, print_function
8 from __future__ import absolute_import, print_function
9
9
10 import contextlib
10 import contextlib
11 import os
12 import time
11 import time
13
12
14 from .i18n import _
13 from .i18n import _
15 from . import (
14 from . import (
16 error,
15 error,
16 pycompat,
17 util,
17 util,
18 )
18 )
19
19
@@ -120,7 +120,7 b' def profile(ui):'
120 Profiling is active when the context manager is active. When the context
120 Profiling is active when the context manager is active. When the context
121 manager exits, profiling results will be written to the configured output.
121 manager exits, profiling results will be written to the configured output.
122 """
122 """
123 profiler = os.getenv('HGPROF')
123 profiler = pycompat.osgetenv('HGPROF')
124 if profiler is None:
124 if profiler is None:
125 profiler = ui.config('profiling', 'type', default='stat')
125 profiler = ui.config('profiling', 'type', default='stat')
126 if profiler not in ('ls', 'stat', 'flame'):
126 if profiler not in ('ls', 'stat', 'flame'):
@@ -18,6 +18,7 b' from . import ('
18 error,
18 error,
19 httpconnection as httpconnectionmod,
19 httpconnection as httpconnectionmod,
20 keepalive,
20 keepalive,
21 pycompat,
21 sslutil,
22 sslutil,
22 util,
23 util,
23 )
24 )
@@ -79,7 +80,8 b' class passwordmgr(object):'
79
80
80 class proxyhandler(urlreq.proxyhandler):
81 class proxyhandler(urlreq.proxyhandler):
81 def __init__(self, ui):
82 def __init__(self, ui):
82 proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy')
83 proxyurl = (ui.config("http_proxy", "host") or
84 pycompat.osgetenv('http_proxy'))
83 # XXX proxyauthinfo = None
85 # XXX proxyauthinfo = None
84
86
85 if proxyurl:
87 if proxyurl:
@@ -97,7 +99,7 b' class proxyhandler(urlreq.proxyhandler):'
97 no_list.extend([p.lower() for
99 no_list.extend([p.lower() for
98 p in ui.configlist("http_proxy", "no")])
100 p in ui.configlist("http_proxy", "no")])
99 no_list.extend([p.strip().lower() for
101 no_list.extend([p.strip().lower() for
100 p in os.getenv("no_proxy", '').split(',')
102 p in pycompat.osgetenv("no_proxy", '').split(',')
101 if p.strip()])
103 if p.strip()])
102 # "http_proxy.always" config is for running tests on localhost
104 # "http_proxy.always" config is for running tests on localhost
103 if ui.configbool("http_proxy", "always"):
105 if ui.configbool("http_proxy", "always"):
General Comments 0
You need to be logged in to leave comments. Login now