equal
deleted
inserted
replaced
6 import optparse |
6 import optparse |
7 import os |
7 import os |
8 import sys |
8 import sys |
9 import tempfile |
9 import tempfile |
10 |
10 |
|
11 tempprefix = 'hg-hghave-' |
|
12 |
11 def has_symlink(): |
13 def has_symlink(): |
12 return hasattr(os, "symlink") |
14 return hasattr(os, "symlink") |
13 |
15 |
14 def has_fifo(): |
16 def has_fifo(): |
15 return hasattr(os, "mkfifo") |
17 return hasattr(os, "mkfifo") |
16 |
18 |
17 def has_executablebit(): |
19 def has_executablebit(): |
18 fd, path = tempfile.mkstemp() |
20 fd, path = tempfile.mkstemp(prefix=tempprefix) |
19 os.close(fd) |
21 os.close(fd) |
20 try: |
22 try: |
21 s = os.lstat(path).st_mode |
23 s = os.lstat(path).st_mode |
22 os.chmod(path, s | 0100) |
24 os.chmod(path, s | 0100) |
23 return (os.lstat(path).st_mode & 0100 != 0) |
25 return (os.lstat(path).st_mode & 0100 != 0) |
24 finally: |
26 finally: |
25 os.remove(path) |
27 os.remove(path) |
26 |
28 |
27 def has_eol_in_paths(): |
29 def has_eol_in_paths(): |
28 try: |
30 try: |
29 fd, path = tempfile.mkstemp(suffix='\n\r') |
31 fd, path = tempfile.mkstemp(prefix=tempprefix, suffix='\n\r') |
30 os.close(fd) |
32 os.close(fd) |
31 os.remove(path) |
33 os.remove(path) |
32 return True |
34 return True |
33 except: |
35 except: |
34 return False |
36 return False |