comparison en/examples/run-example @ 45:6b7b0339e7d6

Don't rerun examples unnecessarily.
author Bryan O'Sullivan <bos@serpentine.com>
date Sun, 23 Jul 2006 23:34:24 -0700
parents 5cee64874312
children a2f0b010d6e3
comparison
equal deleted inserted replaced
44:012df94a02fe 45:6b7b0339e7d6
120 if nl: hunk += '\n' 120 if nl: hunk += '\n'
121 ofp.write(hunk) 121 ofp.write(hunk)
122 # then its output 122 # then its output
123 ofp.write(tex_escape(output)) 123 ofp.write(tex_escape(output))
124 self.status('\n') 124 self.status('\n')
125 open(self.name + '.run', 'w')
125 finally: 126 finally:
126 try: 127 try:
127 output = self.sendreceive('exit\n') 128 output = self.sendreceive('exit\n')
128 if ofp: 129 if ofp:
129 ofp.write(output) 130 ofp.write(output)
141 example(a).run() 142 example(a).run()
142 return 143 return
143 for name in os.listdir(path): 144 for name in os.listdir(path):
144 if name == 'run-example' or name.startswith('.'): continue 145 if name == 'run-example' or name.startswith('.'): continue
145 if name.endswith('.out') or name.endswith('~'): continue 146 if name.endswith('.out') or name.endswith('~'): continue
147 if name.endswith('.run'): continue
146 pathname = os.path.join(path, name) 148 pathname = os.path.join(path, name)
147 st = os.lstat(pathname) 149 st = os.lstat(pathname)
148 if stat.S_ISREG(st.st_mode) and st.st_mode & 0111: 150 if stat.S_ISREG(st.st_mode) and st.st_mode & 0111:
149 example(pathname).run() 151 example(pathname).run()
150 print >> open(os.path.join(path, '.run'), 'w'), time.asctime() 152 print >> open(os.path.join(path, '.run'), 'w'), time.asctime()