2 # -*- coding: utf-8 -*-
4 ## This script has two purposes: detect any tool that *regressed*, which is used
5 ## during the week before the beta branches to reject PRs; and detect any tool
6 ## that *changed* to see if we need to update the toolstate repo.
11 # Regressions for these tools during the beta cutoff week do not cause failure.
12 # See `status_check` in `checktools.sh` for tools that have to pass on the
13 # beta/stable branches.
14 REGRESSION_OK = ["rustc-guide", "miri", "embedded-book"]
16 if __name__ == '__main__':
18 toolstate_file = sys.argv[2]
19 current_state = sys.argv[3]
20 verb = sys.argv[4] # 'regressed' or 'changed'
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)
31 new_state = toolstate.get(tool, '')
32 if verb == 'regressed':
33 updated = new_state < state
34 elif verb == 'changed':
35 updated = new_state != state
37 print('Unknown verb {}'.format(updated))
41 'The state of "{}" has {} from "{}" to "{}"'
42 .format(tool, verb, state, new_state)
44 if not (verb == 'regressed' and tool in REGRESSION_OK):