Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/pycompat.py @ 31310:295625f1296b
merge with stable
author | Augie Fackler <augie@google.com> |
---|---|
date | Sat, 11 Mar 2017 13:53:14 -0500 |
parents | 64596338ba10 86cd1f2cfff5 |
children | 73b3bee8febe |
comparison
equal
deleted
inserted
replaced
31309:0c8a042b193d | 31310:295625f1296b |
---|---|
67 # | 67 # |
68 # https://hg.python.org/cpython/file/v3.5.1/Programs/python.c#l55 | 68 # https://hg.python.org/cpython/file/v3.5.1/Programs/python.c#l55 |
69 # | 69 # |
70 # TODO: On Windows, the native argv is wchar_t, so we'll need a different | 70 # TODO: On Windows, the native argv is wchar_t, so we'll need a different |
71 # workaround to simulate the Python 2 (i.e. ANSI Win32 API) behavior. | 71 # workaround to simulate the Python 2 (i.e. ANSI Win32 API) behavior. |
72 sysargv = list(map(os.fsencode, sys.argv)) | 72 if getattr(sys, 'argv', None) is not None: |
73 sysargv = list(map(os.fsencode, sys.argv)) | |
73 | 74 |
74 def bytechr(i): | 75 def bytechr(i): |
75 return bytes([i]) | 76 return bytes([i]) |
76 | 77 |
77 def sysstr(s): | 78 def sysstr(s): |
171 ossep = os.sep | 172 ossep = os.sep |
172 osaltsep = os.altsep | 173 osaltsep = os.altsep |
173 stdin = sys.stdin | 174 stdin = sys.stdin |
174 stdout = sys.stdout | 175 stdout = sys.stdout |
175 stderr = sys.stderr | 176 stderr = sys.stderr |
176 sysargv = sys.argv | 177 if getattr(sys, 'argv', None) is not None: |
178 sysargv = sys.argv | |
177 sysplatform = sys.platform | 179 sysplatform = sys.platform |
178 getcwd = os.getcwd | 180 getcwd = os.getcwd |
179 sysexecutable = sys.executable | 181 sysexecutable = sys.executable |
180 shlexsplit = shlex.split | 182 shlexsplit = shlex.split |
181 | 183 |