Mercurial > hg
comparison mercurial/pycompat.py @ 30303:ad40d307a9f0
py3: have pycompat.ospathsep and pycompat.ossep
We needed bytes version of os.sep and os.pathsep in py3 as they return
unicodes.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 06 Nov 2016 03:44:44 +0530 |
parents | 3874ddba1ab4 |
children | e0d9b6aab4c5 |
comparison
equal
deleted
inserted
replaced
30302:3874ddba1ab4 | 30303:ad40d307a9f0 |
---|---|
37 import functools | 37 import functools |
38 fsencode = os.fsencode | 38 fsencode = os.fsencode |
39 fsdecode = os.fsdecode | 39 fsdecode = os.fsdecode |
40 # A bytes version of os.name. | 40 # A bytes version of os.name. |
41 osname = os.name.encode('ascii') | 41 osname = os.name.encode('ascii') |
42 ospathsep = os.pathsep.encode('ascii') | |
43 ossep = os.sep.encode('ascii') | |
42 | 44 |
43 def sysstr(s): | 45 def sysstr(s): |
44 """Return a keyword str to be passed to Python functions such as | 46 """Return a keyword str to be passed to Python functions such as |
45 getattr() and str.encode() | 47 getattr() and str.encode() |
46 | 48 |
83 # better not to touch Python 2 part as it's already working fine. | 85 # better not to touch Python 2 part as it's already working fine. |
84 def fsdecode(filename): | 86 def fsdecode(filename): |
85 return filename | 87 return filename |
86 | 88 |
87 osname = os.name | 89 osname = os.name |
90 ospathsep = os.pathsep | |
91 ossep = os.sep | |
88 | 92 |
89 stringio = io.StringIO | 93 stringio = io.StringIO |
90 empty = _queue.Empty | 94 empty = _queue.Empty |
91 queue = _queue.Queue | 95 queue = _queue.Queue |
92 | 96 |