Mercurial > hg
comparison mercurial/scmposix.py @ 30641:16b5df5792a8
py3: replace sys.platform with pycompat.sysplatform (part 1 of 2)
sys.platform returns unicode on python 3 world. Our code base has most of the
things bytes because of the transformer. So we have a bytes version of this as
pycompat.sysplatform. This series of 2 patches replaces occurences of
sys.platform with pycompat.sysplatform.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 19 Dec 2016 02:15:24 +0530 |
parents | 5b0baa9f3362 |
children | 354020079723 |
comparison
equal
deleted
inserted
replaced
30640:7a3e67bfa417 | 30641:16b5df5792a8 |
---|---|
23 pass | 23 pass |
24 return rcs | 24 return rcs |
25 | 25 |
26 def systemrcpath(): | 26 def systemrcpath(): |
27 path = [] | 27 path = [] |
28 if sys.platform == 'plan9': | 28 if pycompat.sysplatform == 'plan9': |
29 root = 'lib/mercurial' | 29 root = 'lib/mercurial' |
30 else: | 30 else: |
31 root = 'etc/mercurial' | 31 root = 'etc/mercurial' |
32 # old mod_python does not set sys.argv | 32 # old mod_python does not set sys.argv |
33 if len(getattr(sys, 'argv', [])) > 0: | 33 if len(getattr(sys, 'argv', [])) > 0: |
36 path.extend(_rcfiles(os.path.join(p, root))) | 36 path.extend(_rcfiles(os.path.join(p, root))) |
37 path.extend(_rcfiles('/' + root)) | 37 path.extend(_rcfiles('/' + root)) |
38 return path | 38 return path |
39 | 39 |
40 def userrcpath(): | 40 def userrcpath(): |
41 if sys.platform == 'plan9': | 41 if pycompat.sysplatform == 'plan9': |
42 return [encoding.environ['home'] + '/lib/hgrc'] | 42 return [encoding.environ['home'] + '/lib/hgrc'] |
43 else: | 43 else: |
44 return [os.path.expanduser('~/.hgrc')] | 44 return [os.path.expanduser('~/.hgrc')] |
45 | 45 |
46 def termsize(ui): | 46 def termsize(ui): |