##// END OF EJS Templates
util, posix: eliminate encodinglower and encodingupper...
Adrian Buehlmann -
r17203:0cb55b5c default
parent child Browse files
Show More
@@ -6,6 +6,7 b''
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from i18n import _
8 from i18n import _
9 import encoding
9 import os, sys, errno, stat, getpass, pwd, grp, tempfile, unicodedata
10 import os, sys, errno, stat, getpass, pwd, grp, tempfile, unicodedata
10
11
11 posixfile = open
12 posixfile = open
@@ -164,9 +165,6 b' def samedevice(fpath1, fpath2):'
164 st2 = os.lstat(fpath2)
165 st2 = os.lstat(fpath2)
165 return st1.st_dev == st2.st_dev
166 return st1.st_dev == st2.st_dev
166
167
167 encodinglower = None
168 encodingupper = None
169
170 # os.path.normcase is a no-op, which doesn't help us on non-native filesystems
168 # os.path.normcase is a no-op, which doesn't help us on non-native filesystems
171 def normcase(path):
169 def normcase(path):
172 return path.lower()
170 return path.lower()
@@ -255,7 +253,7 b" if sys.platform == 'cygwin':"
255 pathlen = len(path)
253 pathlen = len(path)
256 if (pathlen == 0) or (path[0] != os.sep):
254 if (pathlen == 0) or (path[0] != os.sep):
257 # treat as relative
255 # treat as relative
258 return encodingupper(path)
256 return encoding.upper(path)
259
257
260 # to preserve case of mountpoint part
258 # to preserve case of mountpoint part
261 for mp in cygwinmountpoints:
259 for mp in cygwinmountpoints:
@@ -266,9 +264,9 b" if sys.platform == 'cygwin':"
266 if mplen == pathlen: # mount point itself
264 if mplen == pathlen: # mount point itself
267 return mp
265 return mp
268 if path[mplen] == os.sep:
266 if path[mplen] == os.sep:
269 return mp + encodingupper(path[mplen:])
267 return mp + encoding.upper(path[mplen:])
270
268
271 return encodingupper(path)
269 return encoding.upper(path)
272
270
273 # Cygwin translates native ACLs to POSIX permissions,
271 # Cygwin translates native ACLs to POSIX permissions,
274 # but these translations are not supported by native
272 # but these translations are not supported by native
@@ -24,9 +24,6 b" if os.name == 'nt':"
24 else:
24 else:
25 import posix as platform
25 import posix as platform
26
26
27 platform.encodinglower = encoding.lower
28 platform.encodingupper = encoding.upper
29
30 cachestat = platform.cachestat
27 cachestat = platform.cachestat
31 checkexec = platform.checkexec
28 checkexec = platform.checkexec
32 checklink = platform.checklink
29 checklink = platform.checklink
@@ -130,11 +130,8 b' def localpath(path):'
130 def normpath(path):
130 def normpath(path):
131 return pconvert(os.path.normpath(path))
131 return pconvert(os.path.normpath(path))
132
132
133 encodinglower = None
134 encodingupper = None
135
136 def normcase(path):
133 def normcase(path):
137 return encodingupper(path)
134 return encoding.upper(path)
138
135
139 def realpath(path):
136 def realpath(path):
140 '''
137 '''
General Comments 0
You need to be logged in to leave comments. Login now