equal
deleted
inserted
replaced
301 # what normcase does to ASCII strings |
301 # what normcase does to ASCII strings |
302 normcasespec = encoding.normcasespecs.lower |
302 normcasespec = encoding.normcasespecs.lower |
303 # fallback normcase function for non-ASCII strings |
303 # fallback normcase function for non-ASCII strings |
304 normcasefallback = normcase |
304 normcasefallback = normcase |
305 |
305 |
306 if sys.platform == 'darwin': |
306 if pycompat.sysplatform == 'darwin': |
307 |
307 |
308 def normcase(path): |
308 def normcase(path): |
309 ''' |
309 ''' |
310 Normalize a filename for OS X-compatible comparison: |
310 Normalize a filename for OS X-compatible comparison: |
311 - escape-encode invalid characters |
311 - escape-encode invalid characters |
352 # Decompose then lowercase (HFS+ technote specifies lower) |
352 # Decompose then lowercase (HFS+ technote specifies lower) |
353 enc = unicodedata.normalize('NFD', u).lower().encode('utf-8') |
353 enc = unicodedata.normalize('NFD', u).lower().encode('utf-8') |
354 # drop HFS+ ignored characters |
354 # drop HFS+ ignored characters |
355 return encoding.hfsignoreclean(enc) |
355 return encoding.hfsignoreclean(enc) |
356 |
356 |
357 if sys.platform == 'cygwin': |
357 if pycompat.sysplatform == 'cygwin': |
358 # workaround for cygwin, in which mount point part of path is |
358 # workaround for cygwin, in which mount point part of path is |
359 # treated as case sensitive, even though underlying NTFS is case |
359 # treated as case sensitive, even though underlying NTFS is case |
360 # insensitive. |
360 # insensitive. |
361 |
361 |
362 # default mount points |
362 # default mount points |
445 def findexe(command): |
445 def findexe(command): |
446 '''Find executable for command searching like which does. |
446 '''Find executable for command searching like which does. |
447 If command is a basename then PATH is searched for command. |
447 If command is a basename then PATH is searched for command. |
448 PATH isn't searched if command is an absolute or relative path. |
448 PATH isn't searched if command is an absolute or relative path. |
449 If command isn't found None is returned.''' |
449 If command isn't found None is returned.''' |
450 if sys.platform == 'OpenVMS': |
450 if pycompat.sysplatform == 'OpenVMS': |
451 return command |
451 return command |
452 |
452 |
453 def findexisting(executable): |
453 def findexisting(executable): |
454 'Will return executable if existing file' |
454 'Will return executable if existing file' |
455 if os.path.isfile(executable) and os.access(executable, os.X_OK): |
455 if os.path.isfile(executable) and os.access(executable, os.X_OK): |
457 return None |
457 return None |
458 |
458 |
459 if pycompat.ossep in command: |
459 if pycompat.ossep in command: |
460 return findexisting(command) |
460 return findexisting(command) |
461 |
461 |
462 if sys.platform == 'plan9': |
462 if pycompat.sysplatform == 'plan9': |
463 return findexisting(os.path.join('/bin', command)) |
463 return findexisting(os.path.join('/bin', command)) |
464 |
464 |
465 for path in encoding.environ.get('PATH', '').split(pycompat.ospathsep): |
465 for path in encoding.environ.get('PATH', '').split(pycompat.ospathsep): |
466 executable = findexisting(os.path.join(path, command)) |
466 executable = findexisting(os.path.join(path, command)) |
467 if executable is not None: |
467 if executable is not None: |