summaryrefslogtreecommitdiffstats
path: root/Lib/dos-8x3/importal.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-07-22 15:23:25 (GMT)
committerGuido van Rossum <guido@python.org>1996-07-22 15:23:25 (GMT)
commit5c971677a5433aff7c1150e39bde222c24c26f39 (patch)
tree64d0b425bebe8c8a74d6ce51bc4a61817ef388f9 /Lib/dos-8x3/importal.py
parentad8b3baa919f5ab1201fca0e608905851f24e967 (diff)
downloadcpython-5c971677a5433aff7c1150e39bde222c24c26f39.zip
cpython-5c971677a5433aff7c1150e39bde222c24c26f39.tar.gz
cpython-5c971677a5433aff7c1150e39bde222c24c26f39.tar.bz2
Fuck. For PC support, this must be in the distribution.
Diffstat (limited to 'Lib/dos-8x3/importal.py')
-rwxr-xr-xLib/dos-8x3/importal.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/Lib/dos-8x3/importal.py b/Lib/dos-8x3/importal.py
new file mode 100755
index 0000000..780862c
--- /dev/null
+++ b/Lib/dos-8x3/importal.py
@@ -0,0 +1,36 @@
+# THIS IS OBSOLETE -- USE MODULE 'compileall' INSTEAD!
+
+# Utility module to import all modules in the path, in the hope
+# that this will update their ".pyc" files.
+
+import os
+import sys
+
+# Sabotage 'gl' and 'stdwin' to prevent windows popping up...
+for m in 'gl', 'stdwin', 'fl', 'fm':
+ sys.modules[m] = sys
+
+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:]
+ if tail == '.py' and head not in exceptions:
+ s = 'import ' + head
+ print s
+ try:
+ exec s + '\n'
+ except KeyboardInterrupt:
+ del names[:]
+ print '\n[interrupt]'
+ break
+ except:
+ print 'Sorry:', sys.exc_type + ':',
+ print sys.exc_value