diff mercurial/url.py @ 30820:6a70cf94d1b5

py3: replace pycompat.getenv with encoding.environ.get pycompat.getenv returns os.getenvb on py3 which is not available on Windows. This patch replaces them with encoding.environ.get and checks to ensure no new instances of os.getenv or os.setenv are introduced.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 15 Jan 2017 13:17:05 +0530
parents a520aefb96f1
children 806f9a883b4f
line wrap: on
line diff
--- a/mercurial/url.py	Sun Jan 15 16:33:15 2017 +0900
+++ b/mercurial/url.py	Sun Jan 15 13:17:05 2017 +0530
@@ -15,10 +15,10 @@
 
 from .i18n import _
 from . import (
+    encoding,
     error,
     httpconnection as httpconnectionmod,
     keepalive,
-    pycompat,
     sslutil,
     util,
 )
@@ -81,7 +81,7 @@
 class proxyhandler(urlreq.proxyhandler):
     def __init__(self, ui):
         proxyurl = (ui.config("http_proxy", "host") or
-                        pycompat.osgetenv('http_proxy'))
+                        encoding.environ.get('http_proxy'))
         # XXX proxyauthinfo = None
 
         if proxyurl:
@@ -99,7 +99,7 @@
             no_list.extend([p.lower() for
                             p in ui.configlist("http_proxy", "no")])
             no_list.extend([p.strip().lower() for
-                            p in pycompat.osgetenv("no_proxy", '').split(',')
+                            p in encoding.environ.get("no_proxy", '').split(',')
                             if p.strip()])
             # "http_proxy.always" config is for running tests on localhost
             if ui.configbool("http_proxy", "always"):