19 fh = os.popen(cmd) |
19 fh = os.popen(cmd) |
20 s = fh.read() |
20 s = fh.read() |
21 ret = fh.close() |
21 ret = fh.close() |
22 return (ignorestatus or ret is None) and r.search(s) |
22 return (ignorestatus or ret is None) and r.search(s) |
23 |
23 |
24 def has_symlink(): |
|
25 return hasattr(os, "symlink") |
|
26 |
|
27 def has_fifo(): |
|
28 return hasattr(os, "mkfifo") |
|
29 |
|
30 def has_cvs(): |
24 def has_cvs(): |
31 return matchoutput('cvs --version 2>&1', r'Concurrent Versions System') |
25 return matchoutput('cvs --version 2>&1', r'Concurrent Versions System') |
32 |
26 |
33 def has_cvsps(): |
27 def has_cvsps(): |
34 return matchoutput('cvsps -h -q 2>&1', r'cvsps version', True) |
28 return matchoutput('cvsps -h -q 2>&1', r'cvsps version', True) |
|
29 |
|
30 def has_eol_in_paths(): |
|
31 try: |
|
32 fd, path = tempfile.mkstemp(prefix=tempprefix, suffix='\n\r') |
|
33 os.close(fd) |
|
34 os.remove(path) |
|
35 return True |
|
36 except: |
|
37 return False |
35 |
38 |
36 def has_executablebit(): |
39 def has_executablebit(): |
37 fd, path = tempfile.mkstemp(prefix=tempprefix) |
40 fd, path = tempfile.mkstemp(prefix=tempprefix) |
38 os.close(fd) |
41 os.close(fd) |
39 try: |
42 try: |
41 os.chmod(path, s | 0100) |
44 os.chmod(path, s | 0100) |
42 return (os.lstat(path).st_mode & 0100 != 0) |
45 return (os.lstat(path).st_mode & 0100 != 0) |
43 finally: |
46 finally: |
44 os.remove(path) |
47 os.remove(path) |
45 |
48 |
46 def has_eol_in_paths(): |
49 def has_fifo(): |
47 try: |
50 return hasattr(os, "mkfifo") |
48 fd, path = tempfile.mkstemp(prefix=tempprefix, suffix='\n\r') |
|
49 os.close(fd) |
|
50 os.remove(path) |
|
51 return True |
|
52 except: |
|
53 return False |
|
54 |
51 |
55 def has_hotshot(): |
52 def has_hotshot(): |
56 try: |
53 try: |
57 # hotshot.stats tests hotshot and many problematic dependencies |
54 # hotshot.stats tests hotshot and many problematic dependencies |
58 # like profile. |
55 # like profile. |
80 import svn.core |
77 import svn.core |
81 return True |
78 return True |
82 except ImportError: |
79 except ImportError: |
83 return False |
80 return False |
84 |
81 |
|
82 def has_symlink(): |
|
83 return hasattr(os, "symlink") |
|
84 |
85 checks = { |
85 checks = { |
86 "cvs": (has_cvs, "cvs client"), |
86 "cvs": (has_cvs, "cvs client"), |
87 "cvsps": (has_cvsps, "cvsps utility"), |
87 "cvsps": (has_cvsps, "cvsps utility"), |
88 "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"), |
88 "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"), |
89 "execbit": (has_executablebit, "executable bit"), |
89 "execbit": (has_executablebit, "executable bit"), |
|
90 "fifo": (has_fifo, "named pipes"), |
90 "git": (has_git, "git command line client"), |
91 "git": (has_git, "git command line client"), |
91 "fifo": (has_fifo, "named pipes"), |
|
92 "hotshot": (has_hotshot, "python hotshot module"), |
92 "hotshot": (has_hotshot, "python hotshot module"), |
93 "lsprof": (has_lsprof, "python lsprof module"), |
93 "lsprof": (has_lsprof, "python lsprof module"), |
94 "svn": (has_svn, "subversion client and admin tools"), |
94 "svn": (has_svn, "subversion client and admin tools"), |
95 "svn-bindings": (has_svn_bindings, "subversion python bindings"), |
95 "svn-bindings": (has_svn_bindings, "subversion python bindings"), |
96 "symlink": (has_symlink, "symbolic links"), |
96 "symlink": (has_symlink, "symbolic links"), |