| 
									
										
										
										
											1994-08-29 10:52:58 +00:00
										 |  |  | # THIS IS OBSOLETE -- USE MODULE 'compileall' INSTEAD! | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1991-08-16 13:28:28 +00:00
										 |  |  | # Utility module to import all modules in the path, in the hope | 
					
						
							|  |  |  | # that this will update their ".pyc" files. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1992-03-31 19:06:54 +00:00
										 |  |  | import os | 
					
						
							| 
									
										
										
										
											1991-08-16 13:28:28 +00:00
										 |  |  | import sys | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1992-01-01 19:30:14 +00:00
										 |  |  | # Sabotage 'gl' and 'stdwin' to prevent windows popping up... | 
					
						
							|  |  |  | for m in 'gl', 'stdwin', 'fl', 'fm': | 
					
						
							|  |  |  | 	sys.modules[m] = sys | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1991-08-16 13:28:28 +00:00
										 |  |  | exceptions = ['importall'] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | for dir in sys.path: | 
					
						
							|  |  |  | 	print 'Listing', dir | 
					
						
							|  |  |  | 	try: | 
					
						
							|  |  |  | 		names = os.listdir(dir) | 
					
						
							|  |  |  | 	except os.error: | 
					
						
							|  |  |  | 		print 'Can\'t list', dir | 
					
						
							|  |  |  | 		names = [] | 
					
						
							|  |  |  | 	names.sort() | 
					
						
							|  |  |  | 	for name in names: | 
					
						
							|  |  |  | 		head, tail = name[:-3], name[-3:] | 
					
						
							| 
									
										
										
										
											1992-01-01 19:30:14 +00:00
										 |  |  | 		if tail == '.py' and head not in exceptions: | 
					
						
							| 
									
										
										
										
											1991-08-16 13:28:28 +00:00
										 |  |  | 			s = 'import ' + head | 
					
						
							|  |  |  | 			print s | 
					
						
							|  |  |  | 			try: | 
					
						
							| 
									
										
										
										
											1995-08-10 19:31:20 +00:00
										 |  |  | 				exec s + '\n' | 
					
						
							| 
									
										
										
										
											1992-01-01 19:30:14 +00:00
										 |  |  | 			except KeyboardInterrupt: | 
					
						
							|  |  |  | 				del names[:] | 
					
						
							|  |  |  | 				print '\n[interrupt]' | 
					
						
							|  |  |  | 				break | 
					
						
							| 
									
										
										
										
											1991-08-16 13:28:28 +00:00
										 |  |  | 			except: | 
					
						
							| 
									
										
										
										
											1992-01-01 19:30:14 +00:00
										 |  |  | 				print 'Sorry:', sys.exc_type + ':', | 
					
						
							|  |  |  | 				print sys.exc_value |