Mercurial > hg
comparison mercurial/pycompat.py @ 39818:24e493ec2229
py3: rename pycompat.getcwd() to encoding.getcwd() (API)
We need to avoid os.getcwdb() on Windows to avoid DeprecationWarnings, and we
need encoding.strtolocal() to encode the result of os.getcwd().
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 21 Sep 2018 19:48:23 -0400 |
parents | a407f9009392 |
children | 1b49b84d5ed5 |
comparison
equal
deleted
inserted
replaced
39817:94c25f694ec3 | 39818:24e493ec2229 |
---|---|
95 ospardir = os.pardir.encode('ascii') | 95 ospardir = os.pardir.encode('ascii') |
96 ossep = os.sep.encode('ascii') | 96 ossep = os.sep.encode('ascii') |
97 osaltsep = os.altsep | 97 osaltsep = os.altsep |
98 if osaltsep: | 98 if osaltsep: |
99 osaltsep = osaltsep.encode('ascii') | 99 osaltsep = osaltsep.encode('ascii') |
100 # os.getcwd() on Python 3 returns string, but it has os.getcwdb() which | 100 |
101 # returns bytes. | |
102 getcwd = os.getcwdb | |
103 sysplatform = sys.platform.encode('ascii') | 101 sysplatform = sys.platform.encode('ascii') |
104 sysexecutable = sys.executable | 102 sysexecutable = sys.executable |
105 if sysexecutable: | 103 if sysexecutable: |
106 sysexecutable = os.fsencode(sysexecutable) | 104 sysexecutable = os.fsencode(sysexecutable) |
107 bytesio = io.BytesIO | 105 bytesio = io.BytesIO |
391 stdout = sys.stdout | 389 stdout = sys.stdout |
392 stderr = sys.stderr | 390 stderr = sys.stderr |
393 if getattr(sys, 'argv', None) is not None: | 391 if getattr(sys, 'argv', None) is not None: |
394 sysargv = sys.argv | 392 sysargv = sys.argv |
395 sysplatform = sys.platform | 393 sysplatform = sys.platform |
396 getcwd = os.getcwd | |
397 sysexecutable = sys.executable | 394 sysexecutable = sys.executable |
398 shlexsplit = shlex.split | 395 shlexsplit = shlex.split |
399 bytesio = cStringIO.StringIO | 396 bytesio = cStringIO.StringIO |
400 stringio = bytesio | 397 stringio = bytesio |
401 maplist = map | 398 maplist = map |