##// END OF EJS Templates
py3: replace os.environ with encoding.environ (part 3 of 5)
Pulkit Goyal -
r30636:f1c9fafc default
parent child Browse files
Show More
@@ -16,6 +16,7 b' from .i18n import _'
16 16 from .node import nullid, short
17 17
18 18 from . import (
19 encoding,
19 20 error,
20 21 formatter,
21 22 match,
@@ -165,7 +166,7 b' def _picktool(repo, ui, path, binary, sy'
165 166 return (force, force)
166 167
167 168 # HGMERGE takes next precedence
168 hgmerge = os.environ.get("HGMERGE")
169 hgmerge = encoding.environ.get("HGMERGE")
169 170 if hgmerge:
170 171 if changedelete and not supportscd(hgmerge):
171 172 return ":prompt", None
@@ -13,6 +13,7 b' import mimetypes'
13 13 import os
14 14
15 15 from .. import (
16 encoding,
16 17 pycompat,
17 18 util,
18 19 )
@@ -191,7 +192,7 b' def get_contact(config):'
191 192 """
192 193 return (config("web", "contact") or
193 194 config("ui", "username") or
194 os.environ.get("EMAIL") or "")
195 encoding.environ.get("EMAIL") or "")
195 196
196 197 def caching(web, req):
197 198 tag = 'W/"%s"' % web.mtime
@@ -286,7 +286,8 b' class hgweb(object):'
286 286 Modern servers should be using WSGI and should avoid this
287 287 method, if possible.
288 288 """
289 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
289 if not encoding.environ.get('GATEWAY_INTERFACE',
290 '').startswith("CGI/1."):
290 291 raise RuntimeError("This function is only intended to be "
291 292 "called while running as a CGI script.")
292 293 wsgicgi.launch(self)
@@ -186,7 +186,8 b' class hgwebdir(object):'
186 186 self.lastrefresh = time.time()
187 187
188 188 def run(self):
189 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
189 if not encoding.environ.get('GATEWAY_INTERFACE',
190 '').startswith("CGI/1."):
190 191 raise RuntimeError("This function is only intended to be "
191 192 "called while running as a CGI script.")
192 193 wsgicgi.launch(self)
@@ -10,9 +10,8 b''
10 10
11 11 from __future__ import absolute_import
12 12
13 import os
14
15 13 from .. import (
14 encoding,
16 15 util,
17 16 )
18 17
@@ -24,7 +23,7 b' def launch(application):'
24 23 util.setbinary(util.stdin)
25 24 util.setbinary(util.stdout)
26 25
27 environ = dict(os.environ.iteritems())
26 environ = dict(encoding.environ.iteritems())
28 27 environ.setdefault('PATH_INFO', '')
29 28 if environ.get('SERVER_SOFTWARE', '').startswith('Microsoft-IIS'):
30 29 # IIS includes script_name in PATH_INFO
@@ -15,6 +15,7 b' import socket'
15 15
16 16 from .i18n import _
17 17 from . import (
18 encoding,
18 19 error,
19 20 httpconnection as httpconnectionmod,
20 21 keepalive,
@@ -118,8 +119,8 b' class proxyhandler(urlreq.proxyhandler):'
118 119 if ui.config("http_proxy", "host"):
119 120 for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]:
120 121 try:
121 if env in os.environ:
122 del os.environ[env]
122 if env in encoding.environ:
123 del encoding.environ[env]
123 124 except OSError:
124 125 pass
125 126
@@ -177,7 +177,7 b' def _is_win_9x():'
177 177 try:
178 178 return sys.getwindowsversion()[3] == 1
179 179 except AttributeError:
180 return 'command' in os.environ.get('comspec', '')
180 return 'command' in encoding.environ.get('comspec', '')
181 181
182 182 def openhardlinks():
183 183 return not _is_win_9x()
@@ -303,7 +303,7 b' def findexe(command):'
303 303 PATH isn't searched if command is an absolute or relative path.
304 304 An extension from PATHEXT is found and added if not present.
305 305 If command isn't found None is returned.'''
306 pathext = os.environ.get('PATHEXT', '.COM;.EXE;.BAT;.CMD')
306 pathext = encoding.environ.get('PATHEXT', '.COM;.EXE;.BAT;.CMD')
307 307 pathexts = [ext for ext in pathext.lower().split(pycompat.ospathsep)]
308 308 if os.path.splitext(command)[1].lower() in pathexts:
309 309 pathexts = ['']
@@ -319,7 +319,7 b' def findexe(command):'
319 319 if pycompat.ossep in command:
320 320 return findexisting(command)
321 321
322 for path in os.environ.get('PATH', '').split(pycompat.ospathsep):
322 for path in encoding.environ.get('PATH', '').split(pycompat.ospathsep):
323 323 executable = findexisting(os.path.join(path, command))
324 324 if executable is not None:
325 325 return executable
General Comments 0
You need to be logged in to leave comments. Login now