]>
Commit | Line | Data |
---|---|---|
0531ce1d XL |
1 | #!/usr/bin/env python |
2 | # -*- coding: utf-8 -*- | |
3 | ||
4 | # Copyright 2018 The Rust Project Developers. See the COPYRIGHT | |
5 | # file at the top-level directory of this distribution and at | |
6 | # http://rust-lang.org/COPYRIGHT. | |
7 | # | |
8 | # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
9 | # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
10 | # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
11 | # option. This file may not be copied, modified, or distributed | |
12 | # except according to those terms. | |
13 | ||
14 | import sys | |
15 | import json | |
16 | ||
17 | if __name__ == '__main__': | |
18 | os_name = sys.argv[1] | |
19 | toolstate_file = sys.argv[2] | |
20 | current_state = sys.argv[3] | |
21 | ||
22 | with open(toolstate_file, 'r') as f: | |
23 | toolstate = json.load(f) | |
24 | with open(current_state, 'r') as f: | |
25 | current = json.load(f) | |
26 | ||
27 | regressed = False | |
28 | for cur in current: | |
29 | tool = cur['tool'] | |
30 | state = cur[os_name] | |
31 | new_state = toolstate.get(tool, '') | |
32 | if new_state < state: | |
33 | print( | |
34 | 'Error: The state of "{}" has regressed from "{}" to "{}"' | |
35 | .format(tool, state, new_state) | |
36 | ) | |
37 | regressed = True | |
38 | ||
39 | if regressed: | |
40 | sys.exit(1) |