Show More
@@ -238,6 +238,38 b' else:' | |||||
238 | # Fallback to the likely inadequate Python builtin function. |
|
238 | # Fallback to the likely inadequate Python builtin function. | |
239 | realpath = os.path.realpath |
|
239 | realpath = os.path.realpath | |
240 |
|
240 | |||
|
241 | if sys.platform == 'cygwin': | |||
|
242 | # workaround for cygwin, in which mount point part of path is | |||
|
243 | # treated as case sensitive, even though underlying NTFS is case | |||
|
244 | # insensitive. | |||
|
245 | ||||
|
246 | # default mount points | |||
|
247 | cygwinmountpoints = sorted([ | |||
|
248 | "/usr/bin", | |||
|
249 | "/usr/lib", | |||
|
250 | "/cygdrive", | |||
|
251 | ], reverse=True) | |||
|
252 | ||||
|
253 | # use upper-ing as normcase as same as NTFS workaround | |||
|
254 | def normcase(path): | |||
|
255 | pathlen = len(path) | |||
|
256 | if (pathlen == 0) or (path[0] != os.sep): | |||
|
257 | # treat as relative | |||
|
258 | return encodingupper(path) | |||
|
259 | ||||
|
260 | # to preserve case of mountpoint part | |||
|
261 | for mp in cygwinmountpoints: | |||
|
262 | if not path.startswith(mp): | |||
|
263 | continue | |||
|
264 | ||||
|
265 | mplen = len(mp) | |||
|
266 | if mplen == pathlen: # mount point itself | |||
|
267 | return mp | |||
|
268 | if path[mplen] == os.sep: | |||
|
269 | return mp + encodingupper(path[mplen:]) | |||
|
270 | ||||
|
271 | return encodingupper(path) | |||
|
272 | ||||
241 | def shellquote(s): |
|
273 | def shellquote(s): | |
242 | if os.sys.platform == 'OpenVMS': |
|
274 | if os.sys.platform == 'OpenVMS': | |
243 | return '"%s"' % s |
|
275 | return '"%s"' % s |
General Comments 0
You need to be logged in to leave comments.
Login now