Mercurial > hg-stable
changeset 30476:5b0baa9f3362
py3: use pycompat.sysargv in scmposix.systemrcpath()
sys.argv returns unicodes on Python 3. We have pycompat.sysargv which returns
bytes encoded using os.fsencode(). After this patch scmposix.systemrcpath()
returns bytes in Python 3 world. This change is also a part of making
`hg version` run in Python 3.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 21 Nov 2016 15:26:47 +0530 |
parents | 2add671bf55b |
children | 7f2b18c34c02 |
files | mercurial/scmposix.py |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/scmposix.py Sun Nov 20 13:50:45 2016 -0800 +++ b/mercurial/scmposix.py Mon Nov 21 15:26:47 2016 +0530 @@ -9,6 +9,7 @@ from . import ( encoding, osutil, + pycompat, ) def _rcfiles(path): @@ -30,7 +31,7 @@ root = 'etc/mercurial' # old mod_python does not set sys.argv if len(getattr(sys, 'argv', [])) > 0: - p = os.path.dirname(os.path.dirname(sys.argv[0])) + p = os.path.dirname(os.path.dirname(pycompat.sysargv[0])) if p != '/': path.extend(_rcfiles(os.path.join(p, root))) path.extend(_rcfiles('/' + root))