equal
deleted
inserted
replaced
1 #!/usr/bin/env python |
1 #!/usr/bin/env python |
2 """Test the running system for features availability. Exit with zero |
2 """Test the running system for features availability. Exit with zero |
3 if all features are there, non-zero otherwise. |
3 if all features are there, non-zero otherwise. If a feature name is |
|
4 prefixed with "no-", the absence of feature is tested. |
4 """ |
5 """ |
5 import optparse |
6 import optparse |
6 import os |
7 import os |
7 import sys |
8 import sys |
8 import tempfile |
9 import tempfile |
65 if not quiet: |
66 if not quiet: |
66 sys.stderr.write(msg + '\n') |
67 sys.stderr.write(msg + '\n') |
67 failures += 1 |
68 failures += 1 |
68 |
69 |
69 for feature in args: |
70 for feature in args: |
|
71 negate = feature.startswith('no-') |
|
72 if negate: |
|
73 feature = feature[3:] |
|
74 |
70 if feature not in checks: |
75 if feature not in checks: |
71 error('hghave: unknown feature: ' + feature) |
76 error('hghave: unknown feature: ' + feature) |
72 continue |
77 continue |
73 |
78 |
74 check, desc = checks[feature] |
79 check, desc = checks[feature] |
75 if not check(): |
80 if not negate and not check(): |
76 error('hghave: missing feature: ' + desc) |
81 error('hghave: missing feature: ' + desc) |
|
82 elif negate and check(): |
|
83 error('hghave: unexpected feature: ' + desc) |
77 |
84 |
78 if failures != 0: |
85 if failures != 0: |
79 sys.exit(1) |
86 sys.exit(1) |
80 |
87 |
81 |
88 |