comparison mercurial/posix.py @ 30619:cfe66dcf45c0

py3: replace os.sep with pycompat.ossep (part 2 of 4) This part also replaces some chunks of os.sep with pycompat.ossep.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 17 Dec 2016 20:02:50 +0530
parents d623cc6b3742
children ad15646dc61c
comparison
equal deleted inserted replaced
30618:1112ff99d965 30619:cfe66dcf45c0
367 ], reverse=True) 367 ], reverse=True)
368 368
369 # use upper-ing as normcase as same as NTFS workaround 369 # use upper-ing as normcase as same as NTFS workaround
370 def normcase(path): 370 def normcase(path):
371 pathlen = len(path) 371 pathlen = len(path)
372 if (pathlen == 0) or (path[0] != os.sep): 372 if (pathlen == 0) or (path[0] != pycompat.ossep):
373 # treat as relative 373 # treat as relative
374 return encoding.upper(path) 374 return encoding.upper(path)
375 375
376 # to preserve case of mountpoint part 376 # to preserve case of mountpoint part
377 for mp in cygwinmountpoints: 377 for mp in cygwinmountpoints:
379 continue 379 continue
380 380
381 mplen = len(mp) 381 mplen = len(mp)
382 if mplen == pathlen: # mount point itself 382 if mplen == pathlen: # mount point itself
383 return mp 383 return mp
384 if path[mplen] == os.sep: 384 if path[mplen] == pycompat.ossep:
385 return mp + encoding.upper(path[mplen:]) 385 return mp + encoding.upper(path[mplen:])
386 386
387 return encoding.upper(path) 387 return encoding.upper(path)
388 388
389 normcasespec = encoding.normcasespecs.other 389 normcasespec = encoding.normcasespecs.other
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):
456 return executable 456 return executable
457 return None 457 return None
458 458
459 if os.sep 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 sys.platform == 'plan9':
463 return findexisting(os.path.join('/bin', command)) 463 return findexisting(os.path.join('/bin', command))
464 464