Show More
@@ -5,11 +5,22 b' prefixed with "no-", the absence of feat' | |||||
5 | """ |
|
5 | """ | |
6 | import optparse |
|
6 | import optparse | |
7 | import os |
|
7 | import os | |
|
8 | import re | |||
8 | import sys |
|
9 | import sys | |
9 | import tempfile |
|
10 | import tempfile | |
10 |
|
11 | |||
11 | tempprefix = 'hg-hghave-' |
|
12 | tempprefix = 'hg-hghave-' | |
12 |
|
13 | |||
|
14 | def matchoutput(cmd, regexp): | |||
|
15 | """Return True if cmd executes successfully and its output | |||
|
16 | is matched by the supplied regular expression. | |||
|
17 | """ | |||
|
18 | r = re.compile(regexp) | |||
|
19 | fh = os.popen(cmd) | |||
|
20 | s = fh.read() | |||
|
21 | ret = fh.close() | |||
|
22 | return ret is None and r.search(s) | |||
|
23 | ||||
13 | def has_symlink(): |
|
24 | def has_symlink(): | |
14 | return hasattr(os, "symlink") |
|
25 | return hasattr(os, "symlink") | |
15 |
|
26 | |||
@@ -52,10 +63,7 b' def has_lsprof():' | |||||
52 | return False |
|
63 | return False | |
53 |
|
64 | |||
54 | def has_git(): |
|
65 | def has_git(): | |
55 | fh = os.popen('git --version 2>&1') |
|
66 | return matchoutput('git --version 2>&1', r'^git version') | |
56 | s = fh.read() |
|
|||
57 | ret = fh.close() |
|
|||
58 | return ret is None and s.startswith('git version') |
|
|||
59 |
|
67 | |||
60 | checks = { |
|
68 | checks = { | |
61 | "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"), |
|
69 | "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"), |
General Comments 0
You need to be logged in to leave comments.
Login now