| 
									
										
										
										
											1996-11-27 19:50:32 +00:00
										 |  |  | #! /bin/env python | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | """Script to write MIF files from ref.book and ref*.doc.""" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import os | 
					
						
							|  |  |  | import glob | 
					
						
							| 
									
										
										
										
											1997-11-25 20:10:19 +00:00
										 |  |  | import string | 
					
						
							| 
									
										
										
										
											1996-11-27 19:50:32 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | def main(): | 
					
						
							| 
									
										
										
										
											1997-11-25 20:10:19 +00:00
										 |  |  |     files = ['ref.book'] + glob.glob('ref*.doc') | 
					
						
							|  |  |  |     files.sort() | 
					
						
							|  |  |  |     print "Files:", string.join(files) | 
					
						
							|  |  |  |     print "Starting FrameMaker..." | 
					
						
							| 
									
										
										
										
											1996-11-27 19:50:32 +00:00
										 |  |  |     pipe = os.popen("fmbatch", 'w') | 
					
						
							| 
									
										
										
										
											1997-11-25 20:10:19 +00:00
										 |  |  |     for i in files: | 
					
						
							| 
									
										
										
										
											1996-11-27 19:50:32 +00:00
										 |  |  | 	cmd = "Open %s\nSaveAs m %s %s.MIF\n" % (i, i, os.path.splitext(i)[0]) | 
					
						
							|  |  |  | 	print cmd | 
					
						
							|  |  |  | 	pipe.write(cmd) | 
					
						
							|  |  |  |     pipe.write("Quit\n") | 
					
						
							| 
									
										
										
										
											1997-11-25 20:10:19 +00:00
										 |  |  |     sts = pipe.close() | 
					
						
							|  |  |  |     if sts: | 
					
						
							|  |  |  | 	print "Exit status", hex(sts) | 
					
						
							|  |  |  |     else: | 
					
						
							|  |  |  | 	print "Starting webmaker..." | 
					
						
							|  |  |  | 	os.system('/depot/sundry/src/webmaker/webmaker-sparc/webmaker -c ref.wml -t "Python 1.5 Reference Manual" ref.MIF') | 
					
						
							| 
									
										
										
										
											1996-11-27 19:50:32 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | if __name__ == '__main__': | 
					
						
							|  |  |  |     main() |