comparison mercurial/util.py @ 3994:1cc60eebc71f

exec: checkexec checks whether filesystem supports exec flags
author Matt Mackall <mpm@selenic.com>
date Fri, 29 Dec 2006 20:04:30 -0600
parents 1063a631cb8e
children a4e79f86d304
comparison
equal deleted inserted replaced
3993:04d919cdf263 3994:1cc60eebc71f
691 return False 691 return False
692 return True 692 return True
693 except: 693 except:
694 return True 694 return True
695 695
696 def checkexec(path):
697 """
698 Check whether the given path is on a filesystem with UNIX-like exec flags
699
700 Requires a directory (like /foo/.hg)
701 """
702 fh, fn = tempfile.mkstemp("", "", path)
703 os.close(fh)
704 m = os.stat(fn).st_mode
705 os.chmod(fn, m ^ 0111)
706 r = (os.stat(fn).st_mode != m)
707 os.unlink(fn)
708 return r
709
696 # Platform specific variants 710 # Platform specific variants
697 if os.name == 'nt': 711 if os.name == 'nt':
698 import msvcrt 712 import msvcrt
699 nulldev = 'NUL:' 713 nulldev = 'NUL:'
700 714