comparison mercurial/hg.py @ 859:6390c377a9e6

Trap OSError when deleting env vars On the other OS, it seems that case insensitivity for environment vars can bite users when using some unknown combination of python 2.4.1 and win2kSP4+minsys (and probably other vversions of these softwares). The best way to avoid problems in those weird cases is to ignore OSError exception during env var deletion.
author Edouard Gomez <ed.gomez@free.fr>
date Tue, 09 Aug 2005 09:36:34 -0800
parents fbe964ae7325
children 6d6095823b82 c2e77581bc84 9a0af739cf55 bc9ca4d51d23
comparison
equal deleted inserted replaced
858:c333dfa8fa1a 859:6390c377a9e6
1779 no_proxy = 1 1779 no_proxy = 1
1780 1780
1781 # Note: urllib2 takes proxy values from the environment and those will 1781 # Note: urllib2 takes proxy values from the environment and those will
1782 # take precedence 1782 # take precedence
1783 for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]: 1783 for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]:
1784 if os.environ.has_key(env): 1784 try:
1785 del os.environ[env] 1785 if os.environ.has_key(env):
1786 del os.environ[env]
1787 except OSError:
1788 pass
1786 1789
1787 proxy_handler = urllib2.BaseHandler() 1790 proxy_handler = urllib2.BaseHandler()
1788 if host and not no_proxy: 1791 if host and not no_proxy:
1789 proxy_handler = urllib2.ProxyHandler({"http" : "http://" + host}) 1792 proxy_handler = urllib2.ProxyHandler({"http" : "http://" + host})
1790 1793