1#!/usr/bin/env python2 2"""Change portions of the object files to good. 3 4This file is a test switch script. Used only for the test test_tmp_cleanup. 5The "portion" is defined by the file (which is passed as the only argument to 6this script) content. Every line in the file is an object index, which will be 7set to good (mark as 42). 8""" 9 10from __future__ import print_function 11 12import sys 13 14import common 15 16 17def Main(argv): 18 working_set = common.ReadWorkingSet() 19 object_index = common.ReadObjectIndex(argv[1]) 20 21 # Random number so the results can be checked 22 for oi in object_index: 23 working_set[int(oi)] = 42 24 25 common.WriteWorkingSet(working_set) 26 with open('tmp_file', 'w') as f: 27 f.write(argv[1]) 28 29 return 0 30 31 32if __name__ == '__main__': 33 retval = Main(sys.argv) 34 sys.exit(retval) 35