mercurial/encoding.py
changeset 47560 af633293a5bd
parent 47559 53a864a60281
child 47621 d6ee6456bd5f
equal deleted inserted replaced
47559:53a864a60281 47560:af633293a5bd
   336 
   336 
   337 
   337 
   338 if not _nativeenviron:
   338 if not _nativeenviron:
   339     # now encoding and helper functions are available, recreate the environ
   339     # now encoding and helper functions are available, recreate the environ
   340     # dict to be exported to other modules
   340     # dict to be exported to other modules
   341     environ = {
   341     if pycompat.iswindows and pycompat.ispy3:
   342         tolocal(k.encode('utf-8')): tolocal(v.encode('utf-8'))
   342 
   343         for k, v in os.environ.items()  # re-exports
   343         class WindowsEnviron(dict):
   344     }
   344             """`os.environ` normalizes environment variables to uppercase on windows"""
       
   345 
       
   346             def get(self, key, default=None):
       
   347                 return super().get(upper(key), default)
       
   348 
       
   349         environ = WindowsEnviron()
       
   350 
       
   351     for k, v in os.environ.items():  # re-exports
       
   352         environ[tolocal(k.encode('utf-8'))] = tolocal(v.encode('utf-8'))
       
   353 
   345 
   354 
   346 if pycompat.ispy3:
   355 if pycompat.ispy3:
   347     # os.getcwd() on Python 3 returns string, but it has os.getcwdb() which
   356     # os.getcwd() on Python 3 returns string, but it has os.getcwdb() which
   348     # returns bytes.
   357     # returns bytes.
   349     if pycompat.iswindows:
   358     if pycompat.iswindows: