Show More
@@ -30,10 +30,8 b' parser.add_option("--test-features", act' | |||
|
30 | 30 | help="test available features") |
|
31 | 31 | parser.add_option("--list-features", action="store_true", |
|
32 | 32 | help="list available features") |
|
33 | parser.add_option("-q", "--quiet", action="store_true", | |
|
34 | help="check features silently") | |
|
35 | 33 | |
|
36 |
def _loadaddon( |
|
|
34 | def _loadaddon(): | |
|
37 | 35 | if 'TESTDIR' in os.environ: |
|
38 | 36 | # loading from '.' isn't needed, because `hghave` should be |
|
39 | 37 | # running at TESTTMP in this case |
@@ -48,15 +46,14 b' def _loadaddon(quiet):' | |||
|
48 | 46 | try: |
|
49 | 47 | import hghaveaddon |
|
50 | 48 | except BaseException, inst: |
|
51 | if not quiet: | |
|
52 | sys.stderr.write('failed to import hghaveaddon.py from %r: %s\n' | |
|
53 | % (path, inst)) | |
|
49 | sys.stderr.write('failed to import hghaveaddon.py from %r: %s\n' | |
|
50 | % (path, inst)) | |
|
54 | 51 | sys.exit(2) |
|
55 | 52 | sys.path.pop(0) |
|
56 | 53 | |
|
57 | 54 | if __name__ == '__main__': |
|
58 | 55 | options, args = parser.parse_args() |
|
59 |
_loadaddon( |
|
|
56 | _loadaddon() | |
|
60 | 57 | if options.list_features: |
|
61 | 58 | list_features() |
|
62 | 59 | sys.exit(0) |
@@ -64,4 +61,4 b" if __name__ == '__main__':" | |||
|
64 | 61 | if options.test_features: |
|
65 | 62 | sys.exit(test_features()) |
|
66 | 63 | |
|
67 |
hghave.require(args |
|
|
64 | hghave.require(args) |
@@ -47,17 +47,16 b' def checkfeatures(features):' | |||
|
47 | 47 | |
|
48 | 48 | return result |
|
49 | 49 | |
|
50 |
def require(features |
|
|
50 | def require(features): | |
|
51 | 51 | """Require that features are available, exiting if not.""" |
|
52 | 52 | result = checkfeatures(features) |
|
53 | 53 | |
|
54 | if not quiet: | |
|
55 | for missing in result['missing']: | |
|
56 | sys.stderr.write('skipped: unknown feature: %s\n' % missing) | |
|
57 | for msg in result['skipped']: | |
|
58 | sys.stderr.write('skipped: %s\n' % msg) | |
|
59 | for msg in result['error']: | |
|
60 | sys.stderr.write('%s\n' % msg) | |
|
54 | for missing in result['missing']: | |
|
55 | sys.stderr.write('skipped: unknown feature: %s\n' % missing) | |
|
56 | for msg in result['skipped']: | |
|
57 | sys.stderr.write('skipped: %s\n' % msg) | |
|
58 | for msg in result['error']: | |
|
59 | sys.stderr.write('%s\n' % msg) | |
|
61 | 60 | |
|
62 | 61 | if result['missing']: |
|
63 | 62 | sys.exit(2) |
General Comments 0
You need to be logged in to leave comments.
Login now