Show More
@@ -338,10 +338,19 b' def upperfallback(s):' | |||
|
338 | 338 | if not _nativeenviron: |
|
339 | 339 | # now encoding and helper functions are available, recreate the environ |
|
340 | 340 | # dict to be exported to other modules |
|
341 | environ = { | |
|
342 | tolocal(k.encode('utf-8')): tolocal(v.encode('utf-8')) | |
|
343 | for k, v in os.environ.items() # re-exports | |
|
344 | } | |
|
341 | if pycompat.iswindows and pycompat.ispy3: | |
|
342 | ||
|
343 | class WindowsEnviron(dict): | |
|
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 | 355 | if pycompat.ispy3: |
|
347 | 356 | # os.getcwd() on Python 3 returns string, but it has os.getcwdb() which |
General Comments 0
You need to be logged in to leave comments.
Login now