1991-08-16 10:28:28 -03:00
|
|
|
# Utility module to import all modules in the path, in the hope
|
|
|
|
# that this will update their ".pyc" files.
|
|
|
|
|
|
|
|
# First, see if this is the Mac or UNIX
|
|
|
|
try:
|
|
|
|
import posix
|
|
|
|
os = posix
|
|
|
|
import path
|
1991-12-26 09:05:14 -04:00
|
|
|
except ImportError:
|
1991-08-16 10:28:28 -03:00
|
|
|
import mac
|
|
|
|
os = mac
|
|
|
|
import macpath
|
|
|
|
path = macpath
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
1992-01-01 15:30:14 -04:00
|
|
|
# Sabotage 'gl' and 'stdwin' to prevent windows popping up...
|
|
|
|
for m in 'gl', 'stdwin', 'fl', 'fm':
|
|
|
|
sys.modules[m] = sys
|
|
|
|
|
1991-08-16 10:28:28 -03: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 15:30:14 -04:00
|
|
|
if tail == '.py' and head not in exceptions:
|
1991-08-16 10:28:28 -03:00
|
|
|
s = 'import ' + head
|
|
|
|
print s
|
|
|
|
try:
|
|
|
|
exec(s + '\n')
|
1992-01-01 15:30:14 -04:00
|
|
|
except KeyboardInterrupt:
|
|
|
|
del names[:]
|
|
|
|
print '\n[interrupt]'
|
|
|
|
break
|
1991-08-16 10:28:28 -03:00
|
|
|
except:
|
1992-01-01 15:30:14 -04:00
|
|
|
print 'Sorry:', sys.exc_type + ':',
|
|
|
|
print sys.exc_value
|