##// END OF EJS Templates
hghave: detect executable permission availability.
Patrick Mezard -
r5072:7e2385a3 default
parent child Browse files
Show More
@@ -5,6 +5,7 b' if all features are there, non-zero othe'
5 import optparse
5 import optparse
6 import os
6 import os
7 import sys
7 import sys
8 import tempfile
8
9
9 def has_symlink():
10 def has_symlink():
10 return hasattr(os, "symlink")
11 return hasattr(os, "symlink")
@@ -12,9 +13,20 b' def has_symlink():'
12 def has_fifo():
13 def has_fifo():
13 return hasattr(os, "mkfifo")
14 return hasattr(os, "mkfifo")
14
15
16 def has_executablebit():
17 fd, path = tempfile.mkstemp()
18 os.close(fd)
19 try:
20 s = os.lstat(path).st_mode
21 os.chmod(path, s | 0100)
22 return (os.lstat(path).st_mode & 0100 != 0)
23 finally:
24 os.remove(path)
25
15 checks = {
26 checks = {
16 "symlink": (has_symlink, "symbolic links"),
27 "symlink": (has_symlink, "symbolic links"),
17 "fifo": (has_fifo, "named pipes"),
28 "fifo": (has_fifo, "named pipes"),
29 "execbit": (has_executablebit, "executable bit"),
18 }
30 }
19
31
20 def list_features():
32 def list_features():
General Comments 0
You need to be logged in to leave comments. Login now