Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/pycompat.py @ 30628:c6026c20a3ce
py3: have a bytes version of os.altsep
os.altsep returns unicodes on Python 3. We need a bytes version hence added
pycompat.altsep.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 18 Dec 2016 00:44:21 +0530 |
parents | fbc3f73dc802 |
children | a82a6eee2613 |
comparison
equal
deleted
inserted
replaced
30627:ce36fa9b140c | 30628:c6026c20a3ce |
---|---|
42 fsdecode = os.fsdecode | 42 fsdecode = os.fsdecode |
43 # A bytes version of os.name. | 43 # A bytes version of os.name. |
44 osname = os.name.encode('ascii') | 44 osname = os.name.encode('ascii') |
45 ospathsep = os.pathsep.encode('ascii') | 45 ospathsep = os.pathsep.encode('ascii') |
46 ossep = os.sep.encode('ascii') | 46 ossep = os.sep.encode('ascii') |
47 osaltsep = os.altsep | |
48 if osaltsep: | |
49 osaltsep = osaltsep.encode('ascii') | |
47 # os.getcwd() on Python 3 returns string, but it has os.getcwdb() which | 50 # os.getcwd() on Python 3 returns string, but it has os.getcwdb() which |
48 # returns bytes. | 51 # returns bytes. |
49 getcwd = os.getcwdb | 52 getcwd = os.getcwdb |
50 | 53 |
51 # TODO: .buffer might not exist if std streams were replaced; we'll need | 54 # TODO: .buffer might not exist if std streams were replaced; we'll need |
143 return dic | 146 return dic |
144 | 147 |
145 osname = os.name | 148 osname = os.name |
146 ospathsep = os.pathsep | 149 ospathsep = os.pathsep |
147 ossep = os.sep | 150 ossep = os.sep |
151 osaltsep = os.altsep | |
148 stdin = sys.stdin | 152 stdin = sys.stdin |
149 stdout = sys.stdout | 153 stdout = sys.stdout |
150 stderr = sys.stderr | 154 stderr = sys.stderr |
151 sysargv = sys.argv | 155 sysargv = sys.argv |
152 getcwd = os.getcwd | 156 getcwd = os.getcwd |