The pass loop moves the identifier list, input and output file lists, and table of contents from the pass frame to the master frame after each pass. This permits this data to be read by the next pass (while it is also regenerating the data for the pass after that).
Conceptually, the loop is said to converge when this data is the same twice in a row. However we do not test this yet because the state information is not complete.
To be complete, it must determine whether the input and output files have changed between passes. This will be done by comparing the file lists, and comparing the last modification dates on the files between passes.
Finally, output to simple files will be ignored. It is necessary to also add user controlled hooks into the convergence tests, because user script can have arbitrary side effects.
36: #line 81 "master_frame.ipk" 37: for passno in range(self.passes): 38: curpass = pass_frame(self, passno) 39: self.ids = curpass.ids # idlist 40: self.flist = curpass.flist # output file list 41: self.iflist = curpass.iflist # input file list 42: self.toc = curpass.toc # table of contents 43: self.include_files = curpass.include_files # include files 44: self.classes = curpass.classes # classes 45: self.functions = curpass.functions # functions 46: self.tests = curpass.tests # functions 47: self.section_index = curpass.section_index # functions 48: 49: if self.sequence_limit == -1: 50: self.sequence_limit = curpass.sequence 51: elif self.sequence_limit != curpass.sequence: 52: print 'WARNING: SEQUENCE COUNTER DISPARITY BETWEEN PASSES' 53: ds = curpass.fdict 54: dd = self.fdict 55: 56: file_count = 0 57: stable_file_count = 0 58: unstable_file_count = 0 59: new_file_count = 0 60: for k in ds.keys(): 61: file_count = file_count + 1 62: if not dd.has_key(k): 63: dd[k]=(ds[k],passno) 64: new_file_count = new_file_count + 1 65: else: 66: if ds[k]=='unchanged': 67: stable_file_count = stable_file_count + 1 68: else: 69: unstable_file_count = unstable_file_count + 1 70: if ds[k]!='unchanged' or dd[k][0]!='unchanged': 71: dd[k]=(ds[k],passno) 72: converged = file_count == stable_file_count 73: if converged: 74: print 'All',file_count,'output files stable on pass',passno,' -- breaking' 75: break 76: else: 77: print 'Of',file_count,'files, only',stable_file_count,'were stable on pass',passno 78: print 'There were',new_file_count,'new files,' 79: print 'and',unstable_file_count,'unstable files.' 80: if self.usecache: 81: try: 82: cache = open(self.cache_name,'w') 83: pickle.dump(self.persistent_frames, cache) 84: cache.close() 85: del cache 86: except KeyboardInterrupt: raise 87: except: 88: print 'Pickle FAILURE' 89: 90: def get_master_frame(self): return self 91: 92: def get_persistent_frame(self, seq): 93: if not self.persistent_frames.has_key(seq): 94: self.persistent_frames[seq]={} 95: return self.persistent_frames[seq] 96: