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