##// END OF EJS Templates
hghave: detect cvs and cvsps availability...
Patrick Mezard -
r5302:96187683 default
parent child Browse files
Show More
@@ -11,7 +11,7 b' import tempfile'
11
11
12 tempprefix = 'hg-hghave-'
12 tempprefix = 'hg-hghave-'
13
13
14 def matchoutput(cmd, regexp):
14 def matchoutput(cmd, regexp, ignorestatus=False):
15 """Return True if cmd executes successfully and its output
15 """Return True if cmd executes successfully and its output
16 is matched by the supplied regular expression.
16 is matched by the supplied regular expression.
17 """
17 """
@@ -19,7 +19,7 b' def matchoutput(cmd, regexp):'
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 ret is None and r.search(s)
22 return (ignorestatus or ret is None) and r.search(s)
23
23
24 def has_symlink():
24 def has_symlink():
25 return hasattr(os, "symlink")
25 return hasattr(os, "symlink")
@@ -27,6 +27,12 b' def has_symlink():'
27 def has_fifo():
27 def has_fifo():
28 return hasattr(os, "mkfifo")
28 return hasattr(os, "mkfifo")
29
29
30 def has_cvs():
31 return matchoutput('cvs --version 2>&1', r'Concurrent Versions System')
32
33 def has_cvsps():
34 return matchoutput('cvsps -h -q 2>&1', r'cvsps version', True)
35
30 def has_executablebit():
36 def has_executablebit():
31 fd, path = tempfile.mkstemp(prefix=tempprefix)
37 fd, path = tempfile.mkstemp(prefix=tempprefix)
32 os.close(fd)
38 os.close(fd)
@@ -66,6 +72,8 b' def has_git():'
66 return matchoutput('git --version 2>&1', r'^git version')
72 return matchoutput('git --version 2>&1', r'^git version')
67
73
68 checks = {
74 checks = {
75 "cvs": (has_cvs, "cvs client"),
76 "cvsps": (has_cvsps, "cvsps utility"),
69 "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
77 "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
70 "execbit": (has_executablebit, "executable bit"),
78 "execbit": (has_executablebit, "executable bit"),
71 "git": (has_git, "git command line client"),
79 "git": (has_git, "git command line client"),
General Comments 0
You need to be logged in to leave comments. Login now